Yasumichi Akahoshi
yasum****@users*****
2005年 5月 19日 (木) 02:00:30 JST
Index: libcxp/src/cxp-gconf-pair-editor.c diff -u libcxp/src/cxp-gconf-pair-editor.c:1.2 libcxp/src/cxp-gconf-pair-editor.c:1.3 --- libcxp/src/cxp-gconf-pair-editor.c:1.2 Thu May 19 01:40:45 2005 +++ libcxp/src/cxp-gconf-pair-editor.c Thu May 19 02:00:30 2005 @@ -5,7 +5,7 @@ * A widget of Property dialog * @author Yasumichi Akahoshi <yasum****@users*****> * @date Sun Apr 3 02:53:00 2005 - * $Revision: 1.2 $ + * $Revision: 1.3 $ ****************************************************************************/ #ifdef HAVE_CONFIG_H @@ -72,10 +72,6 @@ static GtkWidget *cxp_gconf_pair_editor_list_view_new (CxpGConfPairEditor * self); static void cxp_gconf_pair_editor_get_all_entries (CxpGConfPairEditor * self); -static void cxp_gconf_pair_editor_regist_key_foreach (GtkTreeModel * model, - GtkTreePath * path, - GtkTreeIter * iter, - gpointer data); static void cxp_gconf_pair_editor_selection_foreach (GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, @@ -299,11 +295,6 @@ * the most simple solution is to unref all members on which you own a * reference. */ - model = gtk_tree_view_get_model (GTK_TREE_VIEW (private->list_view)); - gtk_tree_model_foreach (model, - (GtkTreeModelForeachFunc) - cxp_gconf_pair_editor_regist_key_foreach, obj); - g_object_unref (private->client); g_free (private->gconf_dir); g_free (private->c1_title); @@ -404,34 +395,6 @@ g_slist_free (slist); } -static void cxp_gconf_pair_editor_regist_key_foreach (GtkTreeModel * model, - GtkTreePath * path, - GtkTreeIter * iter, - gpointer data) -{ - CxpGConfPairEditorPrivate *private = - CXP_GCONF_PAIR_EDITOR_GET_PRIVATE (data); - gchar *key; - gchar *car; - gchar *cdr; - gchar *ukey; - - gtk_tree_model_get (model, iter, COL_KEY, &key, COL_CAR, &car, COL_CDR, - &cdr, COL_TERMINATOR); - if (key == NULL) - { - ukey = cxp_utils_make_unique_key (); - key = g_build_path ("/", private->gconf_dir, ukey, NULL); - g_free (ukey); - gconf_client_set_pair (private->client, key, GCONF_VALUE_STRING, - GCONF_VALUE_STRING, &car, &cdr, NULL); - } - - g_free (key); - g_free (car); - g_free (cdr); -} - /** * \if japanese * 選択された行からGtkTreeRowReferenceを得る。 @@ -474,11 +437,9 @@ g_strdup (new_text), -1); gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, COL_KEY, &key, COL_CAR, &car, COL_CDR, &cdr, -1); - if (key != NULL) - { - gconf_client_set_pair (private->client, key, GCONF_VALUE_STRING, - GCONF_VALUE_STRING, &car, &cdr, NULL); - } + + gconf_client_set_pair (private->client, key, GCONF_VALUE_STRING, + GCONF_VALUE_STRING, &car, &cdr, NULL); g_free (key); g_free (car); @@ -492,14 +453,24 @@ CXP_GCONF_PAIR_EDITOR_GET_PRIVATE (user_data); GtkTreeIter iter; GtkTreeModel *model; + gchar *ukey; gchar *key; + ukey = cxp_utils_make_unique_key (); + key = g_build_path ("/", private->gconf_dir, ukey, NULL); + model = gtk_tree_view_get_model (GTK_TREE_VIEW (private->list_view)); gtk_list_store_prepend (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_KEY, NULL, + gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_KEY, key, COL_CAR, private->c1_title, COL_CDR, private->c2_title, COL_EDITABLE, TRUE, COL_TERMINATOR); + + gconf_client_set_pair (private->client, key, GCONF_VALUE_STRING, + GCONF_VALUE_STRING, &private->c1_title, &private->c2_title, NULL); + + g_free (key); + g_free (ukey); } static void cxp_gconf_pair_editor_delete_button_clicked (GtkButton * button,