[gnome-applets] Port null_applet to the new libpanel-applet



commit 26620fdf483af6626c3ad1783e8a94635b720540
Author: Kjartan Maraas <kmaraas gnome org>
Date:   Sat Jan 8 22:17:17 2011 +0100

    Port null_applet to the new libpanel-applet

 null_applet/Makefile.am                            |   56 +++++++++-----------
 null_applet/null_applet.c                          |   33 +++++++-----
 null_applet/null_applet.h                          |   50 +++++++++++++++++
 ...org.gnome.applets.NullApplet.panel-applet.in.in |   15 +++++
 ...gnome.panel.applet.NullAppletFactory.service.in |    3 +
 5 files changed, 114 insertions(+), 43 deletions(-)
---
diff --git a/null_applet/Makefile.am b/null_applet/Makefile.am
index 2fe1d3e..b072b04 100644
--- a/null_applet/Makefile.am
+++ b/null_applet/Makefile.am
@@ -1,44 +1,40 @@
+applet_in_files = org.gnome.applets.NullApplet.panel-applet.in
+service_in_files = org.gnome.panel.applet.NullAppletFactory.service.in
+
 INCLUDES = 			\
 	-I.			\
 	-I$(srcdir)		\
-	$(GNOME_APPLETS_CFLAGS)
-
-## The null applet takes over if the mixer isn't built.
-if !BUILD_MIXER_APPLET
-mixer_server_in = GNOME_MixerApplet.server.in
-endif
+	$(GNOME_APPLETS3_CFLAGS)
 
 libexec_PROGRAMS = null_applet
 
-null_applet_SOURCES = null_applet.c
+null_applet_SOURCES = null_applet.c null_applet.h
+
+null_applet_LDADD = $(GNOME_APPLETS3_LIBS)
+
+appletdir = $(datadir)/gnome-panel/applets
+applet_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
 
-null_applet_LDADD = $(GNOME_APPLETS_LIBS)
+$(applet_in_files): $(applet_in_files).in Makefile
+	$(AM_V_GEN)sed \
+	    -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+	    -e "s|\ VERSION\@|$(PACKAGE_VERSION)|" \
+	    $< > $@
 
-serverdir = $(libdir)/bonobo/servers
-server_in_files =				\
-	GNOME_NullApplet_Factory.server.in	\
-	GNOME_CDPlayerApplet.server.in		\
-	GNOME_MailcheckApplet_Factory.server.in	\
-	GNOME_Panel_WirelessApplet.server.in	\
-	GNOME_KeyboardApplet.server.in		\
-	$(mixer_server_in)
-server_DATA = $(server_in_files:.server.in=.server)
+%.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
 
- INTLTOOL_SERVER_RULE@
+servicedir   = $(datadir)/dbus-1/services
+service_DATA = $(service_in_files:.service.in=.service)
 
-GNOME_NullApplet_Factory.server.in: GNOME_NullApplet_Factory.server.in.in
-	sed -e "s|\ LIBEXECDIR\@|$(libexecdir)|" $< > $@
+org.gnome.panel.applet.NullAppletFactory.service: $(service_in_files)
+	$(AM_V_GEN)sed \
+	    -e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
+	    $< > $@
 
-CLEANFILES = GNOME_NullApplet_Factory.server.in $(server_DATA)
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)
 
-## Note that the mixer applet server.in file is always distributed, but
-## note always used.
-EXTRA_DIST =					\
-	GNOME_NullApplet_Factory.server.in.in	\
-	GNOME_CDPlayerApplet.server.in		\
-	GNOME_MailcheckApplet_Factory.server.in	\
-	GNOME_Panel_WirelessApplet.server.in	\
-	GNOME_MixerApplet.server.in		\
-	GNOME_KeyboardApplet.server.in
+EXTRA_DIST = \
+	$(service_in_files) \
+	org.gnome.applets.NullApplet.panel-applet.in.in
 
 -include $(top_srcdir)/git.mk
diff --git a/null_applet/null_applet.c b/null_applet/null_applet.c
index b03521b..d6fb35d 100644
--- a/null_applet/null_applet.c
+++ b/null_applet/null_applet.c
@@ -24,11 +24,22 @@
 #include <config.h>
 #endif
 
+#include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
-#include <panel-applet.h>
+#include "null_applet.h"
 
-static const char factory_iid[] = "OAFIID:GNOME_NullApplet_Factory";
+G_DEFINE_TYPE(NullApplet, null_applet, PANEL_TYPE_APPLET)
+
+static void
+null_applet_class_init (NullAppletClass *klass)
+{
+}
+
+static void
+null_applet_init (NullApplet *applet)
+{
+}
 
 static inline void
 insert_oafiids (GHashTable *hash_table)
@@ -48,8 +59,6 @@ insert_oafiids (GHashTable *hash_table)
 			     "OAFIID:GNOME_KeyboardApplet", _("Keyboard Indicator"));
 }
 
-static gboolean already_running;
-
 static void
 response_cb (GtkWidget *dialog, gint arg1, gpointer user_data)
 {
@@ -135,11 +144,8 @@ applet_factory (PanelApplet *applet,
 	char *applet_list;
 	GtkWidget *dialog;
 
-	if (already_running)
-	{
-		return FALSE;
-	}
-	already_running = TRUE;
+	if (!g_str_equal (iid, "NullApplet"))
+	    return FALSE;
 
 	applet_list = get_all_applets ();
 
@@ -167,7 +173,8 @@ applet_factory (PanelApplet *applet,
 	return TRUE;
 }
 
-PANEL_APPLET_BONOBO_FACTORY (factory_iid,
-		PANEL_TYPE_APPLET,
-		"Null-Applet", "0",
-		applet_factory, NULL)
+PANEL_APPLET_OUT_PROCESS_FACTORY ("NullApplet",
+				  TYPE_NULL_APPLET,
+				  "null",
+				  applet_factory,
+				  NULL)
diff --git a/null_applet/null_applet.h b/null_applet/null_applet.h
new file mode 100644
index 0000000..1c5f5bf
--- /dev/null
+++ b/null_applet/null_applet.h
@@ -0,0 +1,50 @@
+/* -*- mode: C; c-basic-offset: 4 -*-
+ * Null Applet - The Applet Deprecation Applet
+ * Copyright (c) 2004, Davyd Madeley
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author:
+ *   Rodrigo Moya <rodrigo gnome org>
+ */
+
+#ifndef __NULL_APPLET_H
+#define __NULL_APPLET_H
+
+#include <panel-applet.h>
+
+G_BEGIN_DECLS
+
+#define TYPE_NULL_APPLET           (null_applet_get_type ())
+#define NULL_APPLET(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NULL_APPLET, NullApplet))
+#define NULL_APPLET_CLASS(obj)     (G_TYPE_CHECK_CLASS_CAST    ((obj), TYPE_NULL_APPLET, NullAppletClass))
+#define IS_NULL_APPLET(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NULL_APPLET))
+#define IS_NULL_APPLET_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE    ((obj), TYPE_NULL_APPLET))
+#define NULL_APPLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS  ((obj), TYPE_NULL_APPLET, NullAppletClass))
+
+typedef struct _NullApplet      NullApplet;
+typedef struct _NullAppletClass NullAppletClass;
+
+struct _NullApplet {
+  PanelApplet parent;
+};
+
+struct _NullAppletClass {
+  PanelAppletClass parent_class;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/null_applet/org.gnome.applets.NullApplet.panel-applet.in.in b/null_applet/org.gnome.applets.NullApplet.panel-applet.in.in
new file mode 100644
index 0000000..b349511
--- /dev/null
+++ b/null_applet/org.gnome.applets.NullApplet.panel-applet.in.in
@@ -0,0 +1,15 @@
+[Applet Factory]
+Id=NullAppletFactory
+Location= LIBEXECDIR@/null_applet
+_Name=Null Applet Factory
+_Description=Null Applet Factory
+
+[NullApplet]
+_Name=Null applet
+_Description=Check for obsolete applets
+BonoboId=OAFIID:GNOME_MailcheckApplet;OAFIID:GNOME_CDPlayerApplet;OAFIID:GNOME_MixerApplet_Factory;OAFIID:GNOME_MixerApplet;OAFIID:GNOME_KeyboardApplet;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-applets
+X-GNOME-Bugzilla-Component=null
+X-GNOME-Bugzilla-Version= VERSION@
+X-GNOME-Bugzilla-OtherBinaries=null_applet
diff --git a/null_applet/org.gnome.panel.applet.NullAppletFactory.service.in b/null_applet/org.gnome.panel.applet.NullAppletFactory.service.in
new file mode 100644
index 0000000..49f8d40
--- /dev/null
+++ b/null_applet/org.gnome.panel.applet.NullAppletFactory.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.panel.applet.NullAppletFactory
+Exec= LIBEXECDIR@/null_applet



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