[gnome-dictionary] prefs: save to filename when available
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-dictionary] prefs: save to filename when available
- Date: Tue, 10 Feb 2015 21:58:56 +0000 (UTC)
commit 853e9b7d2623f4475555b8a86fff22afffe6f4e6
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Mon Dec 29 12:50:07 2014 +0100
prefs: save to filename when available
* gdict-source-dialog.c: if ::filename property is set, use its
value to save the modified source.
* See https://bugzilla.gnome.org/show_bug.cgi?id=528956
src/gdict-source-dialog.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/gdict-source-dialog.c b/src/gdict-source-dialog.c
index 6010b4f..2dbd6ca 100644
--- a/src/gdict-source-dialog.c
+++ b/src/gdict-source-dialog.c
@@ -436,11 +436,15 @@ save_source (GdictSourceDialog *dialog)
return;
}
- config_dir = gdict_get_config_dir();
- name = g_strconcat (gdict_source_get_name (source), ".desktop", NULL);
- filename = g_build_filename (config_dir, name, NULL);
- g_free (config_dir);
- g_free (name);
+ g_object_get (source, "filename", &filename, NULL);
+ if (!filename)
+ {
+ config_dir = gdict_get_config_dir();
+ name = g_strconcat (gdict_source_get_name (source), ".desktop", NULL);
+ filename = g_build_filename (config_dir, name, NULL);
+ g_free (config_dir);
+ g_free (name);
+ }
g_file_set_contents (filename, data, length, &error);
if (error)
@@ -627,7 +631,6 @@ gdict_source_dialog_constructor (GType type,
{
case GDICT_SOURCE_DIALOG_VIEW:
/* disable every editable widget */
- gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "name_entry")),
FALSE);
gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder,
"description_entry")), FALSE);
gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "hostname_entry")),
FALSE);
gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "port_entry")),
FALSE);
@@ -637,7 +640,7 @@ gdict_source_dialog_constructor (GType type,
/* we just allow closing the dialog */
dialog->close_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE);
+ GTK_RESPONSE_CANCEL);
break;
case GDICT_SOURCE_DIALOG_CREATE:
dialog->cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]