[uim-commit] r3100 - trunk/helper

ekato at freedesktop.org ekato at freedesktop.org
Tue Feb 7 00:18:41 PST 2006


Author: ekato
Date: 2006-02-07 00:18:37 -0800 (Tue, 07 Feb 2006)
New Revision: 3100

Modified:
   trunk/helper/toolbar-applet-gnome.c
Log:
* helper/toolbar-applet-gnome.c : Indentation fixes.
(uim_menu_xml) : Fix labels to be translated.
(display_about_dialog) : Draw icon.


Modified: trunk/helper/toolbar-applet-gnome.c
===================================================================
--- trunk/helper/toolbar-applet-gnome.c	2006-02-07 05:55:50 UTC (rev 3099)
+++ trunk/helper/toolbar-applet-gnome.c	2006-02-07 08:18:37 UTC (rev 3100)
@@ -44,33 +44,30 @@
 
 PanelApplet *uimapplet;
 
-static void
-exec_switcher(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
-static void
-exec_pref(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
-static void
-display_about_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
+static void exec_switcher(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
+static void exec_pref(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
+static void display_about_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
 
 extern GtkWidget *uim_toolbar_applet_new(void);
 
 
-static const BonoboUIVerb uim_menu_verbs [] = {
-  BONOBO_UI_VERB ("UimExecSwitcher",   exec_switcher),
-  BONOBO_UI_VERB ("UimExecPref",   exec_pref),
-  BONOBO_UI_VERB ("UimAbout",      display_about_dialog),
+static const BonoboUIVerb uim_menu_verbs[] = {
+  BONOBO_UI_VERB("UimExecSwitcher", exec_switcher),
+  BONOBO_UI_VERB("UimExecPref", exec_pref),
+  BONOBO_UI_VERB("UimAbout", display_about_dialog),
   BONOBO_UI_VERB_END
 };
 
 
-static const char uim_menu_xml [] =
-        "<popup name=\"button3\">\n"
-        "   <menuitem name=\"Switcher Item\" verb=\"UimExecSwitcher\" _label=\"Execute uim's input method switcher\"\n"
-        "             pixtype=\"filename\" pixname=\""UIM_PIXMAPSDIR"/switcher-icon.png\"/>\n"
-        "   <menuitem name=\"Pref Item\" verb=\"UimExecPref\" _label=\"Execute uim's preference tool\"\n"
-        "             pixtype=\"stock\" pixname=\"preferences\"/>\n"
-        "   <menuitem name=\"About Item\" verb=\"UimAbout\" _label=\"About ...\"\n"
-        "             pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
-        "</popup>\n";
+static const char uim_menu_xml[] =
+  "<popup name=\"button3\">\n"
+  "   <menuitem name=\"Switcher Item\" verb=\"UimExecSwitcher\" _label=\"Switch input method\"\n"
+  "             pixtype=\"filename\" pixname=\""UIM_PIXMAPSDIR"/switcher-icon.png\"/>\n"
+  "   <menuitem name=\"Pref Item\" verb=\"UimExecPref\" _label=\"Preference\"\n"
+  "             pixtype=\"stock\" pixname=\"preferences\"/>\n"
+  "   <menuitem name=\"About Item\" verb=\"UimAbout\" _label=\"About ...\"\n"
+  "             pixtype=\"stock\" pixname=\"gnome-stock-about\"/>\n"
+  "</popup>\n";
 
 
 
@@ -90,83 +87,83 @@
 /* Opens gnome help application
  */
 #if 0
-static void 
-display_help_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
+static void
+display_help_dialog(BonoboUIComponent *uic, gpointer data,
+		    const gchar *verbname)
 {
   GError *error = NULL;
-  
+
   gnome_help_display("Uim", NULL, &error);
 
-  if (error)
-    {
-      GtkWidget *dialog;
-      dialog = gtk_message_dialog_new(NULL, 
-				      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-				      GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-				      error->message);
-      gtk_dialog_run (GTK_DIALOG (dialog));
-      gtk_widget_destroy (dialog);
-      g_error_free (error);
-      error = NULL;
-    }
+  if (error) {
+    GtkWidget *dialog;
+    dialog = gtk_message_dialog_new(NULL,
+				    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+				    GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+				    error->message);
+    gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_destroy(dialog);
+    g_error_free(error);
+    error = NULL;
+  }
 }
 #endif
 
-/* Just the about window... If it's already open, just focus it
- */
+/* Just the about window... If it's already open, just focus it */
 static void
-display_about_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname)
+display_about_dialog(BonoboUIComponent *uic, gpointer data,
+		     const gchar *verbname)
 {
-  /*	GdkPixbuf *icon;*/
+  GdkPixbuf *icon = NULL;
   GtkWidget *dialog;
-  const char *authors[] = {"uim Project", NULL};
-  
+  const gchar *authors[] = {"uim Project", NULL};
   /* Feel free to put your names here translators */
-  char *translators = _("TRANSLATORS");
-  
-  /* icon = gdk_pixbuf_new_from_xpm_data(ICON_APPLET);*/
-  
-  dialog = GTK_WIDGET(gnome_about_new (_("Uim Applet for GNOME"), VERSION, "Copyright 2003-2006 uim Project.",
-				       _("Applet for indicate uim's status"),
-				       (const char **) authors, NULL, 
-				       strcmp("TRANSLATORS", translators) ? translators : NULL, 
-				       NULL));
-  
-  gtk_widget_show(GTK_WIDGET(dialog));
+  gchar *translators = _("TRANSLATORS");
+  icon = gdk_pixbuf_new_from_file(UIM_PIXMAPSDIR "/uim-icon.png", NULL);
+
+  dialog = gnome_about_new(_("Uim Applet for GNOME"), VERSION,
+			   "Copyright 2003-2006 uim Project.",
+			   _("Applet for indicate uim's status"),
+			   authors,
+			   NULL,
+			   strcmp("TRANSLATORS", translators) ? translators
+			   				      : NULL,
+			   icon);
+
+  if (icon) {
+    gtk_window_set_icon(GTK_WINDOW(dialog), icon);
+    g_object_unref(icon);
+  }
+  gtk_widget_show(dialog);
 }
 
 
 static gboolean
-uim_applet_new(PanelApplet *applet,
-		 const gchar *iid,
-		 gpointer     data)
+uim_applet_new(PanelApplet *applet, const gchar *iid, gpointer data)
 {
   GtkWidget *toolbar;
   uimapplet = applet;
- 
-  if (strcmp (iid, "OAFIID:GNOME_UimApplet") != 0)
+
+  if (strcmp(iid, "OAFIID:GNOME_UimApplet") != 0)
     return FALSE;
 
   uim_init();
 
   toolbar = (GtkWidget*)uim_toolbar_applet_new();
 
-  gtk_container_add (GTK_CONTAINER (applet), toolbar);  
-  gtk_widget_show_all (GTK_WIDGET (applet));
+  gtk_container_add(GTK_CONTAINER(applet), toolbar);
+  gtk_widget_show_all(GTK_WIDGET(applet));
 
-  panel_applet_setup_menu(applet,
-			  uim_menu_xml,
-			  uim_menu_verbs,
-			  toolbar);
+  panel_applet_setup_menu(applet, uim_menu_xml, uim_menu_verbs, toolbar);
 
   return TRUE;
 }
 
 
 
-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_UimApplet_Factory",
-                             PANEL_TYPE_APPLET,
-                             "uim Applet for GNOME",
-                             "0",
-                             (PanelAppletFactoryCallback)uim_applet_new,
-                             NULL)
+PANEL_APPLET_BONOBO_FACTORY("OAFIID:GNOME_UimApplet_Factory",
+                            PANEL_TYPE_APPLET,
+                            "uim Applet for GNOME",
+                            "0",
+                            (PanelAppletFactoryCallback)uim_applet_new,
+                            NULL)



More information about the uim-commit mailing list