summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-dictionary/data/mate-dictionary-preferences.ui11
-rw-r--r--mate-dictionary/libgdict/gdict-source.c6
-rw-r--r--mate-dictionary/src/gdict-pref-dialog.c58
3 files changed, 66 insertions, 9 deletions
diff --git a/mate-dictionary/data/mate-dictionary-preferences.ui b/mate-dictionary/data/mate-dictionary-preferences.ui
index 1f04df8f..d7fa1db1 100644
--- a/mate-dictionary/data/mate-dictionary-preferences.ui
+++ b/mate-dictionary/data/mate-dictionary-preferences.ui
@@ -102,6 +102,17 @@
<property name="focus_on_click">True</property>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="edit_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-edit</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
</object>
<packing>
<property name="padding">0</property>
diff --git a/mate-dictionary/libgdict/gdict-source.c b/mate-dictionary/libgdict/gdict-source.c
index 97040a31..7c37d615 100644
--- a/mate-dictionary/libgdict/gdict-source.c
+++ b/mate-dictionary/libgdict/gdict-source.c
@@ -244,7 +244,7 @@ gdict_source_class_init (GdictSourceClass *klass)
PROP_NAME,
g_param_spec_string ("name",
_("Name"),
- _("The display name of this dictonary source"),
+ _("The display name of this dictionary source"),
NULL,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
/**
@@ -272,7 +272,7 @@ gdict_source_class_init (GdictSourceClass *klass)
PROP_DATABASE,
g_param_spec_string ("database",
_("Database"),
- _("The default database of this dictonary source"),
+ _("The default database of this dictionary source"),
NULL,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
/**
@@ -286,7 +286,7 @@ gdict_source_class_init (GdictSourceClass *klass)
PROP_STRATEGY,
g_param_spec_string ("strategy",
_("Strategy"),
- _("The default strategy of this dictonary source"),
+ _("The default strategy of this dictionary source"),
NULL,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
/**
diff --git a/mate-dictionary/src/gdict-pref-dialog.c b/mate-dictionary/src/gdict-pref-dialog.c
index f87fccda..72d06b9a 100644
--- a/mate-dictionary/src/gdict-pref-dialog.c
+++ b/mate-dictionary/src/gdict-pref-dialog.c
@@ -78,6 +78,7 @@ struct _GdictPrefDialog
GtkWidget *sources_view;
GtkWidget *sources_add;
GtkWidget *sources_remove;
+ GtkWidget *sources_edit;
gchar *print_font;
GtkWidget *font_button;
@@ -400,6 +401,46 @@ out:
}
static void
+source_edit_clicked_cb (GtkButton *button,
+ GdictPrefDialog *dialog)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean is_selected;
+ gchar *name, *description;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->sources_view));
+ if (!selection)
+ return;
+
+ is_selected = gtk_tree_selection_get_selected (selection, &model, &iter);
+ if (!is_selected)
+ return;
+
+ gtk_tree_model_get (model, &iter, SOURCES_NAME_COLUMN, &name, -1);
+ if (!name)
+ return;
+ else
+ {
+ GtkWidget *edit_dialog;
+
+ edit_dialog = gdict_source_dialog_new (GTK_WINDOW (dialog),
+ _("Edit Dictionary Source"),
+ GDICT_SOURCE_DIALOG_EDIT,
+ dialog->loader,
+ name);
+ gtk_dialog_run (GTK_DIALOG (edit_dialog));
+
+ gtk_widget_destroy (edit_dialog);
+ }
+
+ g_free (name);
+
+ update_sources_view (dialog);
+}
+
+static void
set_source_loader (GdictPrefDialog *dialog,
GdictSourceLoader *loader)
{
@@ -608,6 +649,12 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
g_signal_connect (dialog->sources_remove, "clicked",
G_CALLBACK (source_remove_clicked_cb), dialog);
+ dialog->sources_edit = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "edit_button"));
+ gtk_widget_set_tooltip_text (dialog->sources_edit,
+ _("Edit the currently selected dictionary source"));
+ g_signal_connect (dialog->sources_edit, "clicked",
+ G_CALLBACK (source_edit_clicked_cb), dialog);
+
font = g_settings_get_string (dialog->settings, GDICT_SETTINGS_PRINT_FONT_KEY);
dialog->font_button = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "print_font_button"));
gtk_font_button_set_font_name (GTK_FONT_BUTTON (dialog->font_button), font);
@@ -638,12 +685,12 @@ gdict_show_pref_dialog (GtkWidget *parent,
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (GDICT_IS_SOURCE_LOADER (loader));
- if (parent)
+ if (parent != NULL)
dialog = g_object_get_data (G_OBJECT (parent), "gdict-pref-dialog");
else
dialog = global_dialog;
- if (!dialog)
+ if (dialog == NULL)
{
dialog = g_object_new (GDICT_TYPE_PREF_DIALOG,
"source-loader", loader,
@@ -656,7 +703,7 @@ gdict_show_pref_dialog (GtkWidget *parent,
G_CALLBACK (gtk_widget_hide_on_delete),
NULL);
- if (parent && GTK_IS_WINDOW (parent))
+ if (parent != NULL && GTK_IS_WINDOW (parent))
{
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
@@ -668,7 +715,6 @@ gdict_show_pref_dialog (GtkWidget *parent,
global_dialog = dialog;
}
- gtk_window_set_screen (GTK_WINDOW (dialog),
- gtk_widget_get_screen (parent));
- gtk_window_present (GTK_WINDOW (dialog));
+ gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent));
+ gtk_window_present (GTK_WINDOW (dialog));
}