summaryrefslogtreecommitdiff
path: root/mate-dictionary/src
diff options
context:
space:
mode:
authorLaurent Napias <[email protected]>2019-06-29 11:57:35 +0200
committerZenWalker <[email protected]>2019-07-04 15:07:12 +0200
commit61b94ba9a4953aba56764dac7e0f8751aaa11571 (patch)
treec9097e01f74035b305fd47190a7f0d1bb1eb188e /mate-dictionary/src
parent34505eb50fb6f3b49c8ef08d59bcef4f6f27f6cf (diff)
downloadmate-utils-61b94ba9a4953aba56764dac7e0f8751aaa11571.tar.bz2
mate-utils-61b94ba9a4953aba56764dac7e0f8751aaa11571.tar.xz
Remove trailing whitespaces
Diffstat (limited to 'mate-dictionary/src')
-rw-r--r--mate-dictionary/src/gdict-aligned-window.c60
-rw-r--r--mate-dictionary/src/gdict-aligned-window.h16
-rw-r--r--mate-dictionary/src/gdict-app.c62
-rw-r--r--mate-dictionary/src/gdict-app.h6
-rw-r--r--mate-dictionary/src/gdict-applet.c196
-rw-r--r--mate-dictionary/src/gdict-applet.h16
-rw-r--r--mate-dictionary/src/gdict-common.c40
-rw-r--r--mate-dictionary/src/gdict-pref-dialog.c144
-rw-r--r--mate-dictionary/src/gdict-print.c28
-rw-r--r--mate-dictionary/src/gdict-source-dialog.c96
-rw-r--r--mate-dictionary/src/gdict-window.c186
-rw-r--r--mate-dictionary/src/gdict-window.h22
12 files changed, 436 insertions, 436 deletions
diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c
index a9881cd6..5ddefde2 100644
--- a/mate-dictionary/src/gdict-aligned-window.c
+++ b/mate-dictionary/src/gdict-aligned-window.c
@@ -6,14 +6,14 @@
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Ported from Seth Nickell's Python class:
@@ -38,14 +38,14 @@
struct _GdictAlignedWindowPrivate
{
GtkWidget *align_widget;
-
+
guint motion_id;
};
enum
{
PROP_0,
-
+
PROP_ALIGN_WIDGET
};
@@ -76,21 +76,21 @@ gdict_aligned_window_class_init (GdictAlignedWindowClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
+
gobject_class->set_property = gdict_aligned_window_set_property;
gobject_class->get_property = gdict_aligned_window_get_property;
gobject_class->finalize = gdict_aligned_window_finalize;
-
+
widget_class->realize = gdict_aligned_window_realize;
widget_class->show = gdict_aligned_window_show;
-
+
g_object_class_install_property (gobject_class, PROP_ALIGN_WIDGET,
g_param_spec_object ("align-widget",
"Align Widget",
"The widget the window should align to",
GTK_TYPE_WIDGET,
G_PARAM_READWRITE));
-
+
g_type_class_add_private (klass, sizeof (GdictAlignedWindowPrivate));
}
@@ -99,12 +99,12 @@ gdict_aligned_window_init (GdictAlignedWindow *aligned_window)
{
GdictAlignedWindowPrivate *priv = GDICT_ALIGNED_WINDOW_GET_PRIVATE (aligned_window);
GtkWindow *window = GTK_WINDOW (aligned_window);
-
+
aligned_window->priv = priv;
-
+
priv->align_widget = NULL;
priv->motion_id = 0;
-
+
/* set window properties */
#if 0
gtk_window_set_modal (window, TRUE);
@@ -120,7 +120,7 @@ gdict_aligned_window_get_property (GObject *object,
GParamSpec *pspec)
{
GdictAlignedWindow *aligned_window = GDICT_ALIGNED_WINDOW (object);
-
+
switch (prop_id)
{
case PROP_ALIGN_WIDGET:
@@ -139,7 +139,7 @@ gdict_aligned_window_set_property (GObject *object,
GParamSpec *pspec)
{
GdictAlignedWindow *aligned_window = GDICT_ALIGNED_WINDOW (object);
-
+
switch (prop_id)
{
case PROP_ALIGN_WIDGET:
@@ -185,7 +185,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
/* make sure the align_widget is realized before we do anything */
gtk_widget_realize (align_widget);
-
+
/* get the positional and dimensional attributes of the align widget */
gdk_window_get_origin (gdk_window,
&entry_x,
@@ -197,22 +197,22 @@ gdict_aligned_window_position (GdictAlignedWindow *window)
else
{
x = entry_x + entry_width - our_width - 1;
-
+
gravity = GDK_GRAVITY_NORTH_EAST;
}
-
+
if (entry_y + entry_height + our_height < HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())))
y = entry_y + entry_height - 1;
else
{
y = entry_y - our_height + 1;
-
+
if (gravity == GDK_GRAVITY_NORTH_EAST)
gravity = GDK_GRAVITY_SOUTH_EAST;
else
gravity = GDK_GRAVITY_SOUTH_WEST;
}
-
+
gtk_window_set_gravity (GTK_WINDOW (window), gravity);
gtk_window_move (GTK_WINDOW (window), x, y);
}
@@ -229,7 +229,7 @@ static void
gdict_aligned_window_show (GtkWidget *widget)
{
gdict_aligned_window_position (GDICT_ALIGNED_WINDOW (widget));
-
+
GTK_WIDGET_CLASS (gdict_aligned_window_parent_class)->show (widget);
}
@@ -248,7 +248,7 @@ gdict_aligned_window_motion_notify_cb (GtkWidget *widget,
GdkRectangle rect;
gtk_widget_get_allocation (GTK_WIDGET (aligned_window), &alloc);
-
+
rect.x = 0;
rect.y = 0;
rect.width = alloc.width;
@@ -257,7 +257,7 @@ gdict_aligned_window_motion_notify_cb (GtkWidget *widget,
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (aligned_window)),
&rect,
FALSE);
-
+
return FALSE;
}
@@ -294,24 +294,24 @@ gdict_aligned_window_set_widget (GdictAlignedWindow *aligned_window,
GtkWidget *align_widget)
{
GdictAlignedWindowPrivate *priv;
-
+
g_return_if_fail (GDICT_IS_ALIGNED_WINDOW (aligned_window));
g_return_if_fail (GTK_IS_WIDGET (align_widget));
-#if 0
+#if 0
if (GTK_WIDGET_NO_WINDOW (align_widget))
{
g_warning ("Attempting to set a widget of class '%s' as the "
"align widget, but widgets of this class does not "
"have a GdkWindow.",
g_type_name (G_OBJECT_TYPE (align_widget)));
-
+
return;
}
#endif
priv = GDICT_ALIGNED_WINDOW_GET_PRIVATE (aligned_window);
-
+
if (priv->align_widget)
{
g_signal_handler_disconnect (priv->align_widget, priv->motion_id);
@@ -336,6 +336,6 @@ GtkWidget *
gdict_aligned_window_get_widget (GdictAlignedWindow *aligned_window)
{
g_return_val_if_fail (GDICT_IS_ALIGNED_WINDOW (aligned_window), NULL);
-
+
return aligned_window->priv->align_widget;
}
diff --git a/mate-dictionary/src/gdict-aligned-window.h b/mate-dictionary/src/gdict-aligned-window.h
index b81bcf55..d1f4f67e 100644
--- a/mate-dictionary/src/gdict-aligned-window.h
+++ b/mate-dictionary/src/gdict-aligned-window.h
@@ -6,14 +6,14 @@
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Ported from Seth Nickell's Python class:
@@ -42,7 +42,7 @@ struct _GdictAlignedWindow
{
/*< private >*/
GtkWindow parent_instance;
-
+
GdictAlignedWindowPrivate *priv;
};
@@ -50,7 +50,7 @@ struct _GdictAlignedWindowClass
{
/*< private >*/
GtkWindowClass parent_class;
-
+
void (*_gdict_reserved1) (void);
void (*_gdict_reserved2) (void);
void (*_gdict_reserved3) (void);
diff --git a/mate-dictionary/src/gdict-app.c b/mate-dictionary/src/gdict-app.c
index a8b79b38..fe5e5b32 100644
--- a/mate-dictionary/src/gdict-app.c
+++ b/mate-dictionary/src/gdict-app.c
@@ -55,12 +55,12 @@ static void
gdict_app_finalize (GObject *object)
{
GdictApp *app = GDICT_APP (object);
-
+
if (app->loader)
g_object_unref (app->loader);
-
+
app->current_window = NULL;
-
+
g_slist_free_full (app->windows, (GDestroyNotify) gtk_widget_destroy);
g_slist_free_full (app->lookup_words, g_free);
g_slist_free_full (app->match_words, g_free);
@@ -75,7 +75,7 @@ static void
gdict_app_class_init (GdictAppClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
+
gobject_class->finalize = gdict_app_finalize;
}
@@ -92,16 +92,16 @@ gdict_window_destroy_cb (GtkWidget *widget,
{
GdictWindow *window = GDICT_WINDOW (widget);
GdictApp *app = GDICT_APP (user_data);
-
+
g_assert (GDICT_IS_APP (app));
app->windows = g_slist_remove (app->windows, window);
-
+
if (window == app->current_window)
app->current_window = app->windows ? app->windows->data : NULL;
-
+
if (app->windows == NULL)
- gtk_main_quit ();
+ gtk_main_quit ();
}
static void
@@ -110,7 +110,7 @@ gdict_window_created_cb (GdictWindow *parent,
gpointer user_data)
{
GdictApp *app = GDICT_APP (user_data);
-
+
/* this might seem convoluted - but it's necessary, since I don't want
* GdictWindow to know about the GdictApp singleton. every time a new
* window is created by a GdictWindow, it will register its "child window"
@@ -125,7 +125,7 @@ gdict_window_created_cb (GdictWindow *parent,
if (gtk_window_get_group (GTK_WINDOW (parent)))
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (parent)),
GTK_WINDOW (new_window));
-
+
app->windows = g_slist_prepend (app->windows, new_window);
app->current_window = new_window;
}
@@ -147,15 +147,15 @@ gdict_create_window (GdictApp *app)
G_CALLBACK (gdict_window_created_cb), app);
g_signal_connect (window, "destroy",
G_CALLBACK (gdict_window_destroy_cb), app);
-
+
app->windows = g_slist_prepend (app->windows, window);
app->current_window = GDICT_WINDOW (window);
-
+
gtk_widget_show (window);
return;
}
-
+
for (l = singleton->lookup_words; l != NULL; l = l->next)
{
gchar *word = l->data;
@@ -165,15 +165,15 @@ gdict_create_window (GdictApp *app)
singleton->loader,
singleton->source_name,
word);
-
+
g_signal_connect (window, "created",
G_CALLBACK (gdict_window_created_cb), app);
g_signal_connect (window, "destroy",
G_CALLBACK (gdict_window_destroy_cb), app);
-
+
app->windows = g_slist_prepend (app->windows, window);
app->current_window = GDICT_WINDOW (window);
-
+
gtk_widget_show (window);
}
@@ -186,12 +186,12 @@ gdict_create_window (GdictApp *app)
singleton->loader,
singleton->source_name,
word);
-
+
g_signal_connect (window, "created",
G_CALLBACK (gdict_window_created_cb), app);
g_signal_connect (window, "destroy",
G_CALLBACK (gdict_window_destroy_cb), app);
-
+
app->windows = g_slist_prepend (app->windows, window);
app->current_window = GDICT_WINDOW (window);
@@ -244,7 +244,7 @@ gdict_look_up_word_and_quit (GdictApp *app)
GdictSource *source;
GdictContext *context;
GSList *l;
-
+
if (!app->lookup_words)
{
g_print (_("See mate-dictionary --help for usage\n"));
@@ -336,15 +336,15 @@ gdict_init (int *argc, char ***argv)
N_("Words to look up"), N_("word") },
{ NULL },
};
-
- g_assert (singleton == NULL);
-
+
+ g_assert (singleton == NULL);
+
singleton = GDICT_APP (g_object_new (GDICT_TYPE_APP, NULL));
g_assert (GDICT_IS_APP (singleton));
-
+
/* create the new option context */
context = g_option_context_new (_(" - Look up words in dictionaries"));
-
+
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, gdict_app_goptions, GETTEXT_PACKAGE);
g_option_context_add_group (context, gdict_get_option_group ());
@@ -360,10 +360,10 @@ gdict_init (int *argc, char ***argv)
exit (1);
}
-
+
g_set_application_name (_("Dictionary"));
gtk_window_set_default_icon_name ("accessories-dictionary");
-
+
if (!gdict_create_data_dir ())
{
gdict_cleanup ();
@@ -373,9 +373,9 @@ gdict_init (int *argc, char ***argv)
singleton->settings = g_settings_new ("org.mate.dictionary");
- /* add user's path for fetching dictionary sources */
+ /* add user's path for fetching dictionary sources */
singleton->loader = gdict_source_loader_new ();
- loader_path = gdict_get_data_dir ();
+ loader_path = gdict_get_data_dir ();
gdict_source_loader_add_search_path (singleton->loader, loader_path);
g_free (loader_path);
@@ -401,7 +401,7 @@ gdict_init (int *argc, char ***argv)
if (database)
singleton->database = g_strdup (database);
-
+
if (source_name)
singleton->source_name = g_strdup (source_name);
@@ -417,12 +417,12 @@ gdict_main (void)
g_warning ("You must initialize GdictApp using gdict_init()\n");
return;
}
-
+
if (!singleton->no_window)
gdict_create_window (singleton);
else
gdict_look_up_word_and_quit (singleton);
-
+
gtk_main ();
}
diff --git a/mate-dictionary/src/gdict-app.h b/mate-dictionary/src/gdict-app.h
index f91bc908..b0a6ae2d 100644
--- a/mate-dictionary/src/gdict-app.h
+++ b/mate-dictionary/src/gdict-app.h
@@ -48,15 +48,15 @@ struct _GdictApp
GSList *lookup_words;
GSList *match_words;
gint remaining_words;
-
+
gchar *database;
gchar *source_name;
gboolean no_window;
-
+
GdictSourceLoader *loader;
GdictWindow *current_window;
- GSList *windows;
+ GSList *windows;
};
diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c
index 11a3f85e..8dba6ec3 100644
--- a/mate-dictionary/src/gdict-applet.c
+++ b/mate-dictionary/src/gdict-applet.c
@@ -6,14 +6,14 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -52,17 +52,17 @@ struct _GdictAppletPrivate
{
guint size;
GtkOrientation orient;
-
+
GSettings *settings;
GSettings *desktop_settings;
gchar *database;
gchar *strategy;
- gchar *source_name;
+ gchar *source_name;
gchar *print_font;
gchar *defbox_font;
- gchar *word;
+ gchar *word;
GdictContext *context;
guint lookup_start_id;
guint lookup_end_id;
@@ -112,9 +112,9 @@ static void
set_atk_name_description (GtkWidget *widget,
const char *name,
const char *description)
-{
+{
AtkObject *aobj;
-
+
aobj = gtk_widget_get_accessible (widget);
if (!GTK_IS_ACCESSIBLE (aobj))
return;
@@ -137,7 +137,7 @@ set_window_default_size (GdictApplet *applet)
if (!priv->window)
return;
-
+
widget = priv->window;
defbox = priv->defbox;
@@ -176,7 +176,7 @@ clear_cb (GtkWidget *widget,
if (!priv->defbox)
return;
-
+
gdict_defbox_clear (GDICT_DEFBOX (priv->defbox));
}
@@ -188,7 +188,7 @@ print_cb (GtkWidget *widget,
if (!priv->defbox)
return;
-
+
gdict_show_print_dialog (GTK_WINDOW (priv->window),
GDICT_DEFBOX (priv->defbox));
}
@@ -202,7 +202,7 @@ save_cb (GtkWidget *widget,
if (!priv->defbox)
return;
-
+
dialog = gtk_file_chooser_dialog_new (_("Save a Copy"),
GTK_WINDOW (priv->window),
GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -210,22 +210,22 @@ save_cb (GtkWidget *widget,
"gtk-save", GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
-
+
/* default to user's $HOME */
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_home_dir ());
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), _("Untitled document"));
-
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
gchar *filename;
gchar *text;
gsize len;
GError *write_error = NULL;
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
+
text = gdict_defbox_get_text (GDICT_DEFBOX (priv->defbox), &len);
-
+
g_file_set_contents (filename,
text,
len,
@@ -233,17 +233,17 @@ save_cb (GtkWidget *widget,
if (write_error)
{
gchar *message;
-
+
message = g_strdup_printf (_("Error while writing to '%s'"), filename);
-
+
gdict_show_error_dialog (GTK_WINDOW (priv->window),
message,
write_error->message);
-
+
g_error_free (write_error);
g_free (message);
}
-
+
g_free (text);
g_free (filename);
}
@@ -276,7 +276,7 @@ window_key_press_event_cb (GtkWidget *widget,
gpointer user_data)
{
GdictApplet *applet = GDICT_APPLET (user_data);
-
+
if (event->keyval == GDK_KEY_Escape)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (applet->priv->toggle), FALSE);
@@ -318,7 +318,7 @@ gdict_applet_build_window (GdictApplet *applet)
return;
}
-
+
window = gdict_aligned_window_new (priv->toggle);
g_signal_connect (window, "key-press-event",
G_CALLBACK (window_key_press_event_cb),
@@ -337,11 +337,11 @@ gdict_applet_build_window (GdictApplet *applet)
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
-
+
priv->defbox = gdict_defbox_new ();
if (priv->context)
gdict_defbox_set_context (GDICT_DEFBOX (priv->defbox), priv->context);
-
+
gtk_box_pack_start (GTK_BOX (vbox), priv->defbox, TRUE, TRUE, 0);
gtk_widget_show (priv->defbox);
gtk_widget_set_can_focus (priv->defbox, TRUE);
@@ -352,7 +352,7 @@ gdict_applet_build_window (GdictApplet *applet)
gtk_box_set_spacing (GTK_BOX (bbox), 6);
gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
gtk_widget_show (bbox);
-
+
button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON,
"label", "gtk-clear",
"use-stock", TRUE,
@@ -363,7 +363,7 @@ gdict_applet_build_window (GdictApplet *applet)
set_atk_name_description (button,
_("Clear definition"),
_("Clear the text of the definition"));
-
+
g_signal_connect (button, "clicked", G_CALLBACK (clear_cb), applet);
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
@@ -378,7 +378,7 @@ gdict_applet_build_window (GdictApplet *applet)
set_atk_name_description (button,
_("Print definition"),
_("Print the text of the definition"));
-
+
g_signal_connect (button, "clicked", G_CALLBACK (print_cb), applet);
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
@@ -393,13 +393,13 @@ gdict_applet_build_window (GdictApplet *applet)
set_atk_name_description (button,
_("Save definition"),
_("Save the text of the definition to a file"));
-
+
g_signal_connect (button, "clicked", G_CALLBACK (save_cb), applet);
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
-
+
gtk_window_set_default (GTK_WINDOW (window), priv->defbox);
-
+
priv->window = window;
priv->is_window_showing = FALSE;
}
@@ -412,14 +412,14 @@ gdict_applet_icon_toggled_cb (GtkWidget *widget,
if (!priv->window)
gdict_applet_build_window (applet);
-
+
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
gtk_window_set_screen (GTK_WINDOW (priv->window),
gtk_widget_get_screen (GTK_WIDGET (applet)));
gtk_window_present (GTK_WINDOW (priv->window));
gtk_widget_grab_focus (priv->defbox);
-
+
priv->is_window_showing = TRUE;
}
else
@@ -429,7 +429,7 @@ gdict_applet_icon_toggled_cb (GtkWidget *widget,
gtk_widget_grab_focus (priv->entry);
gtk_widget_hide (priv->window);
-
+
priv->is_window_showing = FALSE;
}
@@ -442,14 +442,14 @@ gdict_applet_entry_activate_cb (GtkWidget *widget,
{
GdictAppletPrivate *priv = applet->priv;
gchar *text;
-
+
text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
if (!text)
return;
-
+
g_free (priv->word);
priv->word = text;
-
+
if (!priv->window)
gdict_applet_build_window (applet);
@@ -462,14 +462,14 @@ gdict_applet_entry_key_press_cb (GtkWidget *widget,
gpointer user_data)
{
GdictAppletPrivate *priv = GDICT_APPLET (user_data)->priv;
-
+
if (event->keyval == GDK_KEY_Escape)
{
if (priv->is_window_showing)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toggle), FALSE);
gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->toggle));
-
+
return TRUE;
}
}
@@ -488,7 +488,7 @@ gdict_applet_icon_button_press_event_cb (GtkWidget *widget,
GdictApplet *applet)
{
GdictAppletPrivate *priv = applet->priv;
-
+
/* we don't want to block the applet's popup menu unless the
* user is toggling the button
*/
@@ -518,12 +518,12 @@ gdict_applet_draw (GdictApplet *applet)
if (priv->entry)
text = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
-
+
if (priv->box)
gtk_widget_destroy (priv->box);
box = gtk_box_new (priv->orient, 0);
-
+
gtk_container_add (GTK_CONTAINER (applet), box);
gtk_widget_show (box);
@@ -533,7 +533,7 @@ gdict_applet_draw (GdictApplet *applet)
set_atk_name_description (priv->toggle,
_("Toggle dictionary window"),
_("Show or hide the definition window"));
-
+
gtk_button_set_relief (GTK_BUTTON (priv->toggle),
GTK_RELIEF_NONE);
g_signal_connect (priv->toggle, "toggled",
@@ -553,7 +553,7 @@ gdict_applet_draw (GdictApplet *applet)
if (priv->icon)
{
GdkPixbuf *scaled;
-
+
priv->image = gtk_image_new ();
gtk_image_set_pixel_size (GTK_IMAGE (priv->image), priv->size - 10);
@@ -561,12 +561,12 @@ gdict_applet_draw (GdictApplet *applet)
priv->size - 5,
priv->size - 5,
GDK_INTERP_BILINEAR);
-
+
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled);
g_object_unref (scaled);
-
+
gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0);
-
+
gtk_widget_show (priv->image);
}
else
@@ -576,7 +576,7 @@ gdict_applet_draw (GdictApplet *applet)
gtk_image_set_pixel_size (GTK_IMAGE (priv->image), priv->size - 10);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
"image-missing", -1);
-
+
gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0);
gtk_widget_show (priv->image);
}
@@ -587,7 +587,7 @@ gdict_applet_draw (GdictApplet *applet)
set_atk_name_description (priv->entry,
_("Dictionary entry"),
_("Look up words in dictionaries"));
-
+
gtk_editable_set_editable (GTK_EDITABLE (priv->entry), TRUE);
gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), 12);
g_signal_connect (priv->entry, "activate",
@@ -608,13 +608,13 @@ gdict_applet_draw (GdictApplet *applet)
g_free (text);
}
-
+
priv->box = box;
#if 0
gtk_widget_grab_focus (priv->entry);
#endif
-
+
gtk_widget_show_all (GTK_WIDGET (applet));
return FALSE;
@@ -640,7 +640,7 @@ gdict_applet_lookup_start_cb (GdictContext *context,
if (!priv->is_window_showing)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toggle), TRUE);
-
+
gtk_window_present (GTK_WINDOW (priv->window));
gtk_widget_grab_focus (priv->defbox);
@@ -674,17 +674,17 @@ gdict_applet_cmd_lookup (GtkAction *action,
{
GdictAppletPrivate *priv = applet->priv;
gchar *text = NULL;;
-
+
text = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
if (!text)
return;
-
+
g_free (priv->word);
priv->word = text;
-
+
if (!priv->window)
gdict_applet_build_window (applet);
-
+
gdict_defbox_lookup (GDICT_DEFBOX (priv->defbox), priv->word);
}
@@ -734,7 +734,7 @@ gdict_applet_cmd_help (GtkAction *action,
gtk_show_uri_on_window (NULL,
"help:mate-dictionary/mate-dictionary-applet",
gtk_get_current_event_time (), &err);
-
+
if (err)
{
gdict_show_error_dialog (NULL,
@@ -751,7 +751,7 @@ gdict_applet_change_orient (MatePanelApplet *applet,
GdictAppletPrivate *priv = GDICT_APPLET (applet)->priv;
guint new_size;
GtkAllocation allocation;
-
+
gtk_widget_get_allocation (GTK_WIDGET (applet), &allocation);
switch (orient)
{
@@ -766,12 +766,12 @@ gdict_applet_change_orient (MatePanelApplet *applet,
new_size = allocation.height;
break;
}
-
+
if (new_size != priv->size)
priv->size = new_size;
-
+
gdict_applet_queue_draw (GDICT_APPLET (applet));
-
+
if (MATE_PANEL_APPLET_CLASS (gdict_applet_parent_class)->change_orient)
MATE_PANEL_APPLET_CLASS (gdict_applet_parent_class)->change_orient (applet,
orient);
@@ -784,12 +784,12 @@ gdict_applet_size_allocate (GtkWidget *widget,
GdictApplet *applet = GDICT_APPLET (widget);
GdictAppletPrivate *priv = applet->priv;
guint new_size;
-
+
if (priv->orient == GTK_ORIENTATION_HORIZONTAL)
new_size = allocation->height;
else
new_size = allocation->width;
-
+
if (priv->size != new_size)
{
priv->size = new_size;
@@ -805,7 +805,7 @@ gdict_applet_size_allocate (GtkWidget *widget,
priv->size - 5,
priv->size - 5,
GDK_INTERP_BILINEAR);
-
+
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled);
g_object_unref (scaled);
}
@@ -833,7 +833,7 @@ gdict_applet_set_database (GdictApplet *applet,
const gchar *database)
{
GdictAppletPrivate *priv = applet->priv;
-
+
g_free (priv->database);
if (database != NULL && *database != '\0')
@@ -851,7 +851,7 @@ gdict_applet_set_strategy (GdictApplet *applet,
const gchar *strategy)
{
GdictAppletPrivate *priv = applet->priv;
-
+
g_free (priv->strategy);
if (strategy != NULL && *strategy != '\0')
@@ -876,42 +876,42 @@ get_context_from_loader (GdictApplet *applet)
if (!source)
{
gchar *detail;
-
+
detail = g_strdup_printf (_("No dictionary source available with name '%s'"),
priv->source_name);
gdict_show_error_dialog (NULL,
_("Unable to find dictionary source"),
detail);
-
+
g_free (detail);
return NULL;
}
-
+
gdict_applet_set_database (applet, gdict_source_get_database (source));
gdict_applet_set_strategy (applet, gdict_source_get_strategy (source));
-
+
retval = gdict_source_get_context (source);
if (!retval)
{
gchar *detail;
-
+
detail = g_strdup_printf (_("No context available for source '%s'"),
gdict_source_get_description (source));
-
+
gdict_show_error_dialog (NULL,
_("Unable to create a context"),
detail);
-
+
g_free (detail);
g_object_unref (source);
-
+
return NULL;
}
-
+
g_object_unref (source);
-
+
return retval;
}
@@ -954,17 +954,17 @@ gdict_applet_set_context (GdictApplet *applet,
GdictContext *context)
{
GdictAppletPrivate *priv = applet->priv;
-
+
if (priv->context)
{
g_signal_handler_disconnect (priv->context, priv->lookup_start_id);
g_signal_handler_disconnect (priv->context, priv->lookup_end_id);
g_signal_handler_disconnect (priv->context, priv->error_id);
-
+
priv->lookup_start_id = 0;
priv->lookup_end_id = 0;
priv->error_id = 0;
-
+
g_object_unref (priv->context);
priv->context = NULL;
}
@@ -974,7 +974,7 @@ gdict_applet_set_context (GdictApplet *applet,
if (!context)
return;
-
+
/* attach our callbacks */
priv->lookup_start_id = g_signal_connect (context, "lookup-start",
G_CALLBACK (gdict_applet_lookup_start_cb),
@@ -985,7 +985,7 @@ gdict_applet_set_context (GdictApplet *applet,
priv->error_id = g_signal_connect (context, "error",
G_CALLBACK (gdict_applet_error_cb),
applet);
-
+
priv->context = context;
}
@@ -1003,7 +1003,7 @@ gdict_applet_set_source_name (GdictApplet *applet,
else
priv->source_name = g_settings_get_string (priv->settings,
GDICT_SETTINGS_SOURCE_KEY);
-
+
context = get_context_from_loader (applet);
gdict_applet_set_context (applet, context);
}
@@ -1073,18 +1073,18 @@ gdict_applet_finalize (GObject *object)
g_object_unref (priv->context);
}
-
+
if (priv->loader)
g_object_unref (priv->loader);
-
+
if (priv->icon)
g_object_unref (priv->icon);
-
+
g_free (priv->source_name);
g_free (priv->print_font);
g_free (priv->defbox_font);
g_free (priv->word);
-
+
G_OBJECT_CLASS (gdict_applet_parent_class)->finalize (object);
}
@@ -1094,14 +1094,14 @@ gdict_applet_class_init (GdictAppletClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
MatePanelAppletClass *applet_class = MATE_PANEL_APPLET_CLASS (klass);
-
+
gobject_class->finalize = gdict_applet_finalize;
-
+
widget_class->size_allocate = gdict_applet_size_allocate;
widget_class->style_set = gdict_applet_style_set;
-
+
applet_class->change_orient = gdict_applet_change_orient;
-
+
g_type_class_add_private (gobject_class, sizeof (GdictAppletPrivate));
}
@@ -1113,7 +1113,7 @@ gdict_applet_init (GdictApplet *applet)
priv = GDICT_APPLET_GET_PRIVATE (applet);
applet->priv = priv;
-
+
if (!priv->loader)
priv->loader = gdict_source_loader_new ();
@@ -1121,9 +1121,9 @@ gdict_applet_init (GdictApplet *applet)
data_dir = gdict_get_data_dir ();
gdict_source_loader_add_search_path (priv->loader, data_dir);
g_free (data_dir);
-
+
gtk_window_set_default_icon_name ("accessories-dictionary");
-
+
mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet),
MATE_PANEL_APPLET_EXPAND_MINOR);
@@ -1158,7 +1158,7 @@ gdict_applet_init (GdictApplet *applet)
48,
0,
NULL);
-
+
/* force first draw */
gdict_applet_draw (applet);
@@ -1221,7 +1221,7 @@ gdict_applet_factory (MatePanelApplet *applet,
/* set the menu items insensitive */
gdict_applet_set_menu_items_sensitive (dictionary_applet, FALSE);
-
+
retval = TRUE;
}
diff --git a/mate-dictionary/src/gdict-applet.h b/mate-dictionary/src/gdict-applet.h
index c4776488..cf9396ed 100644
--- a/mate-dictionary/src/gdict-applet.h
+++ b/mate-dictionary/src/gdict-applet.h
@@ -6,14 +6,14 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -37,8 +37,8 @@ typedef struct _GdictAppletPrivate GdictAppletPrivate;
struct _GdictApplet
{
MatePanelApplet parent_instance;
-
- GdictAppletPrivate *priv;
+
+ GdictAppletPrivate *priv;
};
GType gdict_applet_get_type (void);
diff --git a/mate-dictionary/src/gdict-common.c b/mate-dictionary/src/gdict-common.c
index 1686a87e..7c0b3063 100644
--- a/mate-dictionary/src/gdict-common.c
+++ b/mate-dictionary/src/gdict-common.c
@@ -48,7 +48,7 @@ gdict_get_data_dir (void)
"mate",
"mate-dictionary",
NULL);
-
+
return retval;
}
@@ -57,7 +57,7 @@ gboolean
gdict_create_data_dir (void)
{
gchar *data_dir_name;
-
+
data_dir_name = gdict_get_data_dir ();
if (g_mkdir_with_parents (data_dir_name, 0700) == -1)
{
@@ -68,7 +68,7 @@ gdict_create_data_dir (void)
(g_file_test (data_dir_name, G_FILE_TEST_IS_REGULAR)))
{
gchar *backup = g_strdup_printf ("%s.pre-2-14", data_dir_name);
-
+
if (g_rename (data_dir_name, backup) == -1)
{
GtkWidget *error_dialog;
@@ -81,9 +81,9 @@ gdict_create_data_dir (void)
data_dir_name,
backup,
g_strerror (errno));
-
+
gtk_dialog_run (GTK_DIALOG (error_dialog));
-
+
gtk_widget_destroy (error_dialog);
g_free (backup);
g_free (data_dir_name);
@@ -92,11 +92,11 @@ gdict_create_data_dir (void)
}
g_free (backup);
-
+
if (g_mkdir_with_parents (data_dir_name, 0700) == -1)
{
GtkWidget *error_dialog;
-
+
error_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
@@ -104,9 +104,9 @@ gdict_create_data_dir (void)
_("Unable to create the data directory '%s': %s"),
data_dir_name,
g_strerror (errno));
-
+
gtk_dialog_run (GTK_DIALOG (error_dialog));
-
+
gtk_widget_destroy (error_dialog);
g_free (data_dir_name);
@@ -115,7 +115,7 @@ gdict_create_data_dir (void)
goto success;
}
-
+
if (errno != EEXIST)
{
GtkWidget *error_dialog;
@@ -127,9 +127,9 @@ gdict_create_data_dir (void)
_("Unable to create the data directory '%s': %s"),
data_dir_name,
g_strerror (errno));
-
+
gtk_dialog_run (GTK_DIALOG (error_dialog));
-
+
gtk_widget_destroy (error_dialog);
g_free (data_dir_name);
@@ -150,26 +150,26 @@ gdict_show_error_dialog (GtkWindow *parent,
const gchar *detail)
{
GtkWidget *dialog;
-
+
g_return_if_fail ((parent == NULL) || (GTK_IS_WINDOW (parent)));
g_return_if_fail (message != NULL);
-
+
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
"%s", message);
gtk_window_set_title (GTK_WINDOW (dialog), "");
-
+
if (detail)
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", detail);
-
+
if (parent && gtk_window_get_group (parent))
gtk_window_group_add_window (gtk_window_get_group (parent), GTK_WINDOW (dialog));
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
-
+
gtk_widget_destroy (dialog);
}
@@ -181,9 +181,9 @@ gdict_show_gerror_dialog (GtkWindow *parent,
g_return_if_fail ((parent == NULL) || (GTK_IS_WINDOW (parent)));
g_return_if_fail (message != NULL);
g_return_if_fail (error != NULL);
-
+
gdict_show_error_dialog (parent, message, error->message);
-
+
g_error_free (error);
error = NULL;
}
diff --git a/mate-dictionary/src/gdict-pref-dialog.c b/mate-dictionary/src/gdict-pref-dialog.c
index d6dbcab2..e94ffc44 100644
--- a/mate-dictionary/src/gdict-pref-dialog.c
+++ b/mate-dictionary/src/gdict-pref-dialog.c
@@ -56,7 +56,7 @@ enum
SOURCES_ACTIVE_COLUMN = 0,
SOURCES_NAME_COLUMN,
SOURCES_DESCRIPTION_COLUMN,
-
+
SOURCES_N_COLUMNS
};
@@ -67,22 +67,22 @@ struct _GdictPrefDialog
GtkBuilder *builder;
GSettings *settings;
-
+
gchar *active_source;
GdictSourceLoader *loader;
GtkListStore *sources_list;
-
+
/* direct pointers to widgets */
GtkWidget *notebook;
-
+
GtkWidget *sources_view;
GtkWidget *sources_add;
GtkWidget *sources_remove;
GtkWidget *sources_edit;
-
+
gchar *print_font;
GtkWidget *font_button;
-
+
GtkWidget *help_button;
GtkWidget *close_button;
};
@@ -111,21 +111,21 @@ select_active_source_name (GtkTreeModel *model,
{
GdictPrefDialog *dialog = GDICT_PREF_DIALOG (data);
gboolean is_active;
-
+
gtk_tree_model_get (model, iter,
SOURCES_ACTIVE_COLUMN, &is_active,
-1);
if (is_active)
{
GtkTreeSelection *selection;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->sources_view));
-
+
gtk_tree_selection_select_iter (selection, iter);
-
+
return TRUE;
}
-
+
return FALSE;
}
@@ -133,14 +133,14 @@ static void
update_sources_view (GdictPrefDialog *dialog)
{
const GSList *sources, *l;
-
+
gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view), NULL);
-
+
gtk_list_store_clear (dialog->sources_list);
-
+
/* force update of the sources list */
gdict_source_loader_update (dialog->loader);
-
+
sources = gdict_source_loader_get_sources (dialog->loader);
for (l = sources; l != NULL; l = l->next)
{
@@ -148,7 +148,7 @@ update_sources_view (GdictPrefDialog *dialog)
GtkTreeIter iter;
const gchar *name, *description;
gboolean is_active = FALSE;
-
+
name = gdict_source_get_name (source);
description = gdict_source_get_description (source);
if (!description)
@@ -167,7 +167,7 @@ update_sources_view (GdictPrefDialog *dialog)
gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view),
GTK_TREE_MODEL (dialog->sources_list));
-
+
/* select the currently active source name */
gtk_tree_model_foreach (GTK_TREE_MODEL (dialog->sources_list),
select_active_source_name,
@@ -184,7 +184,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer,
gboolean res;
gboolean is_active;
gchar *name;
-
+
treepath = gtk_tree_path_new_from_string (path);
res = gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->sources_list),
&iter,
@@ -192,7 +192,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer,
if (!res)
{
gtk_tree_path_free (treepath);
-
+
return;
}
@@ -210,7 +210,7 @@ source_renderer_toggled_cb (GtkCellRendererToggle *renderer,
g_free (name);
}
-
+
gtk_tree_path_free (treepath);
}
@@ -228,14 +228,14 @@ sources_view_row_activated_cb (GtkTreeView *tree_view,
model = gtk_tree_view_get_model (tree_view);
if (!model)
return;
-
+
if (!gtk_tree_model_get_iter (model, &iter, tree_path))
return;
-
+
gtk_tree_model_get (model, &iter, SOURCES_NAME_COLUMN, &source_name, -1);
if (!source_name)
return;
-
+
edit_dialog = gdict_source_dialog_new (GTK_WINDOW (dialog),
_("Edit Dictionary Source"),
GDICT_SOURCE_DIALOG_EDIT,
@@ -254,10 +254,10 @@ build_sources_view (GdictPrefDialog *dialog)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
-
+
if (dialog->sources_list)
return;
-
+
dialog->sources_list = gtk_list_store_new (SOURCES_N_COLUMNS,
G_TYPE_BOOLEAN, /* active */
G_TYPE_STRING, /* name */
@@ -265,13 +265,13 @@ build_sources_view (GdictPrefDialog *dialog)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->sources_list),
SOURCES_DESCRIPTION_COLUMN,
GTK_SORT_ASCENDING);
-
+
renderer = gtk_cell_renderer_toggle_new ();
gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE (renderer), TRUE);
g_signal_connect (renderer, "toggled",
G_CALLBACK (source_renderer_toggled_cb),
dialog);
-
+
column = gtk_tree_view_column_new_with_attributes ("active",
renderer,
"active", SOURCES_ACTIVE_COLUMN,
@@ -284,7 +284,7 @@ build_sources_view (GdictPrefDialog *dialog)
"text", SOURCES_DESCRIPTION_COLUMN,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->sources_view), column);
-
+
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->sources_view), FALSE);
gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->sources_view),
GTK_TREE_MODEL (dialog->sources_list));
@@ -299,7 +299,7 @@ source_add_clicked_cb (GtkWidget *widget,
GdictPrefDialog *dialog)
{
GtkWidget *add_dialog;
-
+
add_dialog = gdict_source_dialog_new (GTK_WINDOW (dialog),
_("Add Dictionary Source"),
GDICT_SOURCE_DIALOG_CREATE,
@@ -322,26 +322,26 @@ source_remove_clicked_cb (GtkWidget *widget,
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,
SOURCES_DESCRIPTION_COLUMN, &description,
-1);
- if (!name)
+ if (!name)
return;
else
{
GtkWidget *confirm_dialog;
gint response;
-
+
confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@@ -350,53 +350,53 @@ source_remove_clicked_cb (GtkWidget *widget,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (confirm_dialog),
_("This will permanently remove the "
"dictionary source from the list."));
-
+
gtk_dialog_add_button (GTK_DIALOG (confirm_dialog),
"gtk-cancel",
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (confirm_dialog),
"gtk-remove",
GTK_RESPONSE_OK);
-
+
gtk_window_set_title (GTK_WINDOW (confirm_dialog), "");
-
+
response = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
if (response == GTK_RESPONSE_CANCEL)
{
gtk_widget_destroy (confirm_dialog);
-
+
goto out;
}
-
+
gtk_widget_destroy (confirm_dialog);
}
-
+
if (gdict_source_loader_remove_source (dialog->loader, name))
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
else
{
GtkWidget *error_dialog;
gchar *message;
-
+
message = g_strdup_printf (_("Unable to remove source '%s'"),
description);
-
+
error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
"%s", message);
gtk_window_set_title (GTK_WINDOW (error_dialog), "");
-
+
gtk_dialog_run (GTK_DIALOG (error_dialog));
-
+
gtk_widget_destroy (error_dialog);
}
out:
g_free (name);
g_free (description);
-
+
update_sources_view (dialog);
}
@@ -446,12 +446,12 @@ set_source_loader (GdictPrefDialog *dialog,
{
if (!dialog->sources_list)
return;
-
+
if (dialog->loader)
g_object_unref (dialog->loader);
-
+
dialog->loader = g_object_ref (loader);
-
+
update_sources_view (dialog);
}
@@ -460,7 +460,7 @@ font_button_font_set_cb (GtkWidget *font_button,
GdictPrefDialog *dialog)
{
gchar *font;
-
+
font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font_button));
if (!font || font[0] == '\0' || g_strcmp0 (dialog->print_font, font) == 0)
@@ -483,7 +483,7 @@ response_cb (GtkDialog *dialog,
gpointer user_data)
{
GError *err = NULL;
-
+
switch (response_id)
{
case GTK_RESPONSE_HELP:
@@ -504,13 +504,13 @@ response_cb (GtkDialog *dialog,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog),
"%s", err->message);
gtk_window_set_title (GTK_WINDOW (error_dialog), "");
-
+
gtk_dialog_run (GTK_DIALOG (error_dialog));
-
+
gtk_widget_destroy (error_dialog);
g_error_free (err);
}
-
+
/* we don't want the dialog to close itself */
g_signal_stop_emission_by_name (dialog, "response");
break;
@@ -525,19 +525,19 @@ static void
gdict_pref_dialog_finalize (GObject *object)
{
GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
-
+
if (dialog->settings)
g_object_unref (dialog->settings);
-
+
if (dialog->builder)
g_object_unref (dialog->builder);
if (dialog->active_source)
g_free (dialog->active_source);
-
+
if (dialog->loader)
g_object_unref (dialog->loader);
-
+
G_OBJECT_CLASS (gdict_pref_dialog_parent_class)->finalize (object);
}
@@ -548,7 +548,7 @@ gdict_pref_dialog_set_property (GObject *object,
GParamSpec *pspec)
{
GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
-
+
switch (prop_id)
{
case PROP_SOURCE_LOADER:
@@ -566,7 +566,7 @@ gdict_pref_dialog_get_property (GObject *object,
GParamSpec *pspec)
{
GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
-
+
switch (prop_id)
{
case PROP_SOURCE_LOADER:
@@ -581,11 +581,11 @@ static void
gdict_pref_dialog_class_init (GdictPrefDialogClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
+
gobject_class->set_property = gdict_pref_dialog_set_property;
gobject_class->get_property = gdict_pref_dialog_get_property;
gobject_class->finalize = gdict_pref_dialog_finalize;
-
+
g_object_class_install_property (gobject_class,
PROP_SOURCE_LOADER,
g_param_spec_object ("source-loader",
@@ -604,7 +604,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
gtk_window_set_default_size (GTK_WINDOW (dialog),
DEFAULT_MIN_WIDTH,
DEFAULT_MIN_HEIGHT);
-
+
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
@@ -632,9 +632,9 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_root")));
- /* keep all the interesting widgets around */
+ /* keep all the interesting widgets around */
dialog->notebook = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_notebook"));
-
+
dialog->sources_view = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "sources_treeview"));
build_sources_view (dialog);
@@ -645,7 +645,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
_("Add a new dictionary source"));
g_signal_connect (dialog->sources_add, "clicked",
G_CALLBACK (source_add_clicked_cb), dialog);
-
+
dialog->sources_remove = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "remove_button"));
gtk_widget_set_tooltip_text (dialog->sources_remove,
_("Remove the currently selected dictionary source"));
@@ -666,7 +666,7 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
g_signal_connect (dialog->font_button, "font-set",
G_CALLBACK (font_button_font_set_cb), dialog);
g_free (font);
-
+
gtk_widget_show_all (dialog->notebook);
/* we want to intercept the response signal before any other
@@ -684,28 +684,28 @@ gdict_show_pref_dialog (GtkWidget *parent,
GdictSourceLoader *loader)
{
GtkWidget *dialog;
-
+
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (GDICT_IS_SOURCE_LOADER (loader));
-
+
if (parent != NULL)
dialog = g_object_get_data (G_OBJECT (parent), "gdict-pref-dialog");
else
dialog = global_dialog;
-
+
if (dialog == NULL)
{
dialog = g_object_new (GDICT_TYPE_PREF_DIALOG,
"source-loader", loader,
"title", title,
NULL);
-
+
g_object_ref_sink (dialog);
-
+
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete),
NULL);
-
+
if (parent != NULL && GTK_IS_WINDOW (parent))
{
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
diff --git a/mate-dictionary/src/gdict-print.c b/mate-dictionary/src/gdict-print.c
index 9e18bd6d..559f98b7 100644
--- a/mate-dictionary/src/gdict-print.c
+++ b/mate-dictionary/src/gdict-print.c
@@ -49,7 +49,7 @@ typedef struct _GdictPrintData
gdouble font_size;
gchar **lines;
-
+
gint n_lines;
gint lines_per_page;
gint n_pages;
@@ -100,10 +100,10 @@ draw_page (GtkPrintOperation *operation,
width = gtk_print_context_get_width (context);
cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT (10));
-
+
cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
cairo_fill_preserve (cr);
-
+
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
@@ -138,7 +138,7 @@ draw_page (GtkPrintOperation *operation,
cairo_move_to (cr, width - text_width - 4,
(HEADER_HEIGHT (10) - text_height) / 2);
pango_cairo_show_layout (cr, layout);
-
+
g_object_unref (layout);
/* text */
@@ -146,10 +146,10 @@ draw_page (GtkPrintOperation *operation,
pango_font_description_set_size (data->font_desc,
data->font_size * PANGO_SCALE);
pango_layout_set_font_description (layout, data->font_desc);
-
+
cairo_move_to (cr, 0, HEADER_HEIGHT (10) + HEADER_GAP (3));
line = page_number * data->lines_per_page;
- for (i = 0; i < data->lines_per_page && line < data->n_lines; i++)
+ for (i = 0; i < data->lines_per_page && line < data->n_lines; i++)
{
pango_layout_set_text (layout, data->lines[line], -1);
@@ -194,7 +194,7 @@ gdict_show_print_preview (GtkWindow *parent,
gchar *print_font;
gchar *word;
GError *error;
-
+
g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
g_return_if_fail (GDICT_IS_DEFBOX (defbox));
@@ -216,11 +216,11 @@ gdict_show_print_preview (GtkWindow *parent,
/ PANGO_SCALE;
g_free (print_font);
- g_signal_connect (operation, "begin-print",
+ g_signal_connect (operation, "begin-print",
G_CALLBACK (begin_print), data);
- g_signal_connect (operation, "draw-page",
+ g_signal_connect (operation, "draw-page",
G_CALLBACK (draw_page), data);
- g_signal_connect (operation, "end-print",
+ g_signal_connect (operation, "end-print",
G_CALLBACK (end_print), data);
error = NULL;
@@ -258,7 +258,7 @@ gdict_show_print_dialog (GtkWindow *parent,
gchar *print_font;
gchar *word;
GError *error;
-
+
g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
g_return_if_fail (GDICT_IS_DEFBOX (defbox));
@@ -280,11 +280,11 @@ gdict_show_print_dialog (GtkWindow *parent,
/ PANGO_SCALE;
g_free (print_font);
- g_signal_connect (operation, "begin-print",
+ g_signal_connect (operation, "begin-print",
G_CALLBACK (begin_print), data);
- g_signal_connect (operation, "draw-page",
+ g_signal_connect (operation, "draw-page",
G_CALLBACK (draw_page), data);
- g_signal_connect (operation, "end-print",
+ g_signal_connect (operation, "end-print",
G_CALLBACK (end_print), data);
error = NULL;
diff --git a/mate-dictionary/src/gdict-source-dialog.c b/mate-dictionary/src/gdict-source-dialog.c
index 3fc17de5..d5dd54d3 100644
--- a/mate-dictionary/src/gdict-source-dialog.c
+++ b/mate-dictionary/src/gdict-source-dialog.c
@@ -49,7 +49,7 @@ struct _GdictSourceDialog
{
GtkDialog parent_instance;
- GtkBuilder *builder;
+ GtkBuilder *builder;
GSettings *settings;
@@ -57,9 +57,9 @@ struct _GdictSourceDialog
GdictSource *source;
gchar *source_name;
GdictContext *context;
-
+
GdictSourceDialogAction action;
-
+
GdictSourceTransport transport;
GtkWidget *add_button;
@@ -69,7 +69,7 @@ struct _GdictSourceDialog
GtkWidget *db_chooser;
GtkWidget *strat_chooser;
-
+
GtkWidget *transport_combo;
};
@@ -81,7 +81,7 @@ struct _GdictSourceDialogClass
enum
{
PROP_0,
-
+
PROP_SOURCE_LOADER,
PROP_SOURCE_NAME,
PROP_ACTION
@@ -95,7 +95,7 @@ set_source_loader (GdictSourceDialog *dialog,
{
if (dialog->loader)
g_object_unref (dialog->loader);
-
+
dialog->loader = g_object_ref (loader);
}
@@ -116,11 +116,11 @@ transport_combo_changed_cb (GtkWidget *widget,
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_entry")));
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_label")));
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_entry")));
-
+
if (dialog->action == GDICT_SOURCE_DIALOG_CREATE)
{
gtk_widget_set_sensitive (dialog->add_button, TRUE);
-
+
dialog->transport = GDICT_SOURCE_TRANSPORT_DICTD;
}
}
@@ -134,7 +134,7 @@ transport_combo_changed_cb (GtkWidget *widget,
if (dialog->action == GDICT_SOURCE_DIALOG_CREATE)
{
gtk_widget_set_sensitive (dialog->add_button, FALSE);
-
+
dialog->transport = GDICT_SOURCE_TRANSPORT_INVALID;
}
}
@@ -150,9 +150,9 @@ get_text_from_entry (GdictSourceDialog *dialog,
entry = GTK_WIDGET (gtk_builder_get_object (dialog->builder, entry_name));
if (!entry)
return NULL;
-
+
retval = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
-
+
return retval;
}
@@ -208,7 +208,7 @@ static void
update_dialog_ui (GdictSourceDialog *dialog)
{
GdictSource *source;
-
+
/* TODO - add code to update the contents of the dialog depending
* on the action; if we are in _CREATE, no action is needed
*/
@@ -222,7 +222,7 @@ update_dialog_ui (GdictSourceDialog *dialog)
"source name has been defined. Aborting...");
return;
}
-
+
source = gdict_source_loader_get_source (dialog->loader,
dialog->source_name);
if (!source)
@@ -232,9 +232,9 @@ update_dialog_ui (GdictSourceDialog *dialog)
dialog->source_name);
return;
}
-
+
g_object_ref (source);
-
+
dialog->source = source;
set_text_to_entry (dialog, "description_entry",
gdict_source_get_description (source));
@@ -252,7 +252,7 @@ update_dialog_ui (GdictSourceDialog *dialog)
dialog->source_name);
return;
}
-
+
set_transport_settings (dialog);
gdict_database_chooser_set_context (GDICT_DATABASE_CHOOSER (dialog->db_chooser),
@@ -286,16 +286,16 @@ build_new_source (GdictSourceDialog *dialog)
gchar *filename;
GdictDatabaseChooser *db_chooser;
GdictStrategyChooser *strat_chooser;
-
+
source = gdict_source_new ();
-
+
/* use the timestamp and the pid to get a unique name */
name = g_strdup_printf ("source-%lu-%u",
(gulong) time (NULL),
(guint) getpid ());
gdict_source_set_name (source, name);
g_free (name);
-
+
text = get_text_from_entry (dialog, "description_entry");
gdict_source_set_description (source, text);
g_free (text);
@@ -317,12 +317,12 @@ build_new_source (GdictSourceDialog *dialog)
case GDICT_SOURCE_TRANSPORT_DICTD:
host = get_text_from_entry (dialog, "hostname_entry");
port = get_text_from_entry (dialog, "port_entry");
-
+
gdict_source_set_transport (source, GDICT_SOURCE_TRANSPORT_DICTD,
"hostname", host,
"port", atoi (port),
NULL);
-
+
g_free (host);
g_free (port);
break;
@@ -331,7 +331,7 @@ build_new_source (GdictSourceDialog *dialog)
g_warning ("Invalid transport");
return;
}
-
+
error = NULL;
data = gdict_source_to_data (source, &length, &error);
if (error)
@@ -339,11 +339,11 @@ build_new_source (GdictSourceDialog *dialog)
gdict_show_gerror_dialog (GTK_WINDOW (dialog),
_("Unable to create a source file"),
error);
-
+
g_object_unref (source);
return;
}
-
+
name = g_strdup_printf ("%s.desktop", gdict_source_get_name (source));
filename = g_build_filename (g_get_user_config_dir (),
"mate",
@@ -351,7 +351,7 @@ build_new_source (GdictSourceDialog *dialog)
name,
NULL);
g_free (name);
-
+
g_file_set_contents (filename, data, length, &error);
if (error)
gdict_show_gerror_dialog (GTK_WINDOW (dialog),
@@ -376,7 +376,7 @@ save_source (GdictSourceDialog *dialog)
gsize length;
GError *error;
gchar *filename;
-
+
source = gdict_source_loader_get_source (dialog->loader,
dialog->source_name);
if (!source)
@@ -387,7 +387,7 @@ save_source (GdictSourceDialog *dialog)
return;
}
-
+
text = get_text_from_entry (dialog, "description_entry");
gdict_source_set_description (source, text);
g_free (text);
@@ -410,12 +410,12 @@ save_source (GdictSourceDialog *dialog)
case GDICT_SOURCE_TRANSPORT_DICTD:
host = get_text_from_entry (dialog, "hostname_entry");
port = get_text_from_entry (dialog, "port_entry");
-
+
gdict_source_set_transport (source, GDICT_SOURCE_TRANSPORT_DICTD,
"hostname", host,
"port", atoi (port),
NULL);
-
+
g_free (host);
g_free (port);
break;
@@ -424,7 +424,7 @@ save_source (GdictSourceDialog *dialog)
g_warning ("Invalid transport");
return;
}
-
+
error = NULL;
data = gdict_source_to_data (source, &length, &error);
if (error)
@@ -432,11 +432,11 @@ save_source (GdictSourceDialog *dialog)
gdict_show_gerror_dialog (GTK_WINDOW (dialog),
_("Unable to create a source file"),
error);
-
+
g_object_unref (source);
return;
}
-
+
name = g_strdup_printf ("%s.desktop", gdict_source_get_name (source));
filename = g_build_filename (g_get_user_config_dir (),
"mate",
@@ -444,7 +444,7 @@ save_source (GdictSourceDialog *dialog)
name,
NULL);
g_free (name);
-
+
g_file_set_contents (filename, data, length, &error);
if (error)
gdict_show_gerror_dialog (GTK_WINDOW (dialog),
@@ -462,7 +462,7 @@ gdict_source_dialog_response_cb (GtkDialog *dialog,
gpointer user_data)
{
GError *err = NULL;
-
+
switch (response_id)
{
case GTK_RESPONSE_ACCEPT:
@@ -499,7 +499,7 @@ gdict_source_dialog_finalize (GObject *object)
if (dialog->settings)
g_object_unref (dialog->settings);
-
+
if (dialog->builder)
g_object_unref (dialog->builder);
@@ -508,10 +508,10 @@ gdict_source_dialog_finalize (GObject *object)
if (dialog->source)
g_object_unref (dialog->source);
-
+
if (dialog->loader)
g_object_unref (dialog->loader);
-
+
G_OBJECT_CLASS (gdict_source_dialog_parent_class)->finalize (object);
}
@@ -522,7 +522,7 @@ gdict_source_dialog_set_property (GObject *object,
GParamSpec *pspec)
{
GdictSourceDialog *dialog = GDICT_SOURCE_DIALOG (object);
-
+
switch (prop_id)
{
case PROP_SOURCE_LOADER:
@@ -547,7 +547,7 @@ gdict_source_dialog_get_property (GObject *object,
GParamSpec *pspec)
{
GdictSourceDialog *dialog = GDICT_SOURCE_DIALOG (object);
-
+
switch (prop_id)
{
case PROP_SOURCE_LOADER:
@@ -592,7 +592,7 @@ gdict_source_dialog_constructor (GType type,
g_error_free (error);
g_assert_not_reached ();
}
-
+
/* the main widget */
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
GTK_WIDGET (gtk_builder_get_object (dialog->builder, "source_root")));
@@ -609,7 +609,7 @@ gdict_source_dialog_constructor (GType type,
dialog->help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
"gtk-help",
GTK_RESPONSE_HELP);
-
+
vbox = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "db-vbox"));
dialog->db_chooser = gdict_database_chooser_new ();
gtk_box_pack_start (GTK_BOX (vbox), dialog->db_chooser, TRUE, TRUE, 0);
@@ -631,7 +631,7 @@ gdict_source_dialog_constructor (GType type,
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);
-
+
gtk_widget_set_sensitive (dialog->transport_combo, FALSE);
/* we just allow closing the dialog */
@@ -663,7 +663,7 @@ gdict_source_dialog_constructor (GType type,
g_assert_not_reached ();
break;
}
-
+
/* this will take care of updating the contents of the dialog
* based on the action
*/
@@ -676,12 +676,12 @@ static void
gdict_source_dialog_class_init (GdictSourceDialogClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
+
gobject_class->constructor = gdict_source_dialog_constructor;
gobject_class->set_property = gdict_source_dialog_set_property;
gobject_class->get_property = gdict_source_dialog_get_property;
gobject_class->finalize = gdict_source_dialog_finalize;
-
+
g_object_class_install_property (gobject_class,
PROP_SOURCE_LOADER,
g_param_spec_object ("source-loader",
@@ -728,10 +728,10 @@ gdict_source_dialog_new (GtkWindow *parent,
const gchar *source_name)
{
GtkWidget *retval;
-
+
g_return_val_if_fail ((parent == NULL || GTK_IS_WINDOW (parent)), NULL);
g_return_val_if_fail (GDICT_IS_SOURCE_LOADER (loader), NULL);
-
+
retval = g_object_new (GDICT_TYPE_SOURCE_DIALOG,
"source-loader", loader,
"source-name", source_name,
@@ -746,6 +746,6 @@ gdict_source_dialog_new (GtkWindow *parent,
gtk_window_set_screen (GTK_WINDOW (retval),
gtk_widget_get_screen (GTK_WIDGET (parent)));
}
-
+
return retval;
}
diff --git a/mate-dictionary/src/gdict-window.c b/mate-dictionary/src/gdict-window.c
index 7921537c..2f4b9d9c 100644
--- a/mate-dictionary/src/gdict-window.c
+++ b/mate-dictionary/src/gdict-window.c
@@ -83,7 +83,7 @@ enum
enum
{
CREATED,
-
+
LAST_SIGNAL
};
@@ -115,7 +115,7 @@ gdict_window_finalize (GObject *gobject)
g_free (window->word);
g_free (window->database);
g_free (window->strategy);
-
+
G_OBJECT_CLASS (gdict_window_parent_class)->finalize (gobject);
}
@@ -136,7 +136,7 @@ gdict_window_dispose (GObject *gobject)
window->settings = NULL;
}
-
+
if (window->context)
{
if (window->lookup_start_id)
@@ -155,19 +155,19 @@ gdict_window_dispose (GObject *gobject)
g_object_unref (window->context);
window->context = NULL;
}
-
+
if (window->loader)
{
g_object_unref (window->loader);
window->loader = NULL;
}
-
+
if (window->ui_manager)
{
g_object_unref (window->ui_manager);
window->ui_manager = NULL;
}
-
+
if (window->action_group)
{
g_object_unref (window->action_group);
@@ -315,7 +315,7 @@ gdict_window_lookup_start_cb (GdictContext *context,
window->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
message = g_strdup_printf (_("Searching for '%s'..."), window->word);
-
+
if (window->status && window->statusbar_visible)
gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);
@@ -340,14 +340,14 @@ gdict_window_lookup_end_cb (GdictContext *context,
GtkTreeIter iter;
GdictSource *source;
GdictContext *speller_context;
-
+
count = window->current_definition;
window->max_definition = count - 1;
if (count == 0)
message = g_strdup (_("No definitions found"));
- else
+ else
message = g_strdup_printf (ngettext("A definition found",
"%d definitions found",
count),
@@ -400,7 +400,7 @@ gdict_window_error_cb (GdictContext *context,
GdictWindow *window)
{
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
-
+
if (window->status && window->statusbar_visible)
gtk_statusbar_push (GTK_STATUSBAR (window->status), 0,
_("No definitions found"));
@@ -429,10 +429,10 @@ gdict_window_error_cb (GdictContext *context,
context);
g_object_unref (context);
g_object_unref (source);
-
+
gdict_speller_set_strategy (GDICT_SPELLER (window->speller),
window->strategy);
-
+
gdict_speller_match (GDICT_SPELLER (window->speller),
window->word);
}
@@ -514,46 +514,46 @@ get_context_from_loader (GdictWindow *window)
source = gdict_source_loader_get_source (window->loader,
window->source_name);
}
-
+
if (!source)
{
gchar *detail;
-
+
detail = g_strdup_printf (_("No dictionary source available with name '%s'"),
window->source_name);
gdict_show_error_dialog (GTK_WINDOW (window),
_("Unable to find dictionary source"),
detail);
-
+
g_free (detail);
return NULL;
}
-
+
gdict_window_set_database (window, gdict_source_get_database (source));
gdict_window_set_strategy (window, gdict_source_get_strategy (source));
-
+
retval = gdict_source_get_context (source);
if (!retval)
{
gchar *detail;
-
+
detail = g_strdup_printf (_("No context available for source '%s'"),
gdict_source_get_description (source));
-
+
gdict_show_error_dialog (GTK_WINDOW (window),
_("Unable to create a context"),
detail);
-
+
g_free (detail);
g_object_unref (source);
-
+
return NULL;
}
-
+
g_object_unref (source);
-
+
return retval;
}
@@ -589,7 +589,7 @@ gdict_window_set_word (GdictWindow *window,
const gchar *database)
{
gchar *title;
-
+
g_free (window->word);
window->word = NULL;
@@ -605,7 +605,7 @@ gdict_window_set_word (GdictWindow *window,
title = g_strdup_printf (_("%s - Dictionary"), window->word);
else
title = g_strdup (_("Dictionary"));
-
+
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
@@ -626,12 +626,12 @@ gdict_window_set_context (GdictWindow *window,
g_signal_handler_disconnect (window->context, window->lookup_start_id);
g_signal_handler_disconnect (window->context, window->lookup_end_id);
g_signal_handler_disconnect (window->context, window->error_id);
-
+
window->definition_id = 0;
window->lookup_start_id = 0;
window->lookup_end_id = 0;
window->error_id = 0;
-
+
g_object_unref (window->context);
window->context = NULL;
}
@@ -647,7 +647,7 @@ gdict_window_set_context (GdictWindow *window,
if (!context)
return;
-
+
/* attach our callbacks */
window->definition_id = g_signal_connect (context, "definition-found",
G_CALLBACK (gdict_window_definition_cb),
@@ -661,7 +661,7 @@ gdict_window_set_context (GdictWindow *window,
window->error_id = g_signal_connect (context, "error",
G_CALLBACK (gdict_window_error_cb),
window);
-
+
window->context = context;
}
@@ -699,7 +699,7 @@ gdict_window_set_property (GObject *object,
GParamSpec *pspec)
{
GdictWindow *window = GDICT_WINDOW (object);
-
+
switch (prop_id)
{
case PROP_ACTION:
@@ -742,7 +742,7 @@ gdict_window_get_property (GObject *object,
GParamSpec *pspec)
{
GdictWindow *window = GDICT_WINDOW (object);
-
+
switch (prop_id)
{
case PROP_ACTION:
@@ -947,7 +947,7 @@ gdict_window_cmd_file_new (GtkAction *action,
NULL, NULL);
gtk_widget_show (new_window);
-
+
g_signal_emit (window, gdict_window_signals[CREATED], 0, new_window);
}
@@ -956,9 +956,9 @@ gdict_window_cmd_save_as (GtkAction *action,
GdictWindow *window)
{
GtkWidget *dialog;
-
+
g_assert (GDICT_IS_WINDOW (window));
-
+
dialog = gtk_file_chooser_dialog_new (_("Save a Copy"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -966,22 +966,22 @@ gdict_window_cmd_save_as (GtkAction *action,
"gtk-save", GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
-
+
/* default to user's home */
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_home_dir ());
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), _("Untitled document"));
-
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
gchar *filename;
gchar *text;
gsize len;
GError *write_error = NULL;
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
+
text = gdict_defbox_get_text (GDICT_DEFBOX (window->defbox), &len);
-
+
g_file_set_contents (filename,
text,
len,
@@ -989,16 +989,16 @@ gdict_window_cmd_save_as (GtkAction *action,
if (write_error)
{
gchar *message;
-
+
message = g_strdup_printf (_("Error while writing to '%s'"), filename);
-
+
gdict_show_gerror_dialog (GTK_WINDOW (window),
message,
write_error);
g_free (message);
}
-
+
g_free (text);
g_free (filename);
}
@@ -1021,7 +1021,7 @@ gdict_window_cmd_file_print (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
gdict_show_print_dialog (GTK_WINDOW (window),
GDICT_DEFBOX (window->defbox));
}
@@ -1072,7 +1072,7 @@ gdict_window_cmd_edit_find (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
gdict_defbox_set_show_find (GDICT_DEFBOX (window->defbox), TRUE);
}
@@ -1099,7 +1099,7 @@ gdict_window_cmd_edit_preferences (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
gdict_show_pref_dialog (GTK_WIDGET (window),
_("Dictionary Preferences"),
window->loader);
@@ -1183,7 +1183,7 @@ gdict_window_cmd_go_first_def (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
window->last_definition = 0;
gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox),
window->last_definition);
@@ -1194,10 +1194,10 @@ gdict_window_cmd_go_previous_def (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
if (window->last_definition == 0)
return;
-
+
window->last_definition -= 1;
gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox),
window->last_definition);
@@ -1208,13 +1208,13 @@ gdict_window_cmd_go_next_def (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
if (window->max_definition == -1)
window->max_definition = gdict_defbox_count_definitions (GDICT_DEFBOX (window->defbox)) - 1;
-
+
if (window->last_definition == window->max_definition)
return;
-
+
window->last_definition += 1;
gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox),
window->last_definition);
@@ -1225,10 +1225,10 @@ gdict_window_cmd_go_last_def (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
if (window->max_definition == -1)
window->last_definition = gdict_defbox_count_definitions (GDICT_DEFBOX (window->defbox)) - 1;
-
+
window->last_definition = window->max_definition;
gdict_defbox_jump_to_definition (GDICT_DEFBOX (window->defbox),
window->last_definition);
@@ -1239,12 +1239,12 @@ gdict_window_cmd_help_contents (GtkAction *action,
GdictWindow *window)
{
GError *err = NULL;
-
+
g_return_if_fail (GDICT_IS_WINDOW (window));
gtk_show_uri_on_window (GTK_WINDOW (window),
"help:mate-dictionary",
- gtk_get_current_event_time (), &err);
+ gtk_get_current_event_time (), &err);
if (err)
{
gdict_show_gerror_dialog (GTK_WINDOW (window),
@@ -1258,7 +1258,7 @@ gdict_window_cmd_help_about (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
gdict_show_about_dialog (GTK_WIDGET (window));
}
@@ -1276,7 +1276,7 @@ gdict_window_cmd_escape (GtkAction *action,
GdictWindow *window)
{
g_assert (GDICT_IS_WINDOW (window));
-
+
gdict_defbox_set_show_find (GDICT_DEFBOX (window->defbox), FALSE);
}
@@ -1340,7 +1340,7 @@ static const GtkActionEntry entries[] =
G_CALLBACK (gdict_window_cmd_help_contents) },
{ "HelpAbout", "help-about", N_("_About"), NULL, NULL,
G_CALLBACK (gdict_window_cmd_help_about) },
-
+
/* Accelerators */
{ "Lookup", NULL, "", "<control>L", NULL, G_CALLBACK (gdict_window_cmd_lookup) },
{ "Escape", NULL, "", "Escape", "", G_CALLBACK (gdict_window_cmd_escape) },
@@ -1371,12 +1371,12 @@ gdict_window_state_event_cb (GtkWidget *widget,
gpointer user_data)
{
GdictWindow *window = GDICT_WINDOW (widget);
-
+
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
window->is_maximized = TRUE;
else
window->is_maximized = FALSE;
-
+
return FALSE;
}
@@ -1386,12 +1386,12 @@ lookup_word (GdictWindow *window,
{
const gchar *entry_text;
gchar *word;
-
+
g_assert (GDICT_IS_WINDOW (window));
-
+
if (!window->context)
return;
-
+
entry_text = gtk_entry_get_text (GTK_ENTRY (window->entry));
if (!entry_text || *entry_text == '\0')
return;
@@ -1470,7 +1470,7 @@ speller_word_activated_cb (GdictSpeller *speller,
GdictWindow *window)
{
gtk_entry_set_text (GTK_ENTRY (window->entry), word);
-
+
gdict_window_set_word (window, word, db_name);
if (window->status && window->statusbar_visible)
@@ -1509,7 +1509,7 @@ sidebar_page_changed_cb (GdictSidebar *sidebar,
break;
case 't': /* strat-chooser */
message = _("Double-click on the matching strategy to use");
-
+
gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER (window->strat_chooser));
break;
case 'o': /* source-chooser */
@@ -1523,7 +1523,7 @@ sidebar_page_changed_cb (GdictSidebar *sidebar,
break;
case 'd': /* db-chooser */
message = _("Double-click on the database to use");
-
+
gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER (window->db_chooser));
break;
default:
@@ -1539,7 +1539,7 @@ static void
sidebar_closed_cb (GdictSidebar *sidebar,
GdictWindow *window)
{
- gdict_window_set_sidebar_visible (window, FALSE);
+ gdict_window_set_sidebar_visible (window, FALSE);
}
static void
@@ -1555,7 +1555,7 @@ gdict_window_link_clicked (GdictDefbox *defbox,
window->loader,
NULL, link_text);
gtk_widget_show (new_window);
-
+
g_signal_emit (window, gdict_window_signals[CREATED], 0, new_window);
}
@@ -1571,7 +1571,7 @@ gdict_window_drag_data_received_cb (GtkWidget *widget,
{
GdictWindow *window = GDICT_WINDOW (user_data);
gchar *text;
-
+
text = (gchar *) gtk_selection_data_get_text (data);
if (text)
{
@@ -1579,7 +1579,7 @@ gdict_window_drag_data_received_cb (GtkWidget *widget,
gdict_window_set_word (window, text, NULL);
g_free (text);
-
+
gtk_drag_finish (context, TRUE, FALSE, time_);
}
else
@@ -1649,7 +1649,7 @@ gdict_window_constructor (GType type,
window->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), window->main_box);
gtk_widget_show (window->main_box);
-
+
/* build menus */
action_group = gtk_action_group_new ("MenuActions");
window->action_group = action_group;
@@ -1660,13 +1660,13 @@ gdict_window_constructor (GType type,
gtk_action_group_add_toggle_actions (action_group, toggle_entries,
G_N_ELEMENTS (toggle_entries),
window);
-
+
window->ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (window->ui_manager, action_group, 0);
-
+
accel_group = gtk_ui_manager_get_accel_group (window->ui_manager);
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
+
error = NULL;
if (!gtk_ui_manager_add_ui_from_file (window->ui_manager,
PKGDATADIR "/mate-dictionary-ui.xml",
@@ -1678,22 +1678,22 @@ gdict_window_constructor (GType type,
else
{
window->menubar = gtk_ui_manager_get_widget (window->ui_manager, "/MainMenu");
-
+
gtk_box_pack_start (GTK_BOX (window->main_box), window->menubar, FALSE, FALSE, 0);
gtk_widget_show (window->menubar);
gdict_window_ensure_menu_state (window);
}
-
+
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (window->main_box), vbox);
gtk_widget_show (vbox);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
-
+
button = gtk_button_new_with_mnemonic (_("Look _up:"));
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (lookup_word),
@@ -1704,18 +1704,18 @@ gdict_window_constructor (GType type,
window->completion_model = gtk_list_store_new (COMPLETION_N_COLUMNS,
G_TYPE_STRING);
-
+
window->completion = gtk_entry_completion_new ();
gtk_entry_completion_set_popup_completion (window->completion, TRUE);
gtk_entry_completion_set_model (window->completion,
GTK_TREE_MODEL (window->completion_model));
gtk_entry_completion_set_text_column (window->completion,
COMPLETION_TEXT_COLUMN);
-
+
window->entry = gtk_entry_new ();
if (window->word)
gtk_entry_set_text (GTK_ENTRY (window->entry), window->word);
-
+
gtk_entry_set_completion (GTK_ENTRY (window->entry),
window->completion);
g_signal_connect_swapped (window->entry, "activate",
@@ -1730,7 +1730,7 @@ gdict_window_constructor (GType type,
frame1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
frame2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
+
window->defbox = gdict_defbox_new ();
if (window->context)
gdict_defbox_set_context (GDICT_DEFBOX (window->defbox), window->context);
@@ -1758,7 +1758,7 @@ gdict_window_constructor (GType type,
G_CALLBACK (sidebar_closed_cb),
window);
gtk_widget_show (window->sidebar);
-
+
/* Speller */
window->speller = gdict_speller_new ();
if (window->context)
@@ -1875,7 +1875,7 @@ gdict_window_constructor (GType type,
{
gint font_size;
gint width, height;
-
+
font_size = pango_font_description_get_size (font_desc);
font_size = PANGO_PIXELS (font_size);
@@ -1887,7 +1887,7 @@ gdict_window_constructor (GType type,
}
pango_font_description_free (font_desc);
-
+
gtk_window_set_title (GTK_WINDOW (window), _("Dictionary"));
gtk_window_set_default_size (GTK_WINDOW (window),
window->default_width,
@@ -2021,7 +2021,7 @@ static void
gdict_window_init (GdictWindow *window)
{
window->action = GDICT_WINDOW_ACTION_CLEAR;
-
+
window->loader = NULL;
window->context = NULL;
@@ -2042,7 +2042,7 @@ gdict_window_init (GdictWindow *window)
window->sidebar_visible = FALSE;
window->statusbar_visible = FALSE;
window->sidebar_page = NULL;
-
+
window->window_id = (gulong) time (NULL);
/* we need to create the chooser widgets for the sidebar before
@@ -2060,9 +2060,9 @@ gdict_window_new (GdictWindowAction action,
{
GtkWidget *retval;
GdictWindow *window;
-
+
g_return_val_if_fail (GDICT_IS_SOURCE_LOADER (loader), NULL);
-
+
retval = g_object_new (GDICT_TYPE_WINDOW,
"action", action,
"source-loader", loader,
@@ -2086,7 +2086,7 @@ gdict_window_new (GdictWindowAction action,
GdictContext *context;
gtk_entry_set_text (GTK_ENTRY (window->entry), word);
-
+
gdict_window_set_sidebar_visible (window, TRUE);
gdict_sidebar_view_page (GDICT_SIDEBAR (window->sidebar),
GDICT_SIDEBAR_SPELLER_PAGE);
@@ -2100,13 +2100,13 @@ gdict_window_new (GdictWindowAction action,
context = gdict_source_get_context (source);
gdict_speller_set_context (GDICT_SPELLER (window->speller), context);
-
+
g_object_unref (context);
g_object_unref (source);
-
+
gdict_speller_set_strategy (GDICT_SPELLER (window->speller),
window->strategy);
-
+
gdict_speller_match (GDICT_SPELLER (window->speller), word);
}
break;
diff --git a/mate-dictionary/src/gdict-window.h b/mate-dictionary/src/gdict-window.h
index f2353e92..02a2ee7a 100644
--- a/mate-dictionary/src/gdict-window.h
+++ b/mate-dictionary/src/gdict-window.h
@@ -49,11 +49,11 @@ typedef struct _GdictWindowClass GdictWindowClass;
struct _GdictWindow
{
GtkWindow parent_instance;
-
+
GtkWidget *main_box;
GtkWidget *menubar;
GtkWidget *entry;
-
+
/* sidebar widgets */
GtkWidget *speller;
GtkWidget *db_chooser;
@@ -62,26 +62,26 @@ struct _GdictWindow
GtkWidget *sidebar;
GtkWidget *sidebar_frame;
-
+
GtkWidget *defbox;
GtkWidget *defbox_frame;
GtkWidget *status;
GtkWidget *progress;
-
+
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
-
+
GtkEntryCompletion *completion;
GtkListStore *completion_model;
-
+
GdictWindowAction action;
-
+
gchar *word;
gint max_definition;
gint last_definition;
gint current_definition;
-
+
gchar *source_name;
GdictSourceLoader *loader;
GdictContext *context;
@@ -89,7 +89,7 @@ struct _GdictWindow
guint lookup_start_id;
guint lookup_end_id;
guint error_id;
-
+
gchar *database;
gchar *strategy;
gchar *print_font;
@@ -112,14 +112,14 @@ struct _GdictWindow
guint sidebar_visible : 1;
guint statusbar_visible : 1;
guint in_construction : 1;
-
+
gulong window_id;
};
struct _GdictWindowClass
{
GtkWindowClass parent_class;
-
+
void (*created) (GdictWindow *parent_window,
GdictWindow *new_window);
};