[seahorse-plugins] Get rid of Bonobo



commit db6672618eb8b3a46784dd70e7c1e8f0367d4fd0
Author: Pablo Castellano <pablog src gnome org>
Date:   Fri Jun 11 01:08:24 2010 +0200

    Get rid of Bonobo
    
    Thanks to Carlos Garcia Campos for the review.
    https://bugzilla.gnome.org/show_bug.cgi?id=571878

 configure.in                                       |   32 +---
 plugins/applet/.gitignore                          |    4 +
 plugins/applet/GNOME_SeahorseApplet.server.in.in   |   34 ----
 plugins/applet/GNOME_SeahorseApplet.xml            |   12 --
 plugins/applet/Makefile.am                         |   62 +++---
 ...gnome.applets.SeahorseApplet.panel-applet.in.in |   16 ++
 ...e.panel.applet.SeahorseAppletFactory.service.in |    3 +
 plugins/applet/seahorse-applet.c                   |   71 ++++---
 plugins/applet/seahorseapplet-menu.xml             |    3 +
 plugins/gedit/Makefile.am                          |    4 -
 plugins/gedit/seahorse-gedit-bonobo.c              |  204 --------------------
 plugins/gedit/seahorse-gedit.h                     |    4 -
 po/POTFILES.in                                     |    3 +-
 13 files changed, 111 insertions(+), 341 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1808214..633ce1e 100644
--- a/configure.in
+++ b/configure.in
@@ -409,7 +409,6 @@ dnl GEDIT
 dnl ****************************************************************************
 
 with_gedit_plugin="no"
-with_gedit_bonobo="no"
 
 if test "$enable_dbus" != "yes"; then
     echo "disabling gedit plugin: no dbus support"
@@ -430,28 +429,17 @@ else
         echo "checking for supported versions of gedit..."
     
         # Gedit plugins completely changed after 2.14. 
-        # - Bonobo plugins <= 2.12. 
-        # - Glib type plugins > 2.13
+        # With gedit <= 2.12 Bonobo was used.
+        # With gedit > 2.13 Glib is used.
+        # Seahorse 2.31 removed Bonobo support as it became deprecated
     
     PKG_CHECK_MODULES(GEDIT, gedit-2.20 >= 2.20.0, [with_gedit_plugin=yes],
     	[PKG_CHECK_MODULES(GEDIT, gedit-2.16 >= 2.15.0, [with_gedit_plugin=yes],
                 [PKG_CHECK_MODULES(GEDIT, gedit-2.14 >= 2.13.0, [with_gedit_plugin=yes],
-                    [PKG_CHECK_MODULES(GEDIT, gedit-2.12 >= 2.12.0, [with_gedit_bonobo=yes],
-                        [PKG_CHECK_MODULES(GEDIT, gedit-2.10 >= 2.9.0, [with_gedit_bonobo=yes], 
-                            [PKG_CHECK_MODULES(GEDIT, gedit-2.8 >= 2.8.0, [with_gedit_bonobo=yes], 
-                                [PKG_CHECK_MODULES(GEDIT, gedit-2.6 >= 2.6.0, [with_gedit_bonobo=yes],
-                                    [enable_gedit=no])])])])])])])
+                                    [enable_gedit=no])])])
     
         if test "$enable_gedit" = "yes"; then
             echo "enabling gedit plugin..."
-            
-            if test "$with_gedit_bonobo" = "yes"; then
-                echo "using bonobo type gedit plugin..."
-                AC_DEFINE_UNQUOTED(WITH_GEDIT_BONOBO, 1, [Use 'bonobo' type gedit plugin (for versions <= 2.12)])
-            else
-                echo "using glib type gedit plugin..."
-            fi
-        
             AC_SUBST(GEDIT_CFLAGS)
             AC_SUBST(GEDIT_LIBS)
         fi
@@ -459,13 +447,12 @@ else
 fi
 
 AM_CONDITIONAL(WITH_GEDIT, test "$enable_gedit" = "yes")
-AM_CONDITIONAL(WITH_GEDIT_BONOBO, test "$with_gedit_bonobo" = "yes")
 
 dnl ***************
 dnl APPLET
 dnl ***************
 
-PANEL_APPLET_REQUIRED=2.9.4
+PANEL_APPLET_REQUIRED=2.31.2
 
 with_panel_applet="no"
 
