From 25ed82e7ee84a069661c3dd8b0f808049ee7fa88 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 May 2004 14:18:08 +0000 Subject: r834: Fix gconf and dir backends (This used to be commit fe5166ee88d401cdd493644af4876e803f546aef) --- .../lib/registry/reg_backend_dir/reg_backend_dir.c | 9 +++++++ .../registry/reg_backend_gconf/reg_backend_gconf.c | 17 +++++++++++-- source4/lib/registry/tools/gregedit.c | 28 ++++++++++++---------- 3 files changed, 40 insertions(+), 14 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c index cb61864d0c..c7ed95d80f 100644 --- a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c +++ b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c @@ -127,6 +127,14 @@ static WERROR reg_dir_add_value(REG_KEY *p, const char *name, int type, void *da return WERR_NOT_SUPPORTED; } +static WERROR reg_dir_get_hive(REG_HANDLE *h, int hive, REG_KEY **key) +{ + if(hive != 0) return WERR_NO_MORE_ITEMS; + *key = reg_key_new_abs("", h, NULL); + (*key)->backend_data = talloc_strdup((*key)->mem_ctx, h->location); + return WERR_OK; +} + static WERROR reg_dir_del_value(REG_VAL *v) { /* FIXME*/ @@ -137,6 +145,7 @@ static struct registry_ops reg_backend_dir = { .name = "dir", .open_registry = reg_dir_open, .open_key = reg_dir_open_key, + .get_hive = reg_dir_get_hive, .fetch_subkeys = reg_dir_fetch_subkeys, .add_key = reg_dir_add_key, .del_key = reg_dir_del_key, diff --git a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c index 8f9fd6625b..c705a2e3cb 100644 --- a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c +++ b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c @@ -41,10 +41,22 @@ static WERROR reg_close_gconf(REG_HANDLE *h) return WERR_OK; } -static WERROR gconf_open_key (REG_HANDLE *h, const char *name, REG_KEY **key) +static WERROR gconf_get_hive (REG_HANDLE *h, int hivenum, REG_KEY **key) +{ + if(hivenum != 0) return WERR_NO_MORE_ITEMS; + *key = reg_key_new_abs("", h, NULL); + (*key)->backend_data = talloc_strdup((*key)->mem_ctx, "/"); + return WERR_OK; +} + +static WERROR gconf_open_key (REG_HANDLE *h, int hivenum, const char *name, REG_KEY **key) { REG_KEY *ret; - char *fullpath = reg_path_win2unix(strdup(name)); + char *fullpath; + + if(hivenum != 0) return WERR_NO_MORE_ITEMS; + + fullpath = reg_path_win2unix(strdup(name)); /* Check if key exists */ if(!gconf_client_dir_exists((GConfClient *)h->backend_data, fullpath, NULL)) { @@ -183,6 +195,7 @@ static struct registry_ops reg_backend_gconf = { .name = "gconf", .open_registry = reg_open_gconf, .close_registry = reg_close_gconf, + .get_hive = gconf_get_hive, .open_key = gconf_open_key, .fetch_subkeys = gconf_fetch_subkeys, .fetch_values = gconf_fetch_values, diff --git a/source4/lib/registry/tools/gregedit.c b/source4/lib/registry/tools/gregedit.c index 5b78292061..d878461bff 100644 --- a/source4/lib/registry/tools/gregedit.c +++ b/source4/lib/registry/tools/gregedit.c @@ -454,24 +454,40 @@ static GtkWidget* create_mainwin (void) open_nt4 = gtk_image_menu_item_new_with_mnemonic("_Open NT4 file"); gtk_widget_show (open_nt4); gtk_container_add (GTK_CONTAINER (menu_file_menu), open_nt4); + + g_signal_connect ((gpointer) open_nt4, "activate", + G_CALLBACK (on_open_file_activate), + "nt4"); } if(reg_has_backend("w95")) { open_w95 = gtk_image_menu_item_new_with_mnemonic("_Open Win9x file"); gtk_widget_show (open_w95); gtk_container_add (GTK_CONTAINER (menu_file_menu), open_w95); + + g_signal_connect ((gpointer) open_w95, "activate", + G_CALLBACK (on_open_file_activate), + "w95"); } if(reg_has_backend("gconf")) { open_gconf = gtk_image_menu_item_new_with_mnemonic ("_Open GConf"); gtk_widget_show (open_gconf); gtk_container_add (GTK_CONTAINER (menu_file_menu), open_gconf); + + g_signal_connect ((gpointer) open_gconf, "activate", + G_CALLBACK (on_open_gconf_activate), + NULL); } if(reg_has_backend("rpc")) { open_remote = gtk_menu_item_new_with_mnemonic ("_Open Remote"); gtk_widget_show (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); } save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); @@ -605,18 +621,6 @@ static GtkWidget* create_mainwin (void) gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0); gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar), FALSE); - g_signal_connect ((gpointer) open_nt4, "activate", - G_CALLBACK (on_open_file_activate), - "nt4"); - g_signal_connect ((gpointer) open_w95, "activate", - G_CALLBACK (on_open_file_activate), - "w95"); - g_signal_connect ((gpointer) open_gconf, "activate", - G_CALLBACK (on_open_gconf_activate), - NULL); - g_signal_connect ((gpointer) open_remote, "activate", - G_CALLBACK (on_open_remote_activate), - NULL); g_signal_connect ((gpointer) save, "activate", G_CALLBACK (on_save_activate), NULL); -- cgit