All pastes #2008612 Raw Edit

Miscellany

public text v1 · immutable
#2008612 ·published 2010-12-02 14:23 UTC
rendered paste body
diff --git a/configure.ac b/configure.ac
index ed07dce..bf98669 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ GTK_REQUIRED_VERSION=2.20.0
 PANGO_REQUIRED_VERSION=1.3.0
 SCROLLKEEPER_REQUIRED_VERSION=0.1.4
 GCONF_REQUIRED_VERSION=2.31.3
-GNOME_PANEL_REQUIRED_VERSION=2.0.0
+GNOME_PANEL_REQUIRED_VERSION=2.31.90
 LIBXKLAVIER_REQUIRED_VERSION=4.0
 LIBCANBERRA_GTK_REQUIRED_VERSION=0.4
 #FONTCONFIG_REQUIRED_VERSION=2.6.0
@@ -152,7 +152,7 @@ AC_SUBST(SIMPLE_CHOOSER_LIBS)
 PKG_CHECK_MODULES(APPLET,
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
         gtk+-2.0 >= $GTK_REQUIRED_VERSION
-        libpanelapplet-2.0 >= $GNOME_PANEL_REQUIRED_VERSION)
+        libpanelapplet-3.0 >= $GNOME_PANEL_REQUIRED_VERSION)
 AC_SUBST(APPLET_CFLAGS)
 AC_SUBST(APPLET_LIBS)
 
diff --git a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in b/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
deleted file mode 100644
index a9b775f..0000000
--- a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
+++ /dev/null
@@ -1,38 +0,0 @@
-<oaf_info>
-  <oaf_server iid="OAFIID:GNOME_FastUserSwitchApplet_Factory" type="exe"
-              location="@LIBEXECDIR@/gdm-user-switch-applet">
-
-    <oaf_attribute name="repo_ids" type="stringv">
-      <item value="IDL:Bonobo/GenericFactory:1.0"/>
-      <item value="IDL:Bonobo/Unknown:1.0"/>
-    </oaf_attribute>
-    <oaf_attribute name="name" type="string" _value="User Switcher Applet Factory"/>
-    <oaf_attribute name="description" type="string" _value="User Switcher Applet Factory"/>
-    <oaf_attribute name="bonobo:environment" type="stringv">
-       <item value="DBUS_SESSION_BUS_ADDRESS"/>
-     <oaf_attribute name="bugzilla:bugzilla" type="string" value="GNOME"/>
-     <oaf_attribute name="bugzilla:product" type="string" value="gdm"/>
-     <oaf_attribute name="bugzilla:component" type="string" value="general"/>
-     <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/>
-     <oaf_attribute name="bugzilla:other_binaries" type="string" value="gdm-user-switch-applet"/>
-    </oaf_attribute>
-  </oaf_server>
-
-  <oaf_server iid="OAFIID:GNOME_FastUserSwitchApplet" type="factory"
-              location="OAFIID:GNOME_FastUserSwitchApplet_Factory">
-
-    <oaf_attribute name="repo_ids" type="stringv">
-      <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
-      <item value="IDL:Bonobo/Control:1.0"/>
-      <item value="IDL:Bonobo/Unknown:1.0"/>
-    </oaf_attribute>
-    <oaf_attribute name="name" type="string" _value="User Switcher"/>
-    <oaf_attribute name="description" type="string" _value="A menu to quickly switch between users"/>
-    <oaf_attribute name="panel:icon" type="string" value="stock_people"/>
-    <oaf_attribute name="bugzilla:bugzilla" type="string" value="GNOME"/>
-    <oaf_attribute name="bugzilla:product" type="string" value="gdm"/>
-    <oaf_attribute name="bugzilla:component" type="string" value="general"/>
-    <oaf_attribute name="bugzilla:version" type="string" value="@VERSION@"/>
-    <oaf_attribute name="bugzilla:other_binaries" type="string" value="gdm-user-switch-applet"/>
-  </oaf_server>
-</oaf_info>
diff --git a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml b/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
deleted file mode 100644
index e1845c8..0000000
--- a/gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<Root>
-  <popups>
-    <popup name="button3">
-      <menuitem
-       name="About Me Item"
-       verb="GdmAboutMe"
-       _label="Edit Personal _Information"/>
-      <menuitem
-       name="Users and Groups Admin Item"
-       verb="GdmUsersGroupsAdmin"
-       _label="_Edit Users and Groups"/>
-      <menuitem
-       name="About Item"
-       verb="GdmAbout"
-       _label="_About"
-       pixtype="stock"
-       pixname="gtk-about"/>
-    </popup>
-  </popups>
-</Root>
diff --git a/gui/user-switch-applet/Makefile.am b/gui/user-switch-applet/Makefile.am
index 2d2cdc0..cebe890 100644
--- a/gui/user-switch-applet/Makefile.am
+++ b/gui/user-switch-applet/Makefile.am
@@ -13,6 +13,7 @@ AM_CPPFLAGS = \
 	-DLIBEXECDIR=\""$(libexecdir)"\" 		\
 	-DSBINDIR=\""$(sbindir)"\"		 	\
 	-DGDMCONFDIR=\"$(gdmconfdir)\"			\
+	-DGDM_USER_SWITCH_MENU_UI_DIR="\"$(uidir)\""	\
 	$(GTK_CFLAGS)					\
 	$(APPLET_CFLAGS)				\
 	$(NULL)
