On Sat, May 26, 2007 at 10:39:43AM +0200, Josselin Mouette wrote:
> Le vendredi 25 mai 2007 à 23:40 +0200, Mathias Katzer a écrit :
> > Hello,
> >
> > with this change in gnome-applets/null_applet/null_applet.c I don't see the
> > dialog any more.
>
> I don't know what you are trying to do, but I don't understand how this
> patch could possibly work.
>
> Hint: in C, parameters are passed as values, not addresses.
Sorry I shouldn't have posted this, it was a bit too late yesterday.
I got the dialog without any not-available-applets listed (as seems to be
the case for the original reporter), so that is why I put in that counter.
It helps if implemented correctly, but I am pretty sure that it is a band aid
solution since I am not a gnome expert. That is why I post this again, after
testing back and forth ;-).
--- gnome-applets-2.14.3.orig/null_applet/null_applet.c 2005-11-16 16:50:43.000000000 +0100
+++ gnome-applets-2.14.3/null_applet/null_applet.c 2007-05-26 21:08:10.000000000 +0200
@@ -51,7 +51,7 @@ response_cb (GtkWidget *dialog, gint arg
}
static char
-*get_all_applets (void)
+*get_all_applets ( gint * missing )
{
GConfClient *client;
GError *error;
@@ -81,6 +81,8 @@ static char
error = NULL;
}
+ *missing = 0;
+
for (l = list; l; l = l->next)
{
key = g_strdup_printf ("%p/bonobo_iid", l->data);
@@ -111,6 +113,7 @@ static char
}
g_string_append_printf (string,
" ⢠%s\n", name);
+ (*missing)++;
}
g_free (oafiid);
}
@@ -131,6 +134,8 @@ applet_factory (PanelApplet *applet,
char *applet_list;
GtkWidget *dialog;
+ gint missing;
+
if (already_running)
{
g_warning ("not first applet, ignoring");
@@ -139,7 +144,10 @@ applet_factory (PanelApplet *applet,
already_running = TRUE;
g_warning ("was given applet to handle\n");
- applet_list = get_all_applets ();
+ applet_list = get_all_applets ( &missing );
+
+ if( missing )
+ {
dialog = gtk_message_dialog_new_with_markup (NULL,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -161,7 +169,10 @@ applet_factory (PanelApplet *applet,
G_CALLBACK (response_cb), applet);
gtk_widget_show_all (dialog);
-
+ }
+ else
+ g_free (applet_list);
+
return TRUE;
}