From a45f36c6fe40dc0ad76733db7a74ffcfc7e92f46 Mon Sep 17 00:00:00 2001 From: Davyd Madeley Date: Tue, 26 Oct 2004 13:06:59 +0000 Subject: Remove mailcheck, add new null_applet to deprecate mailcheck 2004-10-26 Davyd Madeley * 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 --- null_applet/ChangeLog | 7 + null_applet/GNOME_NullApplet_Factory.server.in.in | 35 +++++ null_applet/Makefile.am | 22 +++ null_applet/README | 22 +++ null_applet/null_applet.c | 169 ++++++++++++++++++++++ 5 files changed, 255 insertions(+) create mode 100644 null_applet/ChangeLog create mode 100644 null_applet/GNOME_NullApplet_Factory.server.in.in create mode 100644 null_applet/Makefile.am create mode 100644 null_applet/README create mode 100644 null_applet/null_applet.c (limited to 'null_applet') 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 + + * 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +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, + "%s" + "\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); -- cgit v1.2.3