@@ -485,14 +472,14 @@ else
     else
         echo "checking for supported versions of libpanelapplet..."
         
-        PKG_CHECK_MODULES(GNOME_APPLETS, libpanelapplet-2.0 >= $PANEL_APPLET_REQUIRED,
+        PKG_CHECK_MODULES(GNOME_APPLETS3, libpanelapplet-3.0 >= $PANEL_APPLET_REQUIRED,
                 [enable_applet=yes],
                 [enable_applet=no])
 
         if test "$enable_applet" = "yes"; then
             echo "enabling panel applet..."
-            AC_SUBST(GNOME_APPLETS_CFLAGS)
-            AC_SUBST(GNOME_APPLETS_LIBS)
+            AC_SUBST(GNOME_APPLETS3_CFLAGS)
+            AC_SUBST(GNOME_APPLETS3_LIBS)
             AC_DEFINE(WITH_APPLET, 1, [Build the clipboard encryption panel applet])
             with_panel_applet=yes
         fi
@@ -549,7 +536,7 @@ AC_ARG_ENABLE(debug,
 	    [Compile binaries in debug mode]))
 
 if test "$enable_debug" = "yes"; then
-  CFLAGS="$CFLAGS -g -O0 -DBONOBO_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -Wall -Werror"
+  CFLAGS="$CFLAGS -g -O0 -DG_DISABLE_DEPRECATED -Wall -Werror"
   AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
   echo "enabling debug compile mode"
 else 
@@ -636,7 +623,6 @@ GnuPG Version:           $gnupg_version
 GPGME Version:           $gpgme_config_version
 Plugins:
   Epiphany:              $with_epiphany_plugin    
-  GEdit (v <= 2.12):     $with_gedit_bonobo
   GEdit (v >= 2.14):     $with_gedit_plugin
   Panel Applet:          $with_panel_applet
   Nautilus:              $with_nautilus_ext
diff --git a/plugins/applet/.gitignore b/plugins/applet/.gitignore
index 9036931..49fb0a7 100644
--- a/plugins/applet/.gitignore
+++ b/plugins/applet/.gitignore
@@ -6,3 +6,7 @@
 /GNOME_SeahorseApplet.server
 /GNOME_SeahorseApplet.server.in
 /seahorse-applet
+
+/org.gnome.applets.SeahorseApplet.panel-applet
+/org.gnome.applets.SeahorseApplet.panel-applet.in
+/org.gnome.panel.applet.SeahorseAppletFactory.service
diff --git a/plugins/applet/Makefile.am b/plugins/applet/Makefile.am
index 8d077f1..368b25c 100644
--- a/plugins/applet/Makefile.am
+++ b/plugins/applet/Makefile.am
@@ -1,20 +1,40 @@
-
-appletdir = $(datadir)/gnome-2.0/ui
-uidir = $(datadir)/seahorse-plugins/ui/
-localedir = $(datadir)/locale
-
 SUBDIRS = docs
 DIST_SUBDIRS = docs
 
+appletdir	= $(datadir)/gnome-panel/applets
+applet_in_files = org.gnome.applets.SeahorseApplet.panel-applet.in
+applet_DATA	= $(applet_in_files:.panel-applet.in=.panel-applet)
+
+$(applet_in_files): $(applet_in_files).in Makefile
+	$(AM_V_GEN)sed \
+            -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+            -e "s|\ VERSION\@|$(PACKAGE_VERSION)|" \
+            $< > $@
+
+%.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
+
+servicedir       = $(datadir)/dbus-1/services
+service_in_files = org.gnome.panel.applet.SeahorseAppletFactory.service.in
+service_DATA     = $(service_in_files:.service.in=.service)
+
+org.gnome.panel.applet.SeahorseAppletFactory.service: $(service_in_files)
+	$(AM_V_GEN)sed \
+            -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+            $< > $@
+
+uidir = $(datadir)/seahorse-plugins/ui
+ui_DATA = \
+	seahorse-applet-preferences.xml \
+	seahorseapplet-menu.xml
+
 INCLUDES = \
 	-I.	\
 	-I$(srcdir) \
