Revision: 6958
Author: nogu.dev
Date: Mon Feb 14 04:37:19 2011
Log: * helper/toolbar-common-gtk.c
  - (uim_launch_helper_application): New function.
  - (right_click_menu_activated): Use uim_launch_helper_application().
* gtk3/toolbar/toolbar-applet-gnome3.c
  - (exec_switcher, exec_pref, exec_dic, exec_pad, exec_hand, exec_help):
    Use uim_launch_helper_application() instead of system(3).
* helper/toolbar-applet-gnome.c
  - Ditto.
http://code.google.com/p/uim/source/detail?r=6958

Modified:
 /trunk/gtk3/toolbar/toolbar-applet-gnome3.c
 /trunk/helper/toolbar-applet-gnome.c
 /trunk/helper/toolbar-common-gtk.c

=======================================
--- /trunk/gtk3/toolbar/toolbar-applet-gnome3.c Sun Feb 13 07:00:59 2011
+++ /trunk/gtk3/toolbar/toolbar-applet-gnome3.c Mon Feb 14 04:37:19 2011
@@ -54,6 +54,7 @@
 static void register_icons(void);

 extern GtkWidget *uim_toolbar_applet_new(void);
+extern void uim_launch_helper_application(const char *command);


 static const GtkActionEntry uim_menu_actions[] = {
@@ -85,37 +86,37 @@
 static void
 exec_switcher(GtkAction *action, gpointer data)
 {
-  system("uim-im-switcher-gtk3 &");
+  uim_launch_helper_application("uim-im-switcher-gtk3");
 }

 static void
 exec_pref(GtkAction *action, gpointer data)
 {
-  system("uim-pref-gtk3 &");
+  uim_launch_helper_application("uim-pref-gtk3");
 }

 static void
 exec_dic(GtkAction *action, gpointer data)
 {
-  system("uim-dict-gtk3 &");
+  uim_launch_helper_application("uim-dict-gtk3");
 }

 static void
 exec_pad(GtkAction *action, gpointer data)
 {
-  system("uim-input-pad-ja-gtk3 &");
+  uim_launch_helper_application("uim-input-pad-ja-gtk3");
 }

 static void
 exec_hand(GtkAction *action, gpointer data)
 {
-  system("uim-tomoe-gtk &");
+  uim_launch_helper_application("uim-tomoe-gtk");
 }

 static void
 exec_help(GtkAction *uic, gpointer data)
 {
-  system("uim-help &");
+  uim_launch_helper_application("uim-help");
 }

 /* Just the about window... If it's already open, just focus it */
=======================================
--- /trunk/helper/toolbar-applet-gnome.c        Sat Feb  5 01:19:39 2011
+++ /trunk/helper/toolbar-applet-gnome.c        Mon Feb 14 04:37:19 2011
@@ -51,6 +51,7 @@
static void display_about_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname);

 extern GtkWidget *uim_toolbar_applet_new(void);
+extern void uim_launch_helper_application(const char *command);


 static const BonoboUIVerb uim_menu_verbs[] = {
@@ -88,37 +89,37 @@
 static void
 exec_switcher(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-im-switcher-gtk &");
+  uim_launch_helper_application("uim-im-switcher-gtk");
 }

 static void
 exec_pref(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-pref-gtk &");
+  uim_launch_helper_application("uim-pref-gtk");
 }

 static void
 exec_dic(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-dict-gtk &");
+  uim_launch_helper_application("uim-dict-gtk");
 }

 static void
 exec_pad(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-input-pad-ja &");
+  uim_launch_helper_application("uim-input-pad-ja");
 }

 static void
 exec_hand(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-tomoe-gtk &");
+  uim_launch_helper_application("uim-tomoe-gtk");
 }

 static void
 exec_help(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
 {
-  system("uim-help &");
+  uim_launch_helper_application("uim-help");
 }

 /* Just the about window... If it's already open, just focus it */
=======================================
--- /trunk/helper/toolbar-common-gtk.c  Sun Feb 13 07:00:59 2011
+++ /trunk/helper/toolbar-common-gtk.c  Mon Feb 14 04:37:19 2011
@@ -58,6 +58,7 @@
 GtkWidget *uim_toolbar_applet_new(void);
 void uim_toolbar_check_helper_connection(GtkWidget *widget);
 void uim_toolbar_get_im_list(void);
+void uim_launch_helper_application(const char *command);


 enum {
@@ -257,11 +258,9 @@
   gtk_main_quit();
 }

-static void
-right_click_menu_activated(GtkMenu *menu_item, gpointer data)
-{
-  const char *command = data;
-
+void
+uim_launch_helper_application(const char *command)
+{
   if (command) {
     if (!g_spawn_command_line_async(command, NULL)) {
       GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
@@ -272,6 +271,13 @@
     }
   }
 }
+
+static void
+right_click_menu_activated(GtkMenu *menu_item, gpointer data)
+{
+  const char *command = data;
+  uim_launch_helper_application(command);
+}

 static gboolean
right_button_pressed(GtkButton *button, GdkEventButton *event, gpointer data)

Reply via email to