@@ -34,34 +35,31 @@ gdm_user_switch_applet_LDADD = 		\
 	$(APPLET_LIBS)					\
 	$(NULL)
 
-# Bonobo UI
-uidir =	$(datadir)/gnome-2.0/ui
-ui_DATA =					\
-	GNOME_FastUserSwitchApplet.xml		\
-	$(NULL)
+uidir   = $(datadir)/gnome-2.0/ui
+ui_DATA = gdm-user-switch-applet-menu.xml
 
-# Bonobo .server
-serverdir = $(libdir)/bonobo/servers
-server_in_files =				\
-	GNOME_FastUserSwitchApplet.server.in	\
-	$(NULL)
-server_DATA = $(server_in_files:.server.in=.server)
+appletdir       = $(datadir)/gnome-panel/applets
+applet_in_files = org.gnome.gdm.UserSwitch.panel-applet.in
+applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)
 
-$(server_in_files): $(server_in_files:.server.in=.server.in.in)
-	sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@
+$(applet_in_files): $(applet_in_files).in Makefile
+	$(AM_V_GEN)$(SED) -e "s|\@LIBEXECDIR\@|$(libexecdir)|" -e "s|\@VERSION\@|$(VERSION)|" $< > $@
 
-@INTLTOOL_SERVER_RULE@
+%.panel-applet: %.panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
-EXTRA_DIST = 			\
-	$(ui_DATA)		\
-	GNOME_FastUserSwitchApplet.server.in.in	\
-	$(NULL)
+servicedir = $(datadir)/dbus-1/services
+service_in_files = org.gnome.panel.applet.GdmUserSwitchAppletFactory.service.in
+service_DATA     = $(service_in_files:.service.in=.service)
+
+org.gnome.panel.applet.GdmUserSwitchAppletFactory.service: $(service_in_files)
+	$(AM_V_GEN)$(SED) -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
+
+EXTRA_DIST = org.gnome.gdm.UserSwitch.panel-applet.in.in \
+	     $(service_in_files)                         \
+	     $(ui_DATA)                                  \
+	     $(NULL)
+
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA)
 
-DISTCLEANFILES =                        \
-	$(server_in_files)		\
-	$(server_DATA)			\
-        $(NULL)
+MAINTAINERCLEANFILES = *~ Makefile.in
 
-MAINTAINERCLEANFILES =                  \
-        *~                              \
-        Makefile.in
diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
index b4f944c..74f7882 100644
--- a/gui/user-switch-applet/applet.c
+++ b/gui/user-switch-applet/applet.c
@@ -34,9 +34,6 @@
 
 #include <dbus/dbus-glib.h>
 
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-ui-util.h>
-
 #include <panel-applet.h>
 #include <panel-applet-gconf.h>
 
@@ -102,16 +99,15 @@ static gboolean applet_factory (PanelApplet   *applet,
                                 const char    *iid,
                                 gpointer       data);
 