-	$(GNOME_APPLETS_CFLAGS)	\
+	$(GNOME_APPLETS3_CFLAGS)	\
 	-I$(includedir) \
 	-I$(top_srcdir)/libseahorse \
 	$(SEAHORSE_CFLAGS) \
 	-DGNOMELOCALEDIR=\"$(localedir)\" \
-	-DUIDIR=\"$(appletdir)\" \
 	-DDATADIR=\""$(datadir)"\" \
 	-DLIBDIR=\""$(libdir)"\" \
 	-DSEAHORSE_UIDIR=\""$(uidir)"\" \
@@ -22,37 +42,21 @@ INCLUDES = \
 	-DPREFIX=\""$(prefix)"\" \
 	-DLIBCRYPTUI_API_SUBJECT_TO_CHANGE
 
-seahorse_appletdir = $(libdir)/seahorse
-seahorse_applet_PROGRAMS = seahorse-applet
+libexec_PROGRAMS = seahorse-applet
 
 seahorse_applet_SOURCES = \
 	seahorse-applet.c \
 	seahorse-applet.h
 
 seahorse_applet_LDADD = \
-	$(GNOME_APPLETS_LIBS) \
+	$(GNOME_APPLETS3_LIBS) \
 	$(top_builddir)/libseahorse/libseahorse.a \
 	$(SEAHORSE_LIBS) \
 	$(LIBCRYPTUI_LIBS)
 
-serverdir = $(libdir)/bonobo/servers
-server_in_files = GNOME_SeahorseApplet.server.in
-server_DATA = $(server_in_files:.server.in=.server)
-
-$(server_in_files): $(server_in_files:.server.in=.server.in.in)
-	sed -e "s|\ LIBDIR\@|$(libdir)|" $< > $@
-
-CLEANFILES = $(server_in_files) $(server_DATA) $(schemas_DATA) *.bak
-
-applet_DATA = \
-	GNOME_SeahorseApplet.xml
-
- INTLTOOL_SERVER_RULE@
-
-ui_DATA = \
-	seahorse-applet-preferences.xml
-
 EXTRA_DIST = \
-	GNOME_SeahorseApplet.server.in.in \
 	$(ui_DATA) \
-	$(applet_DATA)
+	org.gnome.applets.SeahorseApplet.panel-applet.in.in \
+	$(service_in_files)
+
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA)
diff --git a/plugins/applet/org.gnome.applets.SeahorseApplet.panel-applet.in.in b/plugins/applet/org.gnome.applets.SeahorseApplet.panel-applet.in.in
new file mode 100644
index 0000000..511f1bc
--- /dev/null
+++ b/plugins/applet/org.gnome.applets.SeahorseApplet.panel-applet.in.in
@@ -0,0 +1,16 @@
+[Applet Factory]
+Id=SeahorseAppletFactory
+Location= LIBEXECDIR@/seahorse-applet
+Name=Seahorse Applet Factory
+Description=Seahorse Applet Factory
+
+[SeahorseApplet]
+_Name=Clipboard Text Encryption
+_Description=Encrypt, decrypt or sign the clipboard (uses PGP type encryption).
+Icon=seahorse-applet
+BonoboId=OAFIID:GNOME_SeahorseApplet
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=seahorse-plugins
+X-GNOME-Bugzilla-Component=Applet
+X-GNOME-Bugzilla-Version= VERSION@
+X-GNOME-Bugzilla-OtherBinaries=seahorse-applet
diff --git a/plugins/applet/org.gnome.panel.applet.SeahorseAppletFactory.service.in b/plugins/applet/org.gnome.panel.applet.SeahorseAppletFactory.service.in
new file mode 100644
index 0000000..c5323fa
--- /dev/null
+++ b/plugins/applet/org.gnome.panel.applet.SeahorseAppletFactory.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.panel.applet.SeahorseAppletFactory
+Exec= LIBEXECDIR@/seahorse-applet
diff --git a/plugins/applet/seahorse-applet.c b/plugins/applet/seahorse-applet.c
index e82873b..ab8ef03 100644
--- a/plugins/applet/seahorse-applet.c
+++ b/plugins/applet/seahorse-applet.c
@@ -29,8 +29,6 @@
 
 #include <panel-applet.h>
 
-#include <bonobo.h>
-
 #include <dbus/dbus-glib-bindings.h>
 
 #include <cryptui.h>
@@ -283,7 +281,7 @@ static void about_dialog_activate_link_cb (GtkAboutDialog *about,
 }
 
 static void
-about_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const gchar *verbname)
+about_cb (GtkAction *action, SeahorseApplet *sapplet)
 {                   
     static gboolean been_here = FALSE;
     
@@ -680,7 +678,7 @@ win_destroyed (GtkWidget *widget, GdkEvent *event, SeahorseWidget *swidget)
 }
 
 void
-properties_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const char *verbname)
+properties_cb (GtkAction *action, SeahorseApplet *sapplet)
 {
     SeahorseWidget *swidget;
     GtkWidget *widget;
@@ -729,7 +727,7 @@ properties_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const char *verb
 }
 
 static void
-help_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const char *verbname)
+help_cb (GtkAction *action, SeahorseApplet *sapplet)
 {
 	gchar const *document = "ghelp:seahorse-applet";
 	GtkWidget *dialog;
@@ -992,18 +990,25 @@ seahorse_applet_class_init (SeahorseAppletClass *klass)
  * APPLET
  */
 
-static const BonoboUIVerb seahorse_applet_menu_verbs [] = {
-    BONOBO_UI_UNSAFE_VERB ("Props", properties_cb),
-    BONOBO_UI_UNSAFE_VERB ("Help", help_cb),
-    BONOBO_UI_UNSAFE_VERB ("About", about_cb),
-    BONOBO_UI_VERB_END
+static const GtkActionEntry seahorse_applet_menu_actions [] = {
+	{ "Props", GTK_STOCK_OPEN, N_("_Preferences"),
+	  NULL, NULL,
+	  G_CALLBACK (properties_cb) },
+	{ "Help", GTK_STOCK_HELP, N_("_Help"),
+	  NULL, NULL,
+	  G_CALLBACK (help_cb) },
+	{ "About", GTK_STOCK_ABOUT, N_("_About"),
+	  NULL, NULL,
+	  G_CALLBACK (about_cb) }
 };
 
 static gboolean
 seahorse_applet_fill (PanelApplet *applet)
 {
     SeahorseApplet *sapplet = SEAHORSE_APPLET (applet);
-    BonoboUIComponent *pcomp;
+    GtkAction	   *action;
+    GtkActionGroup *action_group;
+    gchar	   *ui_path;
 
     /* Insert Icons into Stock */ 
     seahorse_gtkstock_init ();
@@ -1011,17 +1016,26 @@ seahorse_applet_fill (PanelApplet *applet)
     g_return_val_if_fail (PANEL_IS_APPLET (applet), FALSE);
     gtk_widget_show_all (GTK_WIDGET (applet));
 
-    panel_applet_setup_menu_from_file (applet, UIDIR, "GNOME_SeahorseApplet.xml",
-                                       NULL, seahorse_applet_menu_verbs, sapplet);
-        
-    pcomp = panel_applet_get_popup_component (applet);
-
-    if (panel_applet_get_locked_down (applet))
-        bonobo_ui_component_set_prop (pcomp, "/commands/Props", "hidden", "1", NULL);    
+    action_group = gtk_action_group_new ("Seahorse Applet Actions");
+    gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+    gtk_action_group_add_actions (action_group,
+				  seahorse_applet_menu_actions,
+				  G_N_ELEMENTS (seahorse_applet_menu_actions),
+				  applet);
+    ui_path = g_build_filename (SEAHORSE_UIDIR, "seahorseapplet-menu.xml", NULL);
+    panel_applet_setup_menu_from_file (applet, ui_path, action_group);
+    g_free (ui_path);
+
+    if (panel_applet_get_locked_down (applet)) {
+        action = gtk_action_group_get_action (action_group, "Props");
+        gtk_action_set_visible (action, FALSE);
+    }
 
     update_icon (sapplet);
     seahorse_gconf_notify_lazy (APPLET_SCHEMAS, (GConfClientNotifyFunc)gconf_notify, 
                                 sapplet, GTK_WIDGET (applet));
+
+    g_object_unref (action_group);
     
     return TRUE;
 }
@@ -1031,7 +1045,7 @@ seahorse_applet_factory (PanelApplet *applet, const gchar *iid, gpointer data)
 {
     gboolean retval = FALSE;
 
-    if (!strcmp (iid, "OAFIID:GNOME_SeahorseApplet"))
+    if (!strcmp (iid, "SeahorseApplet"))
         retval = seahorse_applet_fill (applet); 
    
     if (retval == FALSE)
@@ -1058,9 +1072,6 @@ main (int argc, char *argv [])
 
     context = g_option_context_new ("");
     g_option_context_add_group (context, gtk_get_option_group (TRUE));
-    g_option_context_add_group (context, bonobo_activation_get_goption_group ());
-    
-    
 
     seahorse_secure_memory_init ();
     
@@ -1080,16 +1091,18 @@ main (int argc, char *argv [])
     
     gtk_init (&argc, &argv);
     
-    if (!bonobo_init (&argc, argv)) {
-        g_printerr ("Cannot initialize bonobo.\n");
-        return 1;
-    }
-    
-    retval =  panel_applet_factory_main ("OAFIID:GNOME_SeahorseApplet_Factory", 
-                                      SEAHORSE_TYPE_APPLET, seahorse_applet_factory, NULL);
+    retval =  panel_applet_factory_main ("SeahorseAppletFactory", TRUE,
+                                      SEAHORSE_TYPE_APPLET,
+                                      seahorse_applet_factory, NULL);
                                       
     g_option_context_free (context);
     
     return retval;
 
 }
+
+/*
+PANEL_APPLET_OUT_PROCESS_FACTORY ("SeahorseAppletFactory",
+                                      SEAHORSE_TYPE_APPLET, "SeahorseApplet",
+                                      seahorse_applet_factory, NULL);
+*/
diff --git a/plugins/applet/seahorseapplet-menu.xml b/plugins/applet/seahorseapplet-menu.xml
new file mode 100644
index 0000000..53d4bba
--- /dev/null
+++ b/plugins/applet/seahorseapplet-menu.xml
@@ -0,0 +1,3 @@
+<menuitem name="Item1" action="Props" />
+<menuitem name="Item3" action="Help" />
+<menuitem name="Item4" action="About" />
diff --git a/plugins/gedit/Makefile.am b/plugins/gedit/Makefile.am
index 4d2c70b..6f7a40f 100644
--- a/plugins/gedit/Makefile.am
+++ b/plugins/gedit/Makefile.am
@@ -16,11 +16,7 @@ INCLUDES = \
 
 plugin_LTLIBRARIES = libseahorse-pgp.la
 
-if WITH_GEDIT_BONOBO
-PLUGIN_SRCS = seahorse-gedit-bonobo.c
-else
 PLUGIN_SRCS = seahorse-gedit-plugin.c
-endif
 
 libseahorse_pgp_la_SOURCES = seahorse-gedit.c seahorse-gedit.h $(PLUGIN_SRCS)
 libseahorse_pgp_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
diff --git a/plugins/gedit/seahorse-gedit.h b/plugins/gedit/seahorse-gedit.h
index 5099032..299710e 100644
--- a/plugins/gedit/seahorse-gedit.h
+++ b/plugins/gedit/seahorse-gedit.h
@@ -33,10 +33,6 @@ GtkWindow*      seahorse_gedit_active_window    (void);
 void            seahorse_gedit_flash            (const gchar *format, ...);
 void            seahorse_gedit_show_error       (const gchar *heading, GError *error);
 
-#ifdef WITH_GEDIT_BONOBO
-#define SEAHORSE_GEDIT_DEBUG     gedit_debug 
-#else
 #define SEAHORSE_GEDIT_DEBUG     gedit_debug_message
-#endif
 
 #endif /* __SEAHORSE_GEDIT_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ae59934..dcfbc84 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,8 +19,7 @@ libseahorse/seahorse-prefs-cache.c
 [type: gettext/glade]libseahorse/seahorse-progress.xml
 libseahorse/seahorse-util.c
 libseahorse/seahorse-widget.c
-plugins/applet/GNOME_SeahorseApplet.server.in.in
-plugins/applet/GNOME_SeahorseApplet.xml
+plugins/applet/org.gnome.applets.SeahorseApplet.panel-applet.in.in
 plugins/applet/seahorse-applet.c
 [type: gettext/glade]plugins/applet/seahorse-applet-preferences.xml
 plugins/epiphany/seahorse.ephy-extension.in.in



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]