summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/gtk/tools/gregedit.c20
-rw-r--r--source4/gtk/tools/gwcrontab.c12
2 files changed, 24 insertions, 8 deletions
diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c
index f34ccd9578..6c13dcaef0 100644
--- a/source4/gtk/tools/gregedit.c
+++ b/source4/gtk/tools/gregedit.c
@@ -270,15 +270,18 @@ static void on_about_activate (GtkMenuItem *menuitem,
gtk_widget_destroy(GTK_WIDGET(aboutwin));
}
-static void on_key_activate (GtkTreeView *treeview,
- GtkTreePath *path,
- gpointer user_data)
+gboolean on_key_activate(GtkTreeSelection *selection,
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ gboolean path_currently_selected,
+ gpointer data)
{
int i;
REG_KEY *k;
REG_VAL *val;
WERROR error;
GtkTreeIter parent;
+ if(path_currently_selected)return TRUE;
gtk_tree_model_get_iter(GTK_TREE_MODEL(store_keys), &parent, path);
gtk_tree_model_get(GTK_TREE_MODEL(store_keys), &parent, 1, &k, -1);
@@ -303,7 +306,11 @@ static void on_key_activate (GtkTreeView *treeview,
-1);
}
- if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) gtk_show_werror(mainwin, error);
+ if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
+ gtk_show_werror(mainwin, error);
+ return FALSE;
+ }
+ return TRUE;
}
static GtkWidget* create_mainwin (void)
@@ -480,14 +487,13 @@ static GtkWidget* create_mainwin (void)
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_keys), GTK_TREE_MODEL(store_keys));
g_object_unref(store_keys);
- g_signal_connect ((gpointer) tree_keys, "row-activated",
- G_CALLBACK (on_key_activate),
- NULL);
+ gtk_tree_selection_set_select_function (gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_keys)), on_key_activate, NULL, NULL);
g_signal_connect ((gpointer) tree_keys, "row-expanded",
G_CALLBACK (expand_key),
NULL);
+
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow2);
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow2, TRUE, TRUE, 0);
diff --git a/source4/gtk/tools/gwcrontab.c b/source4/gtk/tools/gwcrontab.c
index cf162f2a25..9683570664 100644
--- a/source4/gtk/tools/gwcrontab.c
+++ b/source4/gtk/tools/gwcrontab.c
@@ -40,6 +40,7 @@ GtkWidget *tasks;
GtkWidget *entry_cmd;
GtkWidget *entry_repeat_weekly;
GtkWidget *entry_repeat_monthly;
+GtkWidget *delete;
void update_joblist()
{
@@ -81,6 +82,13 @@ void update_joblist()
gtk_widget_set_sensitive(tasks, TRUE);
}
+static void on_job_select(GtkTreeSelection *sel,
+ gpointer data)
+{
+ gtk_widget_set_sensitive(delete, gtk_tree_selection_get_selected(sel, NULL, NULL));
+}
+
+
void
on_connect_activate (GtkMenuItem *menuitem,
gpointer user_data)
@@ -224,7 +232,6 @@ create_mainwindow (void)
GtkWidget *new;
GtkCellRenderer *renderer;
GtkTreeViewColumn *curcol;
- GtkWidget *delete;
GtkWidget *menuitem7;
GtkWidget *menuitem7_menu;
GtkWidget *about;
@@ -277,6 +284,7 @@ create_mainwindow (void)
gtk_container_add (GTK_CONTAINER (task_menu), new);
delete = gtk_menu_item_new_with_mnemonic ("_Delete");
+ gtk_widget_set_sensitive(delete, FALSE);
gtk_widget_show (delete);
gtk_container_add (GTK_CONTAINER (task_menu), delete);
@@ -339,6 +347,8 @@ create_mainwindow (void)
gtk_widget_show (tasks);
gtk_container_add (GTK_CONTAINER (scrolledwindow), tasks);
+ g_signal_connect (gtk_tree_view_get_selection(GTK_TREE_VIEW(tasks)) , "changed", G_CALLBACK (on_job_select), NULL);
+
statusbar = gtk_statusbar_new ();
gtk_widget_show (statusbar);
gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);