-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory",
-                             PANEL_TYPE_APPLET,
-                             "gdm-user-switch-applet", "0",
-                             (PanelAppletFactoryCallback)applet_factory,
-                             NULL)
+PANEL_APPLET_OUT_PROCESS_FACTORY ("GdmUserSwitchAppletFactory",
+                                  PANEL_TYPE_APPLET,
+                                  "gdm-user-switch-applet",
+                                  applet_factory,
+                                  NULL)
 
 static void
-about_me_cb (BonoboUIComponent *ui_container,
-             gpointer           data,
-             const char        *cname)
+about_me_cb (GtkAction         *action,
+             gpointer           data)
 {
         GError *err;
 
@@ -120,10 +116,7 @@ about_me_cb (BonoboUIComponent *ui_container,
                 g_critical ("Could not run `gnome-about-me': %s",
                             err->message);
                 g_error_free (err);
-                bonobo_ui_component_set_prop (ui_container,
-                                              "/commands/GdmAboutMe",
-                                              "hidden", "1",
-                                              NULL);
+                gtk_action_set_visible (action, FALSE);
         }
 }
 
@@ -149,9 +142,8 @@ menubar_button_press_event_cb (GtkWidget      *menubar,
 }
 
 static void
-about_cb (BonoboUIComponent *ui_container,
-          gpointer           data,
-          const char        *cname)
+about_cb (GtkAction         *action,
+          gpointer           data)
 {
         static const char *authors[] = {
                 "James M. Cape <jcape@ignore-your.tv>",
@@ -195,9 +187,8 @@ about_cb (BonoboUIComponent *ui_container,
 
 
 static void
-admin_cb (BonoboUIComponent *ui_container,
-          gpointer           data,
-          const char        *cname)
+admin_cb (GtkAction         *action,
+          gpointer           data)
 {
 #ifdef USERS_ADMIN
         char   **args;
@@ -231,82 +222,6 @@ admin_cb (BonoboUIComponent *ui_container,
 }
 
 static void
-set_menuitem_icon (BonoboUIComponent *component,
-                   const char        *item_path,
-                   GtkIconTheme      *theme,
-                   const char        *icon_name,
-                   gint               icon_size)
-{
-        GdkPixbuf *pixbuf;
-        int        width;
-        int        height;
-
-        pixbuf = gtk_icon_theme_load_icon (theme, icon_name, icon_size, 0, NULL);
-        if (pixbuf == NULL) {
-                return;
-        }
-
-        width = gdk_pixbuf_get_width (pixbuf);
-        height = gdk_pixbuf_get_height (pixbuf);
-        if (width > icon_size + 4 || height > icon_size + 4) {
-                GdkPixbuf *tmp;
-                if (height > width) {
-                        width *= (gdouble) icon_size / (gdouble) height;
-                        height = icon_size;
-                } else {
-                        height *= (gdouble) icon_size / (gdouble) width;
-                        width = icon_size;
-                }
-                tmp = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
-                g_object_unref (pixbuf);
-                pixbuf = tmp;
-        }
-
-        bonobo_ui_util_set_pixbuf (component, item_path, pixbuf, NULL);
-        g_object_unref (pixbuf);
-}
-
-static void
-applet_style_set_cb (GtkWidget *widget,
-                     GtkStyle  *old_style,
-                     gpointer   data)
-{
-        BonoboUIComponent *component;
-        GdkScreen         *screen;
-        GtkIconTheme      *theme;
-        int                width;
-        int                height;
-        int                icon_size;
-
-        if (gtk_widget_has_screen (widget)) {
-                screen = gtk_widget_get_screen (widget);
-        } else {
-                screen = gdk_screen_get_default ();
-        }
-
-        if (gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
-                                               GTK_ICON_SIZE_MENU, &width, &height)) {
-                icon_size = MAX (width, height);
-        } else {
-                icon_size = 16;
-        }
-
-        theme = gtk_icon_theme_get_for_screen (screen);
-        component = panel_applet_get_popup_component (PANEL_APPLET (widget));
-
-        set_menuitem_icon (component,
-                           "/commands/GdmAboutMe",
-                           theme,
-                           "user-info",
-                           icon_size);
-        set_menuitem_icon (component,
-                           "/commands/GdmUsersGroupsAdmin",
-                           theme,
-                           "stock_people",
-                           icon_size);
-}
-
-static void
 applet_change_background_cb (PanelApplet               *applet,
                              PanelAppletBackgroundType  type,
                              GdkColor                  *color,
@@ -1389,18 +1304,23 @@ on_presence_status_text_changed (DBusGProxy    *presence_proxy,
 static gboolean
 fill_applet (PanelApplet *applet)
 {
-        static const BonoboUIVerb menu_verbs[] = {
-                BONOBO_UI_VERB ("GdmAboutMe", about_me_cb),
-                BONOBO_UI_VERB ("GdmUsersGroupsAdmin", admin_cb),
-                BONOBO_UI_VERB ("GdmAbout", about_cb),
-                BONOBO_UI_VERB_END
+        static const GtkActionEntry gdm_user_switch_applet_actions[] = {
+                { "GdmAboutMe", "user-info", N_("Edit Personal _Information"),
+                  NULL, NULL,
+                  G_CALLBACK (about_me_cb) },
+                { "GdmUsersGroupsAdmin", "stock-people", N_("_Edit Users and Groups"),
+                  NULL, NULL,
+                  G_CALLBACK (admin_cb) },
+                { "GdmAbout", GTK_STOCK_ABOUT, N_("_About"),
+                  NULL, NULL,
+                  G_CALLBACK (about_cb) },
         };
         static gboolean    first_time = FALSE;
         char              *tmp;
-        BonoboUIComponent *popup_component;
         GdmAppletData     *adata;
         GError            *error;
         DBusGConnection   *bus;
+        GtkActionGroup    *action_group;
 
         if (!first_time) {
                 first_time = TRUE;
@@ -1438,52 +1358,51 @@ fill_applet (PanelApplet *applet)
         gtk_container_set_border_width (GTK_CONTAINER (applet), 0);
         gtk_widget_set_name (GTK_WIDGET (applet), "gdm-user-switch-applet");
         panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
-        panel_applet_setup_menu_from_file (applet, NULL,
-                                           DATADIR "/gnome-2.0/ui/GNOME_FastUserSwitchApplet.xml",
-                                           NULL, menu_verbs, adata);
 
-        popup_component = panel_applet_get_popup_component (applet);
+        action_group = gtk_action_group_new ("GDM User Switch Applet Actions");
+        gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+        gtk_action_group_add_actions (action_group,
+                                      gdm_user_switch_applet_actions,
+                                      G_N_ELEMENTS (gdm_user_switch_applet_actions),
+                                      adata);
+
+        panel_applet_setup_menu_from_file (applet,
+                                           GDM_USER_SWITCH_MENU_UI_DIR G_DIR_SEPARATOR_S "gdm-user-switch-applet-menu.xml",
+                                           action_group);
 
         /* Hide the admin context menu items if locked down or no cmd-line */
         if (gconf_client_get_bool (adata->client,
                                    LOCKDOWN_COMMAND_LINE_KEY,
                                    NULL) ||
             panel_applet_get_locked_down (applet)) {
-                bonobo_ui_component_set_prop (popup_component,
-                                              "/popups/button3/GdmSeparator",
-                                              "hidden", "1", NULL);
-                bonobo_ui_component_set_prop (popup_component,
-                                              "/commands/GdmUsersGroupsAdmin",
-                                              "hidden", "1", NULL);
+                GtkAction *action;
+
+                action = gtk_action_group_get_action (action_group, "GdmUsersGroupsAdmin");
+                gtk_action_set_visible (action, FALSE);
         } else {
+                GtkAction *action;
+
 #ifndef USERS_ADMIN
 #  ifdef GDM_SETUP
-                bonobo_ui_component_set_prop (popup_component,
-                                              "/popups/button3/GdmSeparator",
-                                              "hidden", "1",
-                                              NULL);
 #  endif /* !GDM_SETUP */
-                bonobo_ui_component_set_prop (popup_component,
-                                              "/commands/GdmUsersGroupsAdmin",
-                                              "hidden", "1",
-                                              NULL);
+                action = gtk_action_group_get_action (action_group, "GdmUsersGroupsAdmin");
+                gtk_action_set_visible (action, FALSE);
 #endif /* !USERS_ADMIN */
         }
 
         /* Hide the gdmphotosetup item if it can't be found in the path. */
         tmp = g_find_program_in_path ("gnome-about-me");
         if (!tmp) {
-                bonobo_ui_component_set_prop (popup_component,
-                                              "/commands/GdmAboutMe",
-                                              "hidden", "1",
-                                              NULL);
+                GtkAction *action;
+
+                action = gtk_action_group_get_action (action_group, "GdmAboutMe");
+                gtk_action_set_visible (action, FALSE);
         } else {
                 g_free (tmp);
         }
 
-        g_signal_connect (adata->applet,
-                          "style-set",
-                          G_CALLBACK (applet_style_set_cb), adata);
+        g_object_unref (action_group);
+
         g_signal_connect (applet,
                           "change-background",
                           G_CALLBACK (applet_change_background_cb), adata);
@@ -1655,7 +1574,7 @@ applet_factory (PanelApplet   *applet,
 {
         gboolean ret;
         ret = FALSE;
-        if (strcmp (iid, "OAFIID:GNOME_FastUserSwitchApplet") == 0) {
+        if (strcmp (iid, "GdmUserSwitchApplet") == 0) {
                 ret = fill_applet (applet);
         }
         return ret;
diff --git a/gui/user-switch-applet/gdm-user-switch-applet-menu.xml b/gui/user-switch-applet/gdm-user-switch-applet-menu.xml
new file mode 100644
index 0000000..78301b3
--- /dev/null
+++ b/gui/user-switch-applet/gdm-user-switch-applet-menu.xml
@@ -0,0 +1,4 @@
+<menuitem name="About Me Item" action="GdmAboutMe"/>
+<menuitem name="Users and Groups Admin Item" action="GdmUsersGroupsAdmin"/>
+<menuitem name="About Item" action="GdmAbout"/>
+
diff --git a/gui/user-switch-applet/org.gnome.gdm.UserSwitch.panel-applet.in.in b/gui/user-switch-applet/org.gnome.gdm.UserSwitch.panel-applet.in.in
new file mode 100644
index 0000000..3c77dfb
--- /dev/null
+++ b/gui/user-switch-applet/org.gnome.gdm.UserSwitch.panel-applet.in.in
@@ -0,0 +1,16 @@
+[Applet Factory]
+Id=GdmUserSwitchAppletFactory
+Location=@LIBEXECDIR@/gdm-user-switch-applet
+_Name=User Switcher Applet Factory
+_Description=User Switcher Applet Factory
+
+[GdmUserSwitchApplet]
+_Name=User Switcher
+_Description=A menu to quickly switch between users
+BonoboId=OAFIID:GNOME_FastUserSwitchApplet
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gdm
+X-GNOME-Bugzilla-Component=general
+X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Bugzilla-OtherBinaries=gdm-user-switch-applet
+
diff --git a/gui/user-switch-applet/org.gnome.panel.applet.GdmUserSwitchAppletFactory.service.in b/gui/user-switch-applet/org.gnome.panel.applet.GdmUserSwitchAppletFactory.service.in
new file mode 100644
index 0000000..7bf900f
--- /dev/null
+++ b/gui/user-switch-applet/org.gnome.panel.applet.GdmUserSwitchAppletFactory.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.gnome.panel.applet.GdmUserSwitchAppletFactory
+Exec=@LIBEXECDIR@/gdm-user-switch-applet
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1fccb90..5340391 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -86,8 +86,7 @@ gui/simple-greeter/gdm-user-chooser-widget.c
 gui/simple-greeter/greeter-main.c
 gui/user-switch-applet/applet.c
 gui/user-switch-applet/gdm-entry-menu-item.c
-gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in.in
-gui/user-switch-applet/GNOME_FastUserSwitchApplet.xml
+gui/user-switch-applet/org.gnome.gdm.UserSwitch.panel-applet.in.in
 utils/gdmflexiserver.c
 utils/gdm-screenshot.c
 
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 0269a0f..9032c03 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -7,7 +7,7 @@
 # remove these unless you fix "make distcheck" a different way.
 #
 data/gdm.schemas.in
-gui/user-switch-applet/GNOME_FastUserSwitchApplet.server.in
+gui/user-switch-applet/org.gnome.gdm.UserSwitch.panel-applet.in
 data/greeter-autostart/at-spi-registryd-wrapper.desktop.in
 data/greeter-autostart/gdm-simple-greeter.desktop.in
 data/greeter-autostart/gnome-power-manager.desktop.in
-- 
1.7.2.3