[tracker/search-bar] tracker-search-bar: Added initial framework



commit c431419041a228f4011ffc038371081505c45fc6
Author: Martyn Russell <martyn lanedo com>
Date:   Thu Sep 17 16:23:03 2009 +0200

    tracker-search-bar: Added initial framework

 configure.ac                                       |   39 +++++++++++-
 src/Makefile.am                                    |    5 ++
 .../GNOME_Search_Bar_Applet.server.in.in           |   24 +++++++
 src/tracker-search-bar/Makefile.am                 |   65 ++++++++++++++++++++
 src/tracker-search-bar/tracker-search-bar.ui       |    8 +++
 src/tracker-search-bar/tracker-search-bar.vala     |   54 ++++++++++++++++
 6 files changed, 192 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4759a84..9fdc74c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,6 +802,36 @@ fi
 
 AM_CONDITIONAL(HAVE_TRACKER_EXPLORER, test "$have_tracker_explorer" = "yes")
 
+AC_ARG_ENABLE([tracker-search-bar],
+	      AS_HELP_STRING([--enable-tracker-search-bar],
+	                     [enable tracker-search-bar[[default=auto]]]),,
+	      [enable_tracker_search_bar=auto])
+
+if test "x$enable_tracker_search_bar" != "xno" ; then
+   PKG_CHECK_MODULES(TRACKER_SEARCH_BAR, [
+   		libgnomeui-2.0 
+   		libpanelapplet-2.0 
+		glib-2.0    >= $GLIB_REQUIRED
+		gtk+-2.0    >= $GTK_REQUIRED
+		dbus-1      >= $DBUS_REQUIRED
+		dbus-glib-1 >= $DBUS_REQUIRED
+		gee-1.0     >= $GEE_REQUIRED],
+		[have_tracker_search_bar=yes],
+		[have_tracker_search_bar=no])
+
+   AC_SUBST([TRACKER_SEARCH_BAR_CFLAGS])
+   AC_SUBST([TRACKER_SEARCH_BAR_LIBS])
+else
+   have_tracker_search_bar="no  (disabled)"
+fi
+
+if test "x$enable_tracker_search_bar" = "xyes"; then
+   if test "x$have_tracker_search_bar" != "xyes"; then
+      AC_MSG_ERROR([Couldn't find tracker-search-bar dependencies (glib-2.0 >= $GLIB_REQUIRED, gtk+-2.0 >= $GTK_REQUIRED, dbus-1 >= $DBUS_REQUIRED, dbus-glib-1 >= $DBUS_REQUIRED, gee-1.0 >= $GEE_REQUIRED, libpanelapplet-2.0 and libgnomeui-2.0).])
+   fi
+fi
+
+AM_CONDITIONAL(HAVE_TRACKER_SEARCH_BAR, test "$have_tracker_search_bar" = "yes")
 
 ##################################################################
 # Check for GNOME/GTK dependencies to build tracker search tool
@@ -1404,9 +1434,10 @@ AC_CONFIG_FILES([
 	src/tracker-miner-fs/Makefile
 	src/tracker-preferences/Makefile
 	src/tracker-preferences/tracker-preferences.desktop.in
+	src/tracker-search-bar/Makefile
 	src/tracker-search-tool/Makefile
-	src/tracker-explorer/Makefile
 	src/tracker-search-tool/tracker-search-tool.desktop.in
+	src/tracker-explorer/Makefile
 	src/tracker-utils/Makefile
 	src/plugins/Makefile
 	src/plugins/evolution/Makefile
@@ -1464,7 +1495,8 @@ Applications:
 	Build tracker-preferences:		$have_tracker_preferences
 	Build tracker-status-icon:              $have_tracker_status_icon
 	Build libtracker-gtk:			$have_libtrackergtk
-	Build tracker-explorer:	                $have_tracker_explorer
+	Build tracker-explorer:                 $have_tracker_explorer
+	Build tracker-search-bar:               $have_tracker_search_bar
 
 Metadata Extractors:
 
@@ -1495,4 +1527,5 @@ Warning:
 	$old_data_message
 	$old_file_action
 
-"
+
+"
\ No newline at end of file
diff --git a/src/Makefile.am b/src/Makefile.am
index 69e3b0f..01a67ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,10 +31,15 @@ if HAVE_TRACKER_SEARCH_TOOL
 SUBDIRS += tracker-search-tool
 endif
 
+if HAVE_TRACKER_SEARCH_BAR
+SUBDIRS += tracker-search-bar
+endif
+
 if HAVE_TRACKER_EXPLORER
 SUBDIRS += tracker-explorer
 endif
 
+
 DIST_SUBDIRS = 					\
 	libstemmer				\
 	libinotify				\
diff --git a/src/tracker-search-bar/GNOME_Search_Bar_Applet.server.in.in b/src/tracker-search-bar/GNOME_Search_Bar_Applet.server.in.in
new file mode 100644
index 0000000..389329d
--- /dev/null
+++ b/src/tracker-search-bar/GNOME_Search_Bar_Applet.server.in.in
@@ -0,0 +1,24 @@
+<oaf_info>
+
+    <oaf_server iid="OAFIID:GNOME_Search_Bar_Applet_Factory" type="exe" location="@LIBEXECDIR@/tracker-search-bar">
+        <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="Search Bar"/>
+        <oaf_attribute name="description" type="string" _value="Desktop search tool using Tracker"/>
+    </oaf_server>
+
+    <oaf_server iid="OAFIID:GNOME_Search_Bar_Applet" type="factory" location="OAFIID:GNOME_Search_Bar_Applet_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="Search Bar"/>
+        <oaf_attribute name="description" type="string" _value="Desktop search tool using Tracker"/>
+        <oaf_attribute name="panel:category" type="string" value="Utility"/>
+        <oaf_attribute name="panel:icon" type="string" value="computer.png"/>
+    </oaf_server>
+
+</oaf_info>
diff --git a/src/tracker-search-bar/Makefile.am b/src/tracker-search-bar/Makefile.am
new file mode 100644
index 0000000..38d11bb
--- /dev/null
+++ b/src/tracker-search-bar/Makefile.am
@@ -0,0 +1,65 @@
+include $(top_srcdir)/Makefile.decl
+
+libexec_PROGRAMS = tracker-search-bar
+
+tracker_search_bar_VALASOURCES = 				\
+	tracker-search-bar.vala
+
+tracker_search_bar_SOURCES = 					\
+	$(tracker_search_bar_VALASOURCES:.vala=.c)
+
+tracker_search_bar.vala.stamp: $(tracker_search_bar_VALASOURCES)
+	$(VALAC) -C -g --pkg gtk+-2.0 --pkg libgnomeui-2.0 --pkg libpanelapplet-2.0 $^
+	touch tracker_search_bar.vala.stamp
+
+tracker_search_bar_CFLAGS = \
+	-DTRACKER_UI_DIR=\"$(datadir)/tracker/\"		\
+	-DSRCDIR=\"$(abs_srcdir)/\"				\
+	$(WARN_CFLAGS)						\
+	$(GCOV_CFLAGS)						\
+	$(TRACKER_SEARCH_BAR_CFLAGS)
+
+tracker_search_bar_LDADD = 					\
+	$(GCOV_LIBS)						\
+	$(TRACKER_SEARCH_BAR_LIBS)
+
+uidir = $(datadir)/tracker
+ui_DATA = tracker-search-bar.ui
+
+# 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)
+
+# Misc data
+resourcesdir = $(pkgdatadir)
+resources_DATA =
+#	GNOME_Search_Bar_Applet.xml
+
+tracker_search_bar_dir = $(libexecdir)
+
+# Build rules
+ INTLTOOL_SERVER_RULE@
+ INTLTOOL_SCHEMAS_RULE@
+
+$(server_in_files): $(server_in_files:.server.in=.server.in.in)
+	sed -e "s|\ LIBEXECDIR\@|$(tracker_search_bar_dir)|" $< > $@
+
+BUILT_SOURCES = 						\
+	tracker_search_bar.vala.stamp
+
+EXTRA_DIST = 							\
+	$(tracker_search_bar_SOURCES) 				\
+	$(tracker_search_bar_VALASOURCES) 			\
+	$(resources_DATA)					\
+	tracker_search_bar.vala.stamp 				\
+	tracker-search-bar.ui					\
+	GNOME_Search_Bar_Applet.server.in.in
+
+MAINTAINERCLEANFILES = 						\
+	$(tracker_search_bar_SOURCES) 				\
+	tracker_search_bar.vala.stamp
+
+DISTCLEANFILES = 						\
+	$(server_DATA) 						\
+	$(server_in_files)
diff --git a/src/tracker-search-bar/tracker-search-bar.ui b/src/tracker-search-bar/tracker-search-bar.ui
new file mode 100644
index 0000000..c081dde
--- /dev/null
+++ b/src/tracker-search-bar/tracker-search-bar.ui
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkMenu" id="context_menu">
+    <property name="visible">True</property>
+  </object>
+</interface>
diff --git a/src/tracker-search-bar/tracker-search-bar.vala b/src/tracker-search-bar/tracker-search-bar.vala
new file mode 100644
index 0000000..c84e06f
--- /dev/null
+++ b/src/tracker-search-bar/tracker-search-bar.vala
@@ -0,0 +1,54 @@
+using Panel;
+
+public class MainApplet : Panel.Applet {
+
+    public static bool factory (Applet applet, string iid) {
+        ((MainApplet) applet).create ();
+        return true;
+    }
+
+    private void create () {
+        var label = new Gtk.Label ("Search:");
+        var entry = new Gtk.Entry ();
+        var hbox = new Gtk.HBox (false, 6);
+
+        hbox.add (label);
+        hbox.add (entry);
+        add (hbox);
+
+        string menu_definition = 
+            "<popup name=\"button3\">" +
+                "<menuitem debuname=\"About\" verb=\"About\" _label=\"_About...\" pixtype=\"stock\" pixname=\"gnome-stock-about\"/>" +
+            "</popup>";
+
+        var verb = BonoboUI.Verb ();
+        verb.cname = "About";
+        verb.cb = on_about_clicked;
+
+        var verbs = new BonoboUI.Verb[] { verb };
+        setup_menu (menu_definition, verbs, null);
+
+        show_all();
+    }
+        
+    private static void on_about_clicked (BonoboUI.Component component,
+                                          void* user_data, string cname) {
+        var dialog = new Gtk.MessageDialog (
+            null,
+            Gtk.DialogFlags.DESTROY_WITH_PARENT,
+            Gtk.MessageType.ERROR,
+            Gtk.ButtonsType.CLOSE,
+            "About");
+        dialog.secondary_text = "About dialog";
+        dialog.run ();
+        dialog.destroy ();
+    }
+
+    public static int main (string[] args) {
+        var program = Gnome.Program.init ("GNOME_Search_Bar_Applet", "0", Gnome.libgnomeui_module,
+                                          args, "sm-connect", false);
+        return Applet.factory_main ("OAFIID:GNOME_Search_Bar_Applet_Factory",
+                                    typeof (MainApplet), factory);
+    }
+}
+



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