[tracker/no-bonobo] tracker-search-bar: Don't use Bonobo
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/no-bonobo] tracker-search-bar: Don't use Bonobo
- Date: Wed, 29 Dec 2010 15:47:26 +0000 (UTC)
commit 683d383c1beb03ca7a165ad5a641ee153cddad27
Author: Martyn Russell <martyn lanedo com>
Date: Wed Dec 29 15:19:15 2010 +0000
tracker-search-bar: Don't use Bonobo
Fixes GB#600081, Get rid of Bonobo
This is an initial attempt and untested (don't have gnome-panel upgrade yet)
configure.ac | 2 +-
po/POTFILES.in | 3 +-
.../GNOME_Search_Bar_Applet.server.in.in | 24 -------
src/tracker-search-bar/GNOME_Search_Bar_Applet.xml | 7 --
src/tracker-search-bar/Makefile.am | 58 ++++++++++------
.../org.gnome.panel.SearchBar.panel-applet.in.in | 15 ++++
....gnome.panel.applet.SearchBarFactory.service.in | 3 +
src/tracker-search-bar/tracker-applet.c | 72 +++++++++++++-------
src/tracker-search-bar/tracker-search-bar-menu.xml | 1 +
9 files changed, 106 insertions(+), 79 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 59a2277..602f424 100644
--- a/configure.ac
+++ b/configure.ac
@@ -462,7 +462,7 @@ TRACKER_SEARCH_BAR_REQUIRED="glib-2.0 >= $GLIB_REQUIRED
dbus-1 >= $DBUS_REQUIRED
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
gee-1.0 >= $GEE_REQUIRED
- libpanelapplet-2.0"
+ libpanelapplet-3.0"
PKG_CHECK_MODULES(TRACKER_SEARCH_BAR, [$TRACKER_SEARCH_BAR_REQUIRED],
[have_tracker_search_bar=yes],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 208b77b..c958a8d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -37,8 +37,7 @@ src/tracker-needle/tracker-taglist.vala
src/tracker-needle/tracker-utils.vala
src/tracker-needle/tracker-view.vala
[type: gettext/glade]src/tracker-needle/tracker-needle.ui
-src/tracker-search-bar/GNOME_Search_Bar_Applet.server.in.in
-src/tracker-search-bar/GNOME_Search_Bar_Applet.xml
+src/tracker-search-bar/org.gnome.panel.SearchBar.panel-applet.in.in
src/tracker-search-bar/tracker-results-window.c
[type: gettext/glade]src/tracker-search-bar/tracker-search-bar.ui
src/tracker-status-icon/tracker-main.c
diff --git a/src/tracker-search-bar/Makefile.am b/src/tracker-search-bar/Makefile.am
index de8d25e..ac2810d 100644
--- a/src/tracker-search-bar/Makefile.am
+++ b/src/tracker-search-bar/Makefile.am
@@ -12,6 +12,8 @@ tracker_search_bar_SOURCES = \
tracker-utils.c \
tracker-utils.h
+# -DMENU_UI_DIR=\""$(xmluidir)"\"
+
tracker_search_bar_CFLAGS = \
$(BUILD_CFLAGS) \
-I$(top_srcdir)/src \
@@ -26,31 +28,45 @@ tracker_search_bar_LDADD = \
$(BUILD_LIBS) \
$(TRACKER_SEARCH_BAR_LIBS)
-uidir = $(datadir)/tracker
-ui_DATA = tracker-search-bar.ui
+# Panel applet
+appletdir = $(datadir)/gnome-panel/applets
+applet_in_files = org.gnome.panel.SearchBar.panel-applet.in
+applet_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
-# Panel applet bonobo stuff
-serverdir = $(libdir)/bonobo/servers
-server_in_files = GNOME_Search_Bar_Applet.server.in
-server_DATA = $(server_in_files:.server.in=.server)
+$(applet_in_files): $(applet_in_files).in Makefile
+ $(AM_V_GEN)sed \
+ -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+ -e "s|\ VERSION\@|$(PACKAGE_VERSION)|" \
+ $< > $@
-# Misc data
-resourcesdir = $(pkgdatadir)
-resources_DATA = \
- GNOME_Search_Bar_Applet.xml
+%.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
-# Build rules
- INTLTOOL_SERVER_RULE@
- INTLTOOL_SCHEMAS_RULE@
+# Applet UIs and menu
+uidir = $(pkgdatadir)
+ui_DATA = \
+ tracker-search-bar.ui \
+ tracker-search-bar-menu.xml
+
+# DBus service file
+servicedir = $(datadir)/dbus-1/services
+service_in_files = org.gnome.panel.applet.SearchBarFactory.service.in
+service_DATA = $(service_in_files:.service.in=.service)
-$(server_in_files): $(server_in_files:.server.in=.server.in.in)
- $(AM_V_GEN)sed -e "s|\ LIBEXECDIR\@|$(libexecdir)|" $< > $@
+org.gnome.panel.applet.SearchBarFactory.service: $(service_in_files)
+ $(AM_V_GEN)sed \
+ -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+ $< > $@
+# Distribution details
EXTRA_DIST = \
- $(resources_DATA) \
- tracker-search-bar.ui \
- GNOME_Search_Bar_Applet.server.in.in
+ org.gnome.panel.SearchBar.panel-applet.in \
+ $(applet_DATA) \
+ $(ui_DATA) \
+ $(service_in_files)
-DISTCLEANFILES = \
- $(server_DATA) \
- $(server_in_files)
+CLEANFILES = \
+ $(applet_DATA) \
+ $(applet_DATA).in \
+ $(service_DATA)
+
+ INTLTOOL_SCHEMAS_RULE@
diff --git a/src/tracker-search-bar/org.gnome.panel.SearchBar.panel-applet.in.in b/src/tracker-search-bar/org.gnome.panel.SearchBar.panel-applet.in.in
new file mode 100644
index 0000000..3eb80be
--- /dev/null
+++ b/src/tracker-search-bar/org.gnome.panel.SearchBar.panel-applet.in.in
@@ -0,0 +1,15 @@
+[Applet Factory]
+Id=SearchBarFactory
+Location= LIBEXECDIR@/tracker-search-bar
+_Name=Search Bar
+_Description=Find your data quickly using Tracker
+
+[SearchBar]
+_Name=Tracker Search Bar
+_Description=Find your data quickly using Tracker
+Icon=system-search
+BonoboId=OAFIID:GNOME_SearchBar
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=tracker
+X-GNOME-Bugzilla-Component=Applet / Search Bar
+X-GNOME-Bugzilla-Version= VERSION@
diff --git a/src/tracker-search-bar/org.gnome.panel.applet.SearchBarFactory.service.in b/src/tracker-search-bar/org.gnome.panel.applet.SearchBarFactory.service.in
new file mode 100644
index 0000000..3c18523
--- /dev/null
+++ b/src/tracker-search-bar/org.gnome.panel.applet.SearchBarFactory.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.panel.applet.SearchBarFactory
+Exec= LIBEXECDIR@/tracker-search-bar
diff --git a/src/tracker-search-bar/tracker-applet.c b/src/tracker-search-bar/tracker-applet.c
index 7bae087..831618f 100644
--- a/src/tracker-search-bar/tracker-applet.c
+++ b/src/tracker-search-bar/tracker-applet.c
@@ -20,6 +20,7 @@
#include "config.h"
#include <string.h>
+#include <stdlib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -30,19 +31,22 @@
#include "tracker-applet.h"
#include "tracker-results-window.h"
-static void applet_about_cb (BonoboUIComponent *uic,
- TrackerApplet *applet,
- const gchar *verb_name);
+static void applet_about_cb (GtkAction *action,
+ TrackerApplet *applet);
-static const BonoboUIVerb applet_menu_verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("about", applet_about_cb),
- BONOBO_UI_VERB_END
+static const GtkActionEntry applet_menu_actions[] = {
+ { "About",
+ GTK_STOCK_ABOUT,
+ N_("_About"),
+ NULL,
+ NULL,
+ G_CALLBACK (applet_about_cb)
+ }
};
static void
-applet_about_cb (BonoboUIComponent *uic,
- TrackerApplet *applet,
- const gchar *verb_name)
+applet_about_cb (GtkAction *action,
+ TrackerApplet *applet)
{
GObject *object;
GtkWidget *dialog;
@@ -314,6 +318,8 @@ applet_size_allocate_cb (GtkWidget *widget,
}
+#if 0
+
static void
applet_destroy_cb (BonoboObject *object,
TrackerApplet *applet)
@@ -346,26 +352,33 @@ applet_destroy_cb (BonoboObject *object,
g_free (applet);
}
+#endif
+
static gboolean
applet_new (PanelApplet *parent_applet)
{
TrackerApplet *applet;
GError *error = NULL;
GtkBuilder *builder;
- const gchar *filename;
+ GtkActionGroup *action_group;
+ gchar *ui_path;
builder = gtk_builder_new ();
- filename = PKGDATADIR "/tracker-search-bar.ui";
+ ui_path = g_build_filename (PKGDATADIR,
+ "tracker-search-bar.ui",
+ NULL);
- if (gtk_builder_add_from_file (builder, filename, &error) == 0) {
+ if (gtk_builder_add_from_file (builder, ui_path, &error) == 0) {
g_printerr ("Could not load builder file, %s", error->message);
g_error_free (error);
+ g_free (ui_path);
g_object_unref (builder);
return FALSE;
}
- g_print ("Added builder file:'%s'\n", filename);
+ g_print ("Added builder file:'%s'\n", ui_path);
+ g_free (ui_path);
applet = g_new0 (TrackerApplet, 1);
@@ -385,12 +398,20 @@ applet_new (PanelApplet *parent_applet)
panel_applet_set_background_widget (PANEL_APPLET (applet->parent),
GTK_WIDGET (applet->parent));
+ action_group = gtk_action_group_new ("Applet Actions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (action_group,
+ applet_menu_actions,
+ G_N_ELEMENTS (applet_menu_actions),
+ applet);
+ ui_path = g_build_filename (PKGDATADIR,
+ "tracker-search-bar-menu.xml",
+ NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (applet->parent),
- NULL,
- PKGDATADIR "/GNOME_Search_Bar_Applet.xml",
- NULL,
- applet_menu_verbs,
- applet);
+ ui_path,
+ action_group);
+ g_free (ui_path);
+ g_object_unref (action_group);
gtk_widget_show (applet->parent);
@@ -398,8 +419,11 @@ applet_new (PanelApplet *parent_applet)
G_CALLBACK (applet_size_allocate_cb), applet);
g_signal_connect (applet->parent, "change_orient",
G_CALLBACK (applet_change_orient_cb), applet);
+
+#if 0
g_signal_connect (panel_applet_get_control (PANEL_APPLET (applet->parent)), "destroy",
G_CALLBACK (applet_destroy_cb), applet);
+#endif
/* Initialise other modules */
@@ -415,7 +439,7 @@ applet_factory (PanelApplet *applet,
const gchar *iid,
gpointer data)
{
- if (!strcmp (iid, "OAFIID:GNOME_Search_Bar_Applet")) {
+ if (!strcmp (iid, "SearchBar")) {
g_print ("Creating applet\n");
return applet_new (applet);
}
@@ -426,8 +450,8 @@ applet_factory (PanelApplet *applet,
/*
* Generate the boilerplate to hook into GObject/Bonobo.
*/
-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_Search_Bar_Applet_Factory",
- PANEL_TYPE_APPLET,
- "GNOME_Search_Bar_Applet", PACKAGE_VERSION,
- applet_factory,
- NULL);
+PANEL_APPLET_OUT_PROCESS_FACTORY ("SearchBarFactory",
+ PANEL_TYPE_APPLET,
+ "SearchBar",
+ applet_factory,
+ NULL)
diff --git a/src/tracker-search-bar/tracker-search-bar-menu.xml b/src/tracker-search-bar/tracker-search-bar-menu.xml
new file mode 100644
index 0000000..473d533
--- /dev/null
+++ b/src/tracker-search-bar/tracker-search-bar-menu.xml
@@ -0,0 +1 @@
+<menuitem name="About" action="About" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]