summaryrefslogtreecommitdiff
path: root/null_applet
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2004-10-26 13:06:59 +0000
committerDavyd Madeley <davyd@src.gnome.org>2004-10-26 13:06:59 +0000
commita45f36c6fe40dc0ad76733db7a74ffcfc7e92f46 (patch)
tree7540a77854ff446bdc9ee46b4bc2c8a365472001 /null_applet
parentfb2ed5ae5f777c301083bdc80984ff404dcb88c3 (diff)
Remove mailcheck, add new null_applet to deprecate mailcheck
2004-10-26 Davyd Madeley <davyd@madeley.id.au> * Makefile.am: * configure.in: Remove mailcheck, add new null_applet to deprecate mailcheck A null_applet/*: null_applet: The Applet Deprecation Applet R mailcheck/*: The Inbox Monitor, may it Rest In Peace
Diffstat (limited to 'null_applet')
-rw-r--r--null_applet/ChangeLog7
-rw-r--r--null_applet/GNOME_NullApplet_Factory.server.in.in35
-rw-r--r--null_applet/Makefile.am22
-rw-r--r--null_applet/README22
-rw-r--r--null_applet/null_applet.c169
5 files changed, 255 insertions, 0 deletions
diff --git a/null_applet/ChangeLog b/null_applet/ChangeLog
new file mode 100644
index 000000000..175f06c4a
--- /dev/null
+++ b/null_applet/ChangeLog
@@ -0,0 +1,7 @@
+2004-10-26 Davyd Madeley <davyd@madeley.id.au>
+
+ * README:
+ * GNOME_NullApplet_Factory.server.in.in:
+ * Makefile.am:
+ * null_applet.c: Initial version: specifically for deprecating the
+ mailcheck applet.
diff --git a/null_applet/GNOME_NullApplet_Factory.server.in.in b/null_applet/GNOME_NullApplet_Factory.server.in.in
new file mode 100644
index 000000000..fb11b1f10
--- /dev/null
+++ b/null_applet/GNOME_NullApplet_Factory.server.in.in
@@ -0,0 +1,35 @@
+<oaf_info>
+
+<!-- null_applet factory -->
+<oaf_server iid="OAFIID:GNOME_NullApplet_Factory"
+ type="exe"
+ location="@LIBEXECDIR@/null_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="Null Applet Factory"/>
+ <oaf_attribute name="description" type="string" _value="Factory for deprecating applets"/>
+
+</oaf_server>
+
+<!-- mailcheck applet -->
+<oaf_server iid="OAFIID:GNOME_MailcheckApplet"
+ type="factory"
+ location="OAFIID:GNOME_NullApplet_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="Inbox Monitor (Deprecated)"/>
+ <oaf_attribute name="description" type="string" _value="Alert you when new mail arrives"/>
+ <oaf_attribute name="bugzilla:bugzilla" type="string" value="GNOME"/>
+ <oaf_attribute name="bugzilla:product" type="string" value="gnome-applets"/>
+ <oaf_attribute name="bugzilla:component" type="string" value="Mailcheck Applet"/>
+
+</oaf_server>
+
+</oaf_info>
diff --git a/null_applet/Makefile.am b/null_applet/Makefile.am
new file mode 100644
index 000000000..76881660c
--- /dev/null
+++ b/null_applet/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = -I. -I$(srcdir) \
+-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+$(GNOME_APPLETS_CFLAGS)
+
+libexec_PROGRAMS = null_applet
+
+null_applet_SOURCES = null_applet.c
+
+null_applet_LDADD = $(GNOME_APPLETS_LIBS)
+
+serverdir = $(libdir)/bonobo/servers
+server_in_files = GNOME_NullApplet_Factory.server.in
+server_DATA = $(server_in_files:.server.in=.server)
+
+$(server_in_files): $(server_in_files:.server.in=.server.in.in)
+ sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
+
+@INTLTOOL_SERVER_RULE@
+
+CLEANFILES = $(server_in_files) $(server_DATA)
+
+EXTRA_DIST = GNOME_NullApplet_Factory.server.in.in
diff --git a/null_applet/README b/null_applet/README
new file mode 100644
index 000000000..be4c8a706
--- /dev/null
+++ b/null_applet/README
@@ -0,0 +1,22 @@
+What the hell is a Null Applet?
+===============================
+
+The Null Applet is the Applet Deprecation Applet. It allows us to remove applets
+from a users configuration, without them getting cryptic messages about being
+unable to resolve things, and getting a raw dump of preferences (the panel likes
+to do this). In the future, the null applet will also be useful for when someone
+decides not to build one of the optional applets, to prevent them from seeing
+the same ugly message.
+
+How do I add an applet to Null Applet?
+======================================
+
+You'll need the factory from the oaf_server, copy that server to
+GNOME_NullApplet_Factory.server.in.in, set it's location to
+GNOME_NullApplet_Factory. Remove it's panel:icon attribute so that it doesn't
+appear in the add to panel list.
+
+Who wrote this abomination?
+===========================
+
+Blame Davyd Madeley <davyd@madeley.id.au>
diff --git a/null_applet/null_applet.c b/null_applet/null_applet.c
new file mode 100644
index 000000000..bcd217413
--- /dev/null
+++ b/null_applet/null_applet.c
@@ -0,0 +1,169 @@
+/* -*- 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:
+ * Davyd Madeley <davyd@madeley.id.au>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
+#include <panel-applet.h>
+
+static const char null_applet_iid[] = "OAFIID:GNOME_NullApplet";
+static const char factory_iid[] = "OAFIID:GNOME_NullApplet_Factory";
+
+static inline void
+insert_oafiids (GHashTable *hash_table)
+{
+ /*
+ * Add OAFIID's and descriptions of deprecated applets here
+ */
+ g_hash_table_insert (hash_table,
+ "OAFIID:GNOME_MailcheckApplet", "Inbox Monitor");
+}
+
+static gboolean already_running;
+
+static void
+response_cb (GtkWidget *dialog, gint arg1, gpointer user_data)
+{
+ PanelApplet *applet;
+
+ applet = PANEL_APPLET (user_data);
+
+ gtk_widget_destroy (dialog);
+}
+
+static char
+*get_all_applets (void)
+{
+ GConfClient *client;
+ GError *error;
+ GSList *list, *l, *applet_list;
+ char *key, *oafiid, *name;
+ GHashTable *hash_table;
+ GString *string;
+
+ error = NULL;
+ hash_table = g_hash_table_new (g_str_hash, g_str_equal);
+ insert_oafiids (hash_table);
+
+ string = g_string_new ("");
+
+ client = gconf_client_get_default ();
+
+ list = gconf_client_all_dirs (client,
+ "/apps/panel/profiles/default/applets",
+ &error);
+
+ if (error)
+ {
+ g_warning ("Error: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+
+ for (l = list; l; l = l->next)
+ {
+ key = g_strdup_printf ("%s/bonobo_iid", l->data);
+ oafiid = gconf_client_get_string (client, key, &error);
+ if (error)
+ {
+ g_warning ("Error: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ g_free (key);
+
+ name = g_hash_table_lookup (hash_table, oafiid);
+ if (name)
+ {
+ g_warning ("Deleting %s (%s) from config",
+ oafiid, name);
+ gconf_client_recursive_unset (client, l->data,
+ GCONF_UNSET_INCLUDING_SCHEMA_NAMES,
+ &error);
+ if (error)
+ {
+ g_warning ("Error: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ g_string_append_printf (string, " • %s\n", name);
+ }
+ g_free (oafiid);
+ g_free (l->data);
+ }
+
+ g_slist_free (list);
+ g_hash_table_destroy (hash_table);
+
+ return g_string_free (string, FALSE);
+}
+
+static gboolean
+applet_factory (PanelApplet *applet,
+ const char *iid,
+ gpointer user_data)
+{
+ char *applet_list;
+
+ if (already_running)
+ {
+ g_warning ("not first applet, ignoring");
+ return FALSE;
+ }
+ already_running = TRUE;
+ g_warning ("was given applet to handle\n");
+
+ applet_list = get_all_applets ();
+
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new_with_markup (NULL,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ "<span size=\"large\" weight=\"bold\">%s</span>"
+ "\n\n%s\n\n%s\n%s\n%s",
+ _("Some panel items are no longer available"),
+ _("One or more panel items (also referred to as applets"
+ ") are no longer available in the GNOME desktop."),
+ _("These items will now be removed from your "
+ "configuration:"),
+ applet_list,
+ _("You will not receive this message again.")
+ );
+
+ g_free (applet_list);
+
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (response_cb), applet);
+
+ gtk_widget_show_all (dialog);
+
+ return TRUE;
+}
+
+PANEL_APPLET_BONOBO_FACTORY (factory_iid,
+ PANEL_TYPE_APPLET,
+ "Null-Applet", "0",
+ applet_factory, NULL);