From 312ba610a1e98fc656fb58178227d7d45a64494e Mon Sep 17 00:00:00 2001 From: Perberos Date: Mon, 14 Nov 2011 18:24:48 -0300 Subject: initial --- null_applet/MATE_CDPlayerApplet.server.in | 20 +++ null_applet/MATE_KeyboardApplet.server.in | 22 +++ null_applet/MATE_MailcheckApplet_Factory.server.in | 20 +++ null_applet/MATE_MixerApplet.server.in | 22 +++ null_applet/MATE_NullApplet_Factory.server.in.in | 17 ++ null_applet/MATE_Panel_WirelessApplet.server.in | 22 +++ null_applet/Makefile.am | 44 ++++++ null_applet/README | 29 ++++ null_applet/null_applet.c | 173 +++++++++++++++++++++ 9 files changed, 369 insertions(+) create mode 100644 null_applet/MATE_CDPlayerApplet.server.in create mode 100644 null_applet/MATE_KeyboardApplet.server.in create mode 100644 null_applet/MATE_MailcheckApplet_Factory.server.in create mode 100644 null_applet/MATE_MixerApplet.server.in create mode 100644 null_applet/MATE_NullApplet_Factory.server.in.in create mode 100644 null_applet/MATE_Panel_WirelessApplet.server.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/MATE_CDPlayerApplet.server.in b/null_applet/MATE_CDPlayerApplet.server.in new file mode 100644 index 00000000..5865a8bf --- /dev/null +++ b/null_applet/MATE_CDPlayerApplet.server.in @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/null_applet/MATE_KeyboardApplet.server.in b/null_applet/MATE_KeyboardApplet.server.in new file mode 100644 index 00000000..58f7a612 --- /dev/null +++ b/null_applet/MATE_KeyboardApplet.server.in @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/null_applet/MATE_MailcheckApplet_Factory.server.in b/null_applet/MATE_MailcheckApplet_Factory.server.in new file mode 100644 index 00000000..f32a300c --- /dev/null +++ b/null_applet/MATE_MailcheckApplet_Factory.server.in @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/null_applet/MATE_MixerApplet.server.in b/null_applet/MATE_MixerApplet.server.in new file mode 100644 index 00000000..54b6f6e9 --- /dev/null +++ b/null_applet/MATE_MixerApplet.server.in @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/null_applet/MATE_NullApplet_Factory.server.in.in b/null_applet/MATE_NullApplet_Factory.server.in.in new file mode 100644 index 00000000..9efe3523 --- /dev/null +++ b/null_applet/MATE_NullApplet_Factory.server.in.in @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/null_applet/MATE_Panel_WirelessApplet.server.in b/null_applet/MATE_Panel_WirelessApplet.server.in new file mode 100644 index 00000000..49a20387 --- /dev/null +++ b/null_applet/MATE_Panel_WirelessApplet.server.in @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/null_applet/Makefile.am b/null_applet/Makefile.am new file mode 100644 index 00000000..c43e0027 --- /dev/null +++ b/null_applet/Makefile.am @@ -0,0 +1,44 @@ +INCLUDES = \ + -I. \ + -I$(srcdir) \ + $(MATE_APPLETS_CFLAGS) + +## The null applet takes over if the mixer isn't built. +if !BUILD_MIXER_APPLET +mixer_server_in = MATE_MixerApplet.server.in +endif + +libexec_PROGRAMS = null_applet + +null_applet_SOURCES = null_applet.c + +null_applet_LDADD = $(MATE_APPLETS_LIBS) + +serverdir = $(libdir)/matecomponent/servers +server_in_files = \ + MATE_NullApplet_Factory.server.in \ + MATE_CDPlayerApplet.server.in \ + MATE_MailcheckApplet_Factory.server.in \ + MATE_Panel_WirelessApplet.server.in \ + MATE_KeyboardApplet.server.in \ + $(mixer_server_in) +server_DATA = $(server_in_files:.server.in=.server) + +@INTLTOOL_SERVER_RULE@ + +MATE_NullApplet_Factory.server.in: MATE_NullApplet_Factory.server.in.in + sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ + +CLEANFILES = MATE_NullApplet_Factory.server.in $(server_DATA) + +## Note that the mixer applet server.in file is always distributed, but +## note always used. +EXTRA_DIST = \ + MATE_NullApplet_Factory.server.in.in \ + MATE_CDPlayerApplet.server.in \ + MATE_MailcheckApplet_Factory.server.in \ + MATE_Panel_WirelessApplet.server.in \ + MATE_MixerApplet.server.in \ + MATE_KeyboardApplet.server.in + +-include $(top_srcdir)/git.mk diff --git a/null_applet/README b/null_applet/README new file mode 100644 index 00000000..fc1996c5 --- /dev/null +++ b/null_applet/README @@ -0,0 +1,29 @@ +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? +====================================== + +Copy the original .server.in.in file over and rename to a .server.in file, +remove the factory, set its location to MATE_NullApplet_Factory and +remove the panel:icon attribute that it doesn't appear in the add to +panel list. + +Why is the Wireless Applet .server file here? +============================================= + +The wireless applet was deprecated in favour of mate-netstatus, but we +still install a .server file of the same name pointing the old applet +id at the netstatus applet. + +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 00000000..7b3e2e55 --- /dev/null +++ b/null_applet/null_applet.c @@ -0,0 +1,173 @@ +/* -*- 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 factory_iid[] = "OAFIID:MATE_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:MATE_MailcheckApplet", _("Inbox Monitor")); + g_hash_table_insert (hash_table, + "OAFIID:MATE_CDPlayerApplet", _("CD Player")); + g_hash_table_insert (hash_table, + "OAFIID:MATE_MixerApplet_Factory", _("Volume Control")); + g_hash_table_insert (hash_table, + "OAFIID:MATE_MixerApplet", _("Volume Control")); + g_hash_table_insert (hash_table, + "OAFIID:MATE_KeyboardApplet", _("Keyboard Indicator")); +} + +static gboolean already_running; + +static void +response_cb (GtkWidget *dialog, gint arg1, gpointer user_data) +{ + gtk_widget_destroy (dialog); +} + +static char +*get_all_applets (void) +{ + MateConfClient *client; + GError *error; + GSList *list, *l; + 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 = mateconf_client_get_default (); + + mateconf_client_suggest_sync (client, NULL); + + list = mateconf_client_all_dirs (client, + "/apps/panel/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/matecomponent_iid", (gchar *)l->data); + oafiid = mateconf_client_get_string (client, key, &error); + if (error) + { + g_warning ("Error: %s", error->message); + g_error_free (error); + error = NULL; + } + g_free (key); + + if (oafiid) + { + name = g_hash_table_lookup (hash_table, oafiid); + if (name) + { + mateconf_client_recursive_unset (client, l->data, + MATECONF_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 (MatePanelApplet *applet, + const char *iid, + gpointer user_data) +{ + char *applet_list; + GtkWidget *dialog; + + if (already_running) + { + return FALSE; + } + already_running = TRUE; + + applet_list = get_all_applets (); + + 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 MATE 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; +} + +MATE_PANEL_APPLET_MATECOMPONENT_FACTORY (factory_iid, + PANEL_TYPE_APPLET, + "Null-Applet", "0", + applet_factory, NULL) -- cgit v1.2.1