[uim-commit] r3063 - trunk/helper

ekato at freedesktop.org ekato at freedesktop.org
Wed Feb 1 01:27:10 PST 2006


Author: ekato
Date: 2006-02-01 01:27:04 -0800 (Wed, 01 Feb 2006)
New Revision: 3063

Modified:
   trunk/helper/toolbar-applet-gnome.c
   trunk/helper/toolbar-common-gtk.c
   trunk/helper/toolbar-standalone-gtk.c
   trunk/helper/toolbar-systray-gtk.c
Log:
* helper/toolbar-systray-gtk.c (embedded_cb) : New.  Connect to
  uim helper.
(main) : Create toolbar with all icons again.  Get icons
  information after "embedded" signal to prevent getting incorrect
  size of icons.
* helper/toolbar-common-gtk.c : Rename TYPE_TOOLBAR to
  TYPE_STANDALONE.
(uim_helper_toolbar_new) : Rename to uim_toolbar_standalone_new.
(uim_helper_trayicon_new) : Rename to uim_toolbar_trayicon_new.
  Use all icons as in other types of toolbar.
(uim_helper_applet_new) : Rename to uim_toolbar_applet_new.
(check_helper_connection) : Rename to
  uim_toolbar_check_helper_connection and remove static qualifier.
(prop_button_released) : Follow the rename in
  check_helper_connection.
(toolbar_new) : Don't connect to uim-helper at this time with
  TYPE_ICON.
* helper/toolbar-standalone-gtk.c : Follow the rename in
  toolbar-common-gtk.c
* helper/toolbar-applet-gnome.c : Ditto.


Modified: trunk/helper/toolbar-applet-gnome.c
===================================================================
--- trunk/helper/toolbar-applet-gnome.c	2006-02-01 05:23:27 UTC (rev 3062)
+++ trunk/helper/toolbar-applet-gnome.c	2006-02-01 09:27:04 UTC (rev 3063)
@@ -51,7 +51,7 @@
 static void
 display_about_dialog(BonoboUIComponent *uic, gpointer data, const gchar *verbname);
 
-GtkWidget *uim_helper_applet_new(void);
+extern GtkWidget *uim_toolbar_applet_new(void);
 
 
 static const BonoboUIVerb uim_menu_verbs [] = {
@@ -149,7 +149,7 @@
 
   uim_init();
 
-  toolbar = (GtkWidget*)uim_helper_applet_new();
+  toolbar = (GtkWidget*)uim_toolbar_applet_new();
 
   gtk_container_add (GTK_CONTAINER (applet), toolbar);  
   gtk_widget_show_all (GTK_WIDGET (applet));

Modified: trunk/helper/toolbar-common-gtk.c
===================================================================
--- trunk/helper/toolbar-common-gtk.c	2006-02-01 05:23:27 UTC (rev 3062)
+++ trunk/helper/toolbar-common-gtk.c	2006-02-01 09:27:04 UTC (rev 3063)
@@ -105,7 +105,7 @@
 static int uim_fd;
 
 enum {
-  TYPE_TOOLBAR,
+  TYPE_STANDALONE,
   TYPE_APPLET,
   TYPE_ICON
 };
@@ -122,12 +122,14 @@
 prop_menu_activate(GtkMenu *menu_item, gpointer data);
 
 GtkWidget *
-uim_helper_toolbar_new(void);
+uim_toolbar_standalone_new(void);
 GtkWidget *
-uim_helper_trayicon_new(void);
+uim_toolbar_trayicon_new(void);
 GtkWidget *
-uim_helper_applet_new(void);
+uim_toolbar_applet_new(void);
 
+void uim_toolbar_check_helper_connection(GtkWidget *widget);
+
 static void
 prop_menu_activate(GtkMenu *menu_item, gpointer data)
 {
@@ -619,8 +621,8 @@
   return FALSE;
 }
 
-static void
-check_helper_connection(GtkWidget *widget)
+void
+uim_toolbar_check_helper_connection(GtkWidget *widget)
 {
   if (uim_fd < 0) {
     uim_fd = uim_helper_init_client_fd(helper_disconnect_cb);
@@ -649,7 +651,7 @@
   int i = 0;
   gboolean is_radio = FALSE;
 
-  check_helper_connection(widget);
+  uim_toolbar_check_helper_connection(widget);
   
   if (!event) {
     return FALSE;
@@ -795,44 +797,28 @@
 		    GINT_TO_POINTER(type));
   
   uim_fd = -1;
-  check_helper_connection(hbox);
-  uim_helper_client_get_prop_list();
+  if (type != TYPE_ICON) {
+    uim_toolbar_check_helper_connection(hbox);
+    uim_helper_client_get_prop_list();
+  }
 
   return hbox; 
 }
 
 GtkWidget *
-uim_helper_toolbar_new(void)
+uim_toolbar_standalone_new(void)
 {
-  return toolbar_new(TYPE_TOOLBAR);
+  return toolbar_new(TYPE_STANDALONE);
 }
 
 GtkWidget *
-uim_helper_applet_new(void)
+uim_toolbar_applet_new(void)
 {
   return toolbar_new(TYPE_APPLET);
 }
 
-
 GtkWidget *
-uim_helper_trayicon_new(void)
+uim_toolbar_trayicon_new(void)
 {
-  GtkWidget *button;
-
-  regist_icon();
-
-  prop_menu = gtk_menu_new();
-  right_click_menu = right_click_menu_create();
-  
-  button = gtk_button_new_with_label(" x");
-  gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-  g_signal_connect(G_OBJECT(button), "button-press-event",
-		   G_CALLBACK(prop_button_pressed), button);
-  g_signal_connect(G_OBJECT(button), "button-release-event",
-		   G_CALLBACK(prop_button_released), button);
-  
-  uim_fd = -1;
-  check_helper_connection(button);
-  uim_helper_client_get_prop_list();
-  return button;
+  return toolbar_new(TYPE_ICON);
 }

Modified: trunk/helper/toolbar-standalone-gtk.c
===================================================================
--- trunk/helper/toolbar-standalone-gtk.c	2006-02-01 05:23:27 UTC (rev 3062)
+++ trunk/helper/toolbar-standalone-gtk.c	2006-02-01 09:27:04 UTC (rev 3063)
@@ -42,7 +42,7 @@
 #include <gtk/gtk.h>
 #include "uim/uim.h"
 
-extern GtkWidget *uim_helper_toolbar_new(void);
+extern GtkWidget *uim_toolbar_standalone_new(void);
 
 static gboolean toolbar_dragging = FALSE;
 static gint window_drag_start_x = -1, window_drag_start_y = -1;
@@ -241,7 +241,7 @@
   gtk_widget_set_size_request(handle, 8, -1);
   gtk_box_pack_start(GTK_BOX (hbox), handle, FALSE, FALSE, 0);
 
-  toolbar = (GtkWidget*)uim_helper_toolbar_new();
+  toolbar = (GtkWidget*)uim_toolbar_standalone_new();
   gtk_box_pack_start(GTK_BOX (hbox), toolbar, FALSE, FALSE, 0);
   g_signal_connect(G_OBJECT(window), "size-request",
 		   G_CALLBACK(size_request_cb), NULL);

Modified: trunk/helper/toolbar-systray-gtk.c
===================================================================
--- trunk/helper/toolbar-systray-gtk.c	2006-02-01 05:23:27 UTC (rev 3062)
+++ trunk/helper/toolbar-systray-gtk.c	2006-02-01 09:27:04 UTC (rev 3063)
@@ -41,8 +41,18 @@
 #include <gtk/gtk.h>
 #include "eggtrayicon.h"
 
-GtkWidget *uim_helper_trayicon_new(void);
+GtkWidget *uim_toolbar_trayicon_new(void);
+void uim_toolbar_check_helper_connection(GtkWidget *widget);
 
+
+static void
+embedded_cb(GtkWidget *widget, gpointer user_data)
+{
+  uim_toolbar_check_helper_connection(user_data);
+  uim_helper_client_get_prop_list();
+}
+
+
 int 
 main (int argc, char *argv[])
 {
@@ -62,7 +72,8 @@
 
   tray = egg_tray_icon_new("uim");
 
-  icon = uim_helper_trayicon_new();
+  icon = uim_toolbar_trayicon_new();
+  g_signal_connect(G_OBJECT(tray), "embedded", G_CALLBACK(embedded_cb), icon);
 
   gtk_widget_show_all(icon);
 
@@ -70,6 +81,7 @@
   gtk_widget_show(GTK_WIDGET (tray));
 
   gtk_main();
+
+  uim_quit();
   return 0;
 }
-



More information about the uim-commit mailing list