r1455: More Gtk+ updates:
[samba.git] / source / gtk / tools / gregedit.c
index f34ccd9578d04d0b4b18684ec69550f20e527f24..d26f393bb9fb4998c73cd1857536502c17534fa6 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
 #include "includes.h"
+#include "gtk/common/gtk-smb.h"
 
 GtkWidget *openfilewin;
 GtkWidget *savefilewin;
 GtkTreeStore *store_keys;
 GtkListStore *store_vals;
 GtkWidget *tree_keys;
-GtkWidget *aboutwin;
 GtkWidget *mainwin;
 
 GtkWidget *save;
@@ -265,20 +253,23 @@ static void on_delete_activate                     (GtkMenuItem     *menuitem,
 static void on_about_activate                      (GtkMenuItem     *menuitem,
                                                                                gpointer         user_data)
 {
-        GtkDialog *aboutwin = GTK_DIALOG(create_gtk_samba_about_dialog());
+        GtkDialog *aboutwin = GTK_DIALOG(create_gtk_samba_about_dialog("gregedit"));
         gtk_dialog_run(aboutwin);
         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 +294,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 +475,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);