r4390: Registry value and key names are case-insensitive
authorJelmer Vernooij <jelmer@samba.org>
Wed, 29 Dec 2004 12:28:35 +0000 (12:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:42 +0000 (13:07 -0500)
Nicer menu layout in gregedit
(This used to be commit 2948b9750d756880c3af7fb352f0a684a1fae9c9)

source4/gtk/tools/gregedit.c
source4/include/registry.h
source4/lib/registry/common/reg_interface.c

index 9d6aed8b6a59bf7fe1f4947c7eeebc71e7ace267..33a3117e3d55610639cddcbb0c1465f9c9ec4e5f 100644 (file)
@@ -379,6 +379,16 @@ static void on_open_gconf_activate                       (GtkMenuItem     *menui
        registry_load_hive(root);
 }
 
        registry_load_hive(root);
 }
 
+static void on_open_local_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+       WERROR error = reg_open_local(&registry);
+       if(!W_ERROR_IS_OK(error)) {
+               gtk_show_werror(mainwin, error);
+               return;
+       }
+       registry_load_root();
+}
+
 static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
        char *tmp;
 static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
        char *tmp;
@@ -661,6 +671,7 @@ static GtkWidget* create_mainwin (void)
        GtkWidget *open_w95;
        GtkWidget *open_gconf;
        GtkWidget *open_remote;
        GtkWidget *open_w95;
        GtkWidget *open_gconf;
        GtkWidget *open_remote;
+       GtkWidget *open_local;
        GtkWidget *separatormenuitem1;
        GtkWidget *quit;
        GtkWidget *men_key;
        GtkWidget *separatormenuitem1;
        GtkWidget *quit;
        GtkWidget *men_key;
@@ -694,6 +705,25 @@ static GtkWidget* create_mainwin (void)
        menu_file_menu = gtk_menu_new ();
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_file), menu_file_menu);
 
        menu_file_menu = gtk_menu_new ();
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_file), menu_file_menu);
 
+       open_local = gtk_menu_item_new_with_mnemonic ("Open _Local");
+       gtk_container_add (GTK_CONTAINER (menu_file_menu), open_local);
+       g_signal_connect ((gpointer) open_local, "activate",
+                                                 G_CALLBACK (on_open_local_activate), NULL);
+
+       if(reg_has_backend("rpc")) {
+               open_remote = gtk_menu_item_new_with_mnemonic ("Open _Remote");
+               gtk_container_add (GTK_CONTAINER (menu_file_menu), open_remote);
+
+               g_signal_connect ((gpointer) open_remote, "activate",
+                                                 G_CALLBACK (on_open_remote_activate),
+                                                 NULL);
+       }
+
+       separatormenuitem1 = gtk_menu_item_new ();
+       gtk_container_add (GTK_CONTAINER (menu_file_menu), separatormenuitem1);
+       gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+
        if(reg_has_backend("nt4")) {
                open_nt4 = gtk_image_menu_item_new_with_mnemonic("Open _NT4 file");
                gtk_container_add (GTK_CONTAINER (menu_file_menu), open_nt4);
        if(reg_has_backend("nt4")) {
                open_nt4 = gtk_image_menu_item_new_with_mnemonic("Open _NT4 file");
                gtk_container_add (GTK_CONTAINER (menu_file_menu), open_nt4);
@@ -721,15 +751,6 @@ static GtkWidget* create_mainwin (void)
                                                  NULL);
        }
 
                                                  NULL);
        }
 
-       if(reg_has_backend("rpc")) {
-               open_remote = gtk_menu_item_new_with_mnemonic ("Open _Remote");
-               gtk_container_add (GTK_CONTAINER (menu_file_menu), open_remote);
-
-               g_signal_connect ((gpointer) open_remote, "activate",
-                                                 G_CALLBACK (on_open_remote_activate),
-                                                 NULL);
-       }
-
        if(reg_has_backend("ldb")) {
                open_ldb = gtk_image_menu_item_new_with_mnemonic("Open _LDB file");
                gtk_container_add (GTK_CONTAINER (menu_file_menu), open_ldb);
        if(reg_has_backend("ldb")) {
                open_ldb = gtk_image_menu_item_new_with_mnemonic("Open _LDB file");
                gtk_container_add (GTK_CONTAINER (menu_file_menu), open_ldb);
index d90e9ccfc14e3549c806074c8be846926e18a864..bec68a0dfa8ad2061f71c16819fb00f632e85b35 100644 (file)
@@ -98,6 +98,9 @@ typedef void (*value_notification_function) (void);
  *  - just one hive (example: nt4, w95)
  *  - several hives (example: rpc).
  * 
  *  - just one hive (example: nt4, w95)
  *  - several hives (example: rpc).
  * 
+ * Backends should always do case-insensitive compares 
+ * (everything is case-insensitive but case-preserving, 
+ * just like the FS)
  */ 
 
 struct hive_operations {
  */ 
 
 struct hive_operations {
index e48fe38eb937958d2ed0ab803807007e80b496a1..9b03a69f3f8709b33575d356267ac8281472b9a1 100644 (file)
@@ -119,7 +119,7 @@ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *
        int i;
        
        for (i = 0; predef_names[i].name; i++) {
        int i;
        
        for (i = 0; predef_names[i].name; i++) {
-               if (!strcmp(predef_names[i].name, name)) return reg_get_predefined_key(ctx, predef_names[i].handle, key);
+               if (!strcasecmp(predef_names[i].name, name)) return reg_get_predefined_key(ctx, predef_names[i].handle, key);
        }
 
        DEBUG(1, ("No predefined key with name '%s'\n", name));
        }
 
        DEBUG(1, ("No predefined key with name '%s'\n", name));
@@ -347,7 +347,7 @@ WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, struct registry_key *key,
        } else if(key->hive->functions->get_subkey_by_index) {
                for(i = 0; W_ERROR_IS_OK(error); i++) {
                        error = reg_key_get_subkey_by_index(mem_ctx, key, i, subkey);
        } else if(key->hive->functions->get_subkey_by_index) {
                for(i = 0; W_ERROR_IS_OK(error); i++) {
                        error = reg_key_get_subkey_by_index(mem_ctx, key, i, subkey);
-                       if(W_ERROR_IS_OK(error) && !strcmp((*subkey)->name, name)) {
+                       if(W_ERROR_IS_OK(error) && !strcasecmp((*subkey)->name, name)) {
                                break;
                        }
                }
                                break;
                        }
                }
@@ -378,7 +378,7 @@ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, struct registry_key *key,
        } else {
                for(i = 0; W_ERROR_IS_OK(error); i++) {
                        error = reg_key_get_value_by_index(mem_ctx, key, i, val);
        } else {
                for(i = 0; W_ERROR_IS_OK(error); i++) {
                        error = reg_key_get_value_by_index(mem_ctx, key, i, val);
-                       if(W_ERROR_IS_OK(error) && !strcmp((*val)->name, name)) {
+                       if(W_ERROR_IS_OK(error) && !strcasecmp((*val)->name, name)) {
                                break;
                        }
                }
                                break;
                        }
                }