1
/* -*- mode: C; c-basic-offset: 4 -*-
2
* Null Applet - The Applet Deprecation Applet
3
* Copyright (c) 2004, Davyd Madeley
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
* Davyd Madeley <davyd@madeley.id.au>
27
#include <glib/gi18n-lib.h>
29
#include <gconf/gconf-client.h>
30
#include "null_applet.h"
32
GType null_applet_get_type (void);
33
G_DEFINE_TYPE(NullApplet, null_applet, PANEL_TYPE_APPLET)
36
null_applet_class_init (NullAppletClass *klass)
41
null_applet_init (NullApplet *applet)
46
insert_oafiids (GHashTable *hash_table)
49
* Add OAFIID's and descriptions of deprecated applets here
51
g_hash_table_insert (hash_table,
52
"OAFIID:GNOME_MailcheckApplet", _("Inbox Monitor"));
53
g_hash_table_insert (hash_table,
54
"OAFIID:GNOME_CDPlayerApplet", _("CD Player"));
55
g_hash_table_insert (hash_table,
56
"OAFIID:GNOME_MixerApplet_Factory", _("Volume Control"));
57
g_hash_table_insert (hash_table,
58
"OAFIID:GNOME_MixerApplet", _("Volume Control"));
59
g_hash_table_insert (hash_table,
60
"OAFIID:GNOME_KeyboardApplet", _("Keyboard Indicator"));
64
response_cb (GtkWidget *dialog, gint arg1, gpointer user_data)
66
gtk_widget_destroy (dialog);
70
*get_all_applets (void)
75
char *key, *oafiid, *name;
76
GHashTable *hash_table;
80
hash_table = g_hash_table_new (g_str_hash, g_str_equal);
81
insert_oafiids (hash_table);
83
string = g_string_new ("");
85
client = gconf_client_get_default ();
87
gconf_client_suggest_sync (client, NULL);
89
list = gconf_client_all_dirs (client,
90
"/apps/panel/applets",
95
g_warning ("Error: %s", error->message);
100
for (l = list; l; l = l->next)
102
key = g_strdup_printf ("%s/bonobo_iid", (gchar *)l->data);
103
oafiid = gconf_client_get_string (client, key, &error);
106
g_warning ("Error: %s", error->message);
107
g_error_free (error);
114
name = g_hash_table_lookup (hash_table, oafiid);
117
gconf_client_recursive_unset (client, l->data,
118
GCONF_UNSET_INCLUDING_SCHEMA_NAMES,
122
g_warning ("Error: %s", error->message);
123
g_error_free (error);
126
g_string_append_printf (string,
135
g_hash_table_destroy (hash_table);
137
return g_string_free (string, FALSE);
141
applet_factory (PanelApplet *applet,
148
if (!g_str_equal (iid, "NullApplet"))
151
applet_list = get_all_applets ();
153
dialog = gtk_message_dialog_new_with_markup (NULL,
154
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
155
GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
156
"<span size=\"large\" weight=\"bold\">%s</span>"
157
"\n\n%s\n\n%s\n%s\n%s",
158
_("Some panel items are no longer available"),
159
_("One or more panel items (also referred to as applets"
160
") are no longer available in the GNOME desktop."),
161
_("These items will now be removed from your "
164
_("You will not receive this message again.")
167
g_free (applet_list);
169
g_signal_connect (G_OBJECT (dialog), "response",
170
G_CALLBACK (response_cb), applet);
172
gtk_widget_show_all (dialog);
177
PANEL_APPLET_OUT_PROCESS_FACTORY ("NullApplet",