[Goodies-commits] r4496 - in xfce4-dict/trunk: lib panel-plugin src
Enrico Troeger
enrico at xfce.org
Mon Mar 31 20:32:57 CEST 2008
Author: enrico
Date: 2008-03-31 18:32:56 +0000 (Mon, 31 Mar 2008)
New Revision: 4496
Modified:
xfce4-dict/trunk/lib/aspell.c
xfce4-dict/trunk/lib/aspell.h
xfce4-dict/trunk/lib/common.c
xfce4-dict/trunk/lib/dictd.c
xfce4-dict/trunk/lib/dictd.h
xfce4-dict/trunk/lib/gui.c
xfce4-dict/trunk/lib/gui.h
xfce4-dict/trunk/lib/prefs.c
xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
xfce4-dict/trunk/src/xfce4-dict.c
Log:
Prefix some more functions.
Modified: xfce4-dict/trunk/lib/aspell.c
===================================================================
--- xfce4-dict/trunk/lib/aspell.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/aspell.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -68,7 +68,7 @@
if (msg[0] == '&')
{ /* & cmd 17 7: ... */
tmp = strchr(msg + 2, ' ') + 1;
- dict_status_add(dd, _("%d suggestion(s) found."), atoi(tmp));
+ dict_gui_status_add(dd, _("%d suggestion(s) found."), atoi(tmp));
tmp = g_strdup_printf(_("Suggestions for \"%s\":\n"), dd->searched_word);
gtk_text_buffer_insert_with_tags(dd->main_textbuffer, &iter, tmp, -1,
@@ -110,7 +110,7 @@
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg != NULL)
{
- dict_status_add(dd, _("%s"), g_strstrip(msg));
+ dict_gui_status_add(dd, _("%s"), g_strstrip(msg));
g_free(msg);
}
}
@@ -132,7 +132,7 @@
}
-void dict_start_aspell_query(DictData *dd, const gchar *word)
+void dict_aspell_start_query(DictData *dd, const gchar *word)
{
GError *error = NULL;
gchar **argv;
@@ -144,13 +144,13 @@
if (! NZV(dd->spell_bin))
{
- dict_status_add(dd, _("Please set an appropriate aspell command."));
+ dict_gui_status_add(dd, _("Please set an appropriate aspell command."));
return;
}
if (! NZV(word))
{
- dict_status_add(dd, _("Invalid input."));
+ dict_gui_status_add(dd, _("Invalid input."));
return;
}
@@ -184,11 +184,11 @@
set_up_io_channel(stdin_fd, G_IO_OUT, iofunc_write, tts);
set_up_io_channel(stdout_fd, G_IO_IN|G_IO_PRI|G_IO_HUP|G_IO_ERR|G_IO_NVAL, iofunc_read, dd);
set_up_io_channel(stderr_fd, G_IO_IN|G_IO_PRI|G_IO_HUP|G_IO_ERR|G_IO_NVAL, iofunc_read_err, dd);
- dict_status_add(dd, _("Ready."));
+ dict_gui_status_add(dd, _("Ready."));
}
else
{
- dict_status_add(dd, _("Process failed (%s)"), error->message);
+ dict_gui_status_add(dd, _("Process failed (%s)"), error->message);
g_error_free(error);
error = NULL;
}
Modified: xfce4-dict/trunk/lib/aspell.h
===================================================================
--- xfce4-dict/trunk/lib/aspell.h 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/aspell.h 2008-03-31 18:32:56 UTC (rev 4496)
@@ -21,7 +21,7 @@
#ifndef ASPELL_H
#define ASPELL_H 1
-void dict_start_aspell_query(DictData *dd, const gchar *word);
+void dict_aspell_start_query(DictData *dd, const gchar *word);
#endif
Modified: xfce4-dict/trunk/lib/common.c
===================================================================
--- xfce4-dict/trunk/lib/common.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/common.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -215,11 +215,10 @@
void dict_search_word(DictData *dd, const gchar *word)
{
-
/* sanity checks */
if (! NZV(word))
{
- dict_status_add(dd, _("Invalid input."));
+ dict_gui_status_add(dd, _("Invalid input."));
return;
}
@@ -229,26 +228,26 @@
dd->searched_word = g_locale_to_utf8(word, -1, NULL, NULL, NULL);
if (dd->searched_word == NULL || ! g_utf8_validate(dd->searched_word, -1, NULL))
{
- dict_status_add(dd, _("Invalid non-UTF8 input."));
+ dict_gui_status_add(dd, _("Invalid non-UTF8 input."));
gtk_entry_set_text(GTK_ENTRY(dd->main_entry), "");
- dict_set_panel_entry_text(dd, "");
+ dict_gui_set_panel_entry_text(dd, "");
return;
}
gtk_entry_set_text(GTK_ENTRY(dd->main_entry), dd->searched_word);
- dict_set_panel_entry_text(dd, dd->searched_word);
+ dict_gui_set_panel_entry_text(dd, dd->searched_word);
}
else
{
dd->searched_word = g_strdup(word);
}
- dict_clear_text_buffer(dd);
+ dict_gui_clear_text_buffer(dd);
switch (dd->mode)
{
case DICTMODE_DICT:
{
- dict_start_server_query(dd, dd->searched_word);
+ dict_dictd_start_query(dd, dd->searched_word);
break;
}
case DICTMODE_WEB:
@@ -266,7 +265,7 @@
}
case DICTMODE_SPELL:
{
- dict_start_aspell_query(dd, dd->searched_word);
+ dict_aspell_start_query(dd, dd->searched_word);
break;
}
}
Modified: xfce4-dict/trunk/lib/dictd.c
===================================================================
--- xfce4-dict/trunk/lib/dictd.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/dictd.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -108,14 +108,14 @@
if (dd->query_status == NO_CONNECTION)
{
- dict_status_add(dd, _("Could not connect to server."));
+ dict_gui_status_add(dd, _("Could not connect to server."));
dd->query_status = NO_ERROR;
return FALSE;
}
if (dd->query_buffer == NULL || strlen(dd->query_buffer) == 0)
{
- dict_status_add(dd, _("Unknown error while quering the server."));
+ dict_gui_status_add(dd, _("Unknown error while quering the server."));
g_free(dd->query_buffer);
return FALSE;
}
@@ -123,7 +123,7 @@
answer = dd->query_buffer;
if (strncmp("220", answer, 3) != 0)
{
- dict_status_add(dd, _("Server not ready."));
+ dict_gui_status_add(dd, _("Server not ready."));
g_free(dd->query_buffer);
return FALSE;
}
@@ -134,18 +134,18 @@
if (strncmp("552", answer, 3) == 0)
{
- dict_status_add(dd, _("No matches could be found for \"%s\"."), dd->searched_word);
+ dict_gui_status_add(dd, _("No matches could be found for \"%s\"."), dd->searched_word);
g_free(dd->query_buffer);
return FALSE;
}
else if (strncmp("150", answer, 3) != 0 && strncmp("552", answer, 3) != 0)
{
- dict_status_add(dd, _("Unknown error while quering the server."));
+ dict_gui_status_add(dd, _("Unknown error while quering the server."));
g_free(dd->query_buffer);
return FALSE;
}
defs_found = atoi(answer + 4);
- dict_status_add(dd, _("%d definition(s) found."), defs_found);
+ dict_gui_status_add(dd, _("%d definition(s) found."), defs_found);
/* go to next line */
while (*answer != '\n') answer++;
@@ -209,7 +209,7 @@
g_free(dd->query_buffer);
/* clear the panel entry to not search again when you click on the panel button */
- dict_set_panel_entry_text(dd, "");
+ dict_gui_set_panel_entry_text(dd, "");
return FALSE;
}
@@ -303,7 +303,7 @@
}
-void dict_start_server_query(DictData *dd, const gchar *word)
+void dict_dictd_start_query(DictData *dd, const gchar *word)
{
if (dd->query_is_running)
{
@@ -311,7 +311,7 @@
}
else
{
- dict_status_add(dd, _("Querying %s..."), dd->server);
+ dict_gui_status_add(dd, _("Querying %s..."), dd->server);
/* start the thread to query the server */
g_thread_create((GThreadFunc) ask_server, dd, FALSE, NULL);
@@ -319,7 +319,7 @@
}
-gboolean dict_get_dict_list_cb(GtkWidget *button, DictData *dd)
+gboolean dict_dictd_get_list(GtkWidget *button, DictData *dd)
{
gint fd, i;
gint max_lines;
Modified: xfce4-dict/trunk/lib/dictd.h
===================================================================
--- xfce4-dict/trunk/lib/dictd.h 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/dictd.h 2008-03-31 18:32:56 UTC (rev 4496)
@@ -22,9 +22,8 @@
#define DICTD_H 1
-void dict_start_server_query(DictData *dd, const gchar *word);
+void dict_dictd_start_query(DictData *dd, const gchar *word);
+gboolean dict_dictd_get_list(GtkWidget *button, DictData *dd);
-gboolean dict_get_dict_list_cb(GtkWidget *button, DictData *dd);
-
#endif
Modified: xfce4-dict/trunk/lib/gui.c
===================================================================
--- xfce4-dict/trunk/lib/gui.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/gui.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -35,14 +35,14 @@
-void dict_set_panel_entry_text(DictData *dd, const gchar *text)
+void dict_gui_set_panel_entry_text(DictData *dd, const gchar *text)
{
if (dd->panel_entry != NULL)
gtk_entry_set_text(GTK_ENTRY(dd->panel_entry), text);
}
-void dict_status_add(DictData *dd, const gchar *format, ...)
+void dict_gui_status_add(DictData *dd, const gchar *format, ...)
{
static gchar string[512];
va_list args;
@@ -57,7 +57,7 @@
}
-void dict_clear_text_buffer(DictData *dd)
+void dict_gui_clear_text_buffer(DictData *dd)
{
GtkTextIter start_iter, end_iter;
@@ -84,13 +84,13 @@
static void clear_button_clicked_cb(GtkButton *button, DictData *dd)
{
- dict_clear_text_buffer(dd);
+ dict_gui_clear_text_buffer(dd);
/* clear the entries */
gtk_entry_set_text(GTK_ENTRY(dd->main_entry), "");
- dict_set_panel_entry_text(dd, "");
+ dict_gui_set_panel_entry_text(dd, "");
- dict_status_add(dd, _("Ready."));
+ dict_gui_status_add(dd, _("Ready."));
}
@@ -124,7 +124,7 @@
}
-const guint8 *dict_get_icon_data(void)
+const guint8 *dict_gui_get_icon_data(void)
{
return dict_icon_data;
}
@@ -156,7 +156,7 @@
menu_item = gtk_image_menu_item_new_from_stock("gtk-about", NULL);
gtk_container_add(GTK_CONTAINER(help_menu), menu_item);
- g_signal_connect(menu_item, "activate", G_CALLBACK(dict_about_dialog), dd);
+ g_signal_connect(menu_item, "activate", G_CALLBACK(dict_gui_about_dialog), dd);
gtk_container_add(GTK_CONTAINER(menubar), file);
gtk_container_add(GTK_CONTAINER(menubar), help);
@@ -167,7 +167,7 @@
}
-void dict_create_main_window(DictData *dd)
+void dict_gui_create_main_window(DictData *dd)
{
GtkWidget *main_box;
GtkWidget *entry_box, *label_box, *entry_label, *entry_button, *clear_button;
@@ -297,8 +297,16 @@
}
-void dict_about_dialog(GtkWidget *widget, DictData *dd)
+void dict_gui_show_main_window(DictData *dd)
{
+ gtk_widget_show(dd->window);
+ gtk_window_deiconify(GTK_WINDOW(dd->window));
+ gtk_window_present(GTK_WINDOW(dd->window));
+}
+
+
+void dict_gui_about_dialog(GtkWidget *widget, DictData *dd)
+{
GtkWidget *dialog;
XfceAboutInfo *info;
Modified: xfce4-dict/trunk/lib/gui.h
===================================================================
--- xfce4-dict/trunk/lib/gui.h 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/gui.h 2008-03-31 18:32:56 UTC (rev 4496)
@@ -22,12 +22,13 @@
#define GUI_H 1
-void dict_status_add(DictData *dd, const gchar *format, ...);
-void dict_create_main_window(DictData *dd);
-void dict_about_dialog(GtkWidget *widget, DictData *dd);
-void dict_clear_text_buffer(DictData *dd);
-void dict_set_panel_entry_text(DictData *dd, const gchar *text);
-const guint8 *dict_get_icon_data(void);
+void dict_gui_status_add(DictData *dd, const gchar *format, ...);
+void dict_gui_create_main_window(DictData *dd);
+void dict_gui_about_dialog(GtkWidget *widget, DictData *dd);
+void dict_gui_clear_text_buffer(DictData *dd);
+void dict_gui_set_panel_entry_text(DictData *dd, const gchar *text);
+void dict_gui_show_main_window(DictData *dd);
+const guint8 *dict_gui_get_icon_data(void);
#endif
Modified: xfce4-dict/trunk/lib/prefs.c
===================================================================
--- xfce4-dict/trunk/lib/prefs.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/lib/prefs.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -270,7 +270,7 @@
button_get_list = gtk_button_new_from_stock("gtk-find");
gtk_widget_show(button_get_list);
- g_signal_connect(button_get_list, "clicked", G_CALLBACK(dict_get_dict_list_cb), dd);
+ g_signal_connect(button_get_list, "clicked", G_CALLBACK(dict_dictd_get_list), dd);
/* put it all together */
table = gtk_table_new(3, 3, FALSE);
Modified: xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
===================================================================
--- xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -85,7 +85,7 @@
dpd->panel_button->style->ythickness));
/*g_object_unref(G_OBJECT(dd->icon));*/
- dpd->dd->icon = dict_plugin_load_and_scale(dict_get_icon_data(), size, -1);
+ dpd->dd->icon = dict_plugin_load_and_scale(dict_gui_get_icon_data(), size, -1);
gtk_image_set_from_pixbuf(GTK_IMAGE(dpd->panel_button_image), dpd->dd->icon);
@@ -128,14 +128,6 @@
*/
-static void dict_plugin_show_main_window(DictData *dd)
-{
- gtk_widget_show(dd->window);
- gtk_window_deiconify(GTK_WINDOW(dd->window));
- gtk_window_present(GTK_WINDOW(dd->window));
-}
-
-
static void dict_plugin_panel_button_clicked(GtkWidget *button, DictPanelData *dpd)
{
if (GTK_WIDGET_VISIBLE(dpd->dd->window))
@@ -144,7 +136,7 @@
{
const gchar *panel_text = gtk_entry_get_text(GTK_ENTRY(dpd->dd->panel_entry));
- dict_plugin_show_main_window(dpd->dd);
+ dict_gui_show_main_window(dpd->dd);
if (NZV(panel_text))
{
dict_search_word(dpd->dd, panel_text);
@@ -343,7 +335,7 @@
g_signal_connect(dpd->panel_button, "clicked", G_CALLBACK(dict_plugin_panel_button_clicked), dpd);
- dict_create_main_window(dpd->dd);
+ dict_gui_create_main_window(dpd->dd);
g_signal_connect(dpd->dd->window, "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
g_signal_connect(dpd->dd->close_button, "clicked", G_CALLBACK(dict_plugin_close_button_clicked), dpd);
@@ -353,7 +345,7 @@
g_signal_connect(plugin, "style-set", G_CALLBACK(dict_plugin_style_set), dpd);
g_signal_connect(plugin, "save", G_CALLBACK(dict_plugin_write_rc_file), dpd);
g_signal_connect(plugin, "configure-plugin", G_CALLBACK(dict_plugin_properties_dialog), dpd);
- g_signal_connect(plugin, "about", G_CALLBACK(dict_about_dialog), dpd->dd);
+ g_signal_connect(plugin, "about", G_CALLBACK(dict_gui_about_dialog), dpd->dd);
xfce_panel_plugin_menu_show_configure(plugin);
xfce_panel_plugin_menu_show_about(plugin);
@@ -394,7 +386,7 @@
g_signal_connect(dpd->dd->main_entry, "drag-data-received", G_CALLBACK(dict_drag_data_received), dpd->dd);
g_signal_connect(dpd->dd->panel_entry, "drag-data-received", G_CALLBACK(dict_drag_data_received), dpd->dd);
- dict_status_add(dpd->dd, _("Ready."));
+ dict_gui_status_add(dpd->dd, _("Ready."));
siginterrupt(SIGALRM, 1);
signal(SIGALRM, dict_signal_cb);
Modified: xfce4-dict/trunk/src/xfce4-dict.c
===================================================================
--- xfce4-dict/trunk/src/xfce4-dict.c 2008-03-30 19:32:00 UTC (rev 4495)
+++ xfce4-dict/trunk/src/xfce4-dict.c 2008-03-31 18:32:56 UTC (rev 4496)
@@ -88,7 +88,7 @@
dict_read_rc_file(dd);
- dict_create_main_window(dd);
+ dict_gui_create_main_window(dd);
g_signal_connect(dd->window, "delete-event", G_CALLBACK(main_quit), dd);
g_signal_connect(dd->close_button, "clicked", G_CALLBACK(close_button_clicked), dd);
@@ -96,7 +96,7 @@
g_signal_connect(dd->close_menu_item, "activate", G_CALLBACK(close_button_clicked), dd);
g_signal_connect(dd->pref_menu_item, "activate", G_CALLBACK(pref_dialog_activated), dd);
- dict_status_add(dd, _("Ready."));
+ dict_gui_status_add(dd, _("Ready."));
siginterrupt(SIGALRM, 1);
signal(SIGALRM, dict_signal_cb);
More information about the Goodies-commits
mailing list