Commit 75e962ee authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

set window icon

Tue Feb 05 17:48:58 2002  George Lebl <jirka@5z.com>

	* gnome-run.c: set window icon

	* menu-util.c: remove the applets sub from the default menu flags

	* menu.c: About box fixups, use a logo, add documentors, fix
	  translation credits, and use the comment for the commie mode
	  paragraph.  Use the standard defaults when adding a menu.
	  When saving a ditem in the timeout, save the error and display
	  it in an error dialog when we close the property window.
	  Add more descriptive standard menu tooltips.  When there is
	  no full menu name use the directory basename rather then "Menu".
	  Translate the things from the bonobo server entry.  Use
	  a lazy hash for category->icon lookups, and use untranslated
	  category name to lookup icons.  Use standard panel error
	  dialog api for 'only one foobar' dialog.

	* panel-widget.c: unused var warning

	* xstuff.c: fix possible race (I'm anal, perhaps it's not a race
	  at all in fact, but it's not there anymore)
parent 538f5258
Tue Feb 05 17:48:58 2002 George Lebl <jirka@5z.com>
* gnome-run.c: set window icon
* menu-util.c: remove the applets sub from the default menu flags
* menu.c: About box fixups, use a logo, add documentors, fix
translation credits, and use the comment for the commie mode
paragraph. Use the standard defaults when adding a menu.
When saving a ditem in the timeout, save the error and display
it in an error dialog when we close the property window.
Add more descriptive standard menu tooltips. When there is
no full menu name use the directory basename rather then "Menu".
Translate the things from the bonobo server entry. Use
a lazy hash for category->icon lookups, and use untranslated
category name to lookup icons. Use standard panel error
dialog api for 'only one foobar' dialog.
* panel-widget.c: unused var warning
* xstuff.c: fix possible race (I'm anal, perhaps it's not a race
at all in fact, but it's not there anymore)
2002-02-05 Mark McLoughlin <mark@skynet.ie> 2002-02-05 Mark McLoughlin <mark@skynet.ie>
* panel.c: (panel_session_init_panels): audit use of * panel.c: (panel_session_init_panels): audit use of
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <libgnome/libgnome.h> #include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h> #include <libgnomeui/libgnomeui.h>
#include <libgnomeui/gnome-window-icon.h>
#include "gnome-run.h" #include "gnome-run.h"
...@@ -307,6 +308,9 @@ run_dialog_response (GtkWidget *w, int response, gpointer data) ...@@ -307,6 +308,9 @@ run_dialog_response (GtkWidget *w, int response, gpointer data)
} else if (strcmp (s, "gegls from outer space") == 0) { } else if (strcmp (s, "gegls from outer space") == 0) {
start_geginv (); start_geginv ();
goto return_and_close; goto return_and_close;
} else if (strcmp (s, "End world hunger") == 0) {
gnome_url_show ("http://www.wfp.org", NULL);
goto return_and_close;
} }
/* Somewhat of a hack I suppose */ /* Somewhat of a hack I suppose */
...@@ -1146,10 +1150,8 @@ show_run_dialog (void) ...@@ -1146,10 +1150,8 @@ show_run_dialog (void)
gtk_window_set_default_size (GTK_WINDOW (run_dialog), gtk_window_set_default_size (GTK_WINDOW (run_dialog),
-1, 400); -1, 400);
#ifdef FIXME
gnome_window_icon_set_from_file (GTK_WINDOW (run_dialog), gnome_window_icon_set_from_file (GTK_WINDOW (run_dialog),
GNOME_ICONDIR"/gnome-run.png"); GNOME_ICONDIR"/gnome-run.png");
#endif
g_signal_connect(G_OBJECT(run_dialog), "destroy", g_signal_connect(G_OBJECT(run_dialog), "destroy",
G_CALLBACK(gtk_widget_destroyed), G_CALLBACK(gtk_widget_destroyed),
&run_dialog); &run_dialog);
......
...@@ -173,7 +173,7 @@ get_default_menu_flags (void) ...@@ -173,7 +173,7 @@ get_default_menu_flags (void)
{ {
DistributionType distribution = get_distribution_type(); DistributionType distribution = get_distribution_type();
int flags = MAIN_MENU_SYSTEM_SUB | MAIN_MENU_APPLETS_SUB | int flags = MAIN_MENU_SYSTEM_SUB |
MAIN_MENU_PANEL_SUB | MAIN_MENU_DESKTOP; MAIN_MENU_PANEL_SUB | MAIN_MENU_DESKTOP;
/*guess distribution menus*/ /*guess distribution menus*/
......
...@@ -245,6 +245,9 @@ about_cb (GtkWidget *widget, gpointer data) ...@@ -245,6 +245,9 @@ about_cb (GtkWidget *widget, gpointer data)
{ {
static GtkWidget *about; static GtkWidget *about;
GtkWidget *hbox, *l; GtkWidget *hbox, *l;
GdkPixbuf *logo;
GString *comment;
char *logo_file;
/* FIXME: fill in all the wankers who did stuff */ /* FIXME: fill in all the wankers who did stuff */
char *authors[] = { char *authors[] = {
"George Lebl (jirka@5z.com)", "George Lebl (jirka@5z.com)",
...@@ -270,12 +273,15 @@ about_cb (GtkWidget *widget, gpointer data) ...@@ -270,12 +273,15 @@ about_cb (GtkWidget *widget, gpointer data)
NULL NULL
}; };
char *documenters[] = { char *documenters[] = {
/* FIXME: */ "Dave Mason (dcm@redhat.com)",
"Joe Documentor", "Dan Mueth (d-mueth@uchicago.edu)",
"Alexander Kirillov (kirillov@math.sunysb.edu)",
NULL NULL
}; };
/* Translator credits */
char *translator_credits = _("translator_credits");
if (about) { if (about != NULL) {
gtk_window_present (GTK_WINDOW (about)); gtk_window_present (GTK_WINDOW (about));
return; return;
} }
...@@ -289,16 +295,38 @@ about_cb (GtkWidget *widget, gpointer data) ...@@ -289,16 +295,38 @@ about_cb (GtkWidget *widget, gpointer data)
} }
} }
#endif #endif
logo = NULL;
logo_file = panel_pixmap_discovery ("gnome-gegl2.png",
FALSE /* fallback */);
if (logo_file != NULL) {
logo = gdk_pixbuf_new_from_file (logo_file, NULL /* error */);
g_free (logo_file);
}
comment = g_string_new (_("This program is responsible for launching "
"other applications, embedding small applets "
"within itself, world peace, and random X crashes."));
if (commie_mode) {
g_string_append (comment,
_("\n\nRunning in \"Lockdown\" mode. This "
"means your system administrator has "
"prohibited any changes to the panel's "
"configuration to take place."));
}
about = gnome_about_new ( _("The GNOME Panel"), VERSION, about = gnome_about_new ( _("The GNOME Panel"), VERSION,
_("(C) 1997-2002 the Free Software Foundation"), _("(C) 1997-2002 the Free Software Foundation"),
_("This program is responsible for launching " comment->str,
"other applications, embedding small applets "
"within itself, world peace, and random X crashes."),
(const char **)authors, (const char **)authors,
(const char **)documenters, (const char **)documenters,
"foo" /* FIXME: ??? translator_credits */, strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
NULL /* FIXME: logo "gnome-gegl2.png" */); logo);
g_object_unref (G_OBJECT (logo));
g_string_free (comment, TRUE);
gtk_window_set_wmclass (GTK_WINDOW (about), "about_dialog", "Panel"); gtk_window_set_wmclass (GTK_WINDOW (about), "about_dialog", "Panel");
g_signal_connect (G_OBJECT (about), "destroy", g_signal_connect (G_OBJECT (about), "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
...@@ -314,16 +342,6 @@ about_cb (GtkWidget *widget, gpointer data) ...@@ -314,16 +342,6 @@ about_cb (GtkWidget *widget, gpointer data)
hbox, TRUE, FALSE, 0); hbox, TRUE, FALSE, 0);
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
if (commie_mode) {
l = gtk_label_new (_("Running in \"Lockdown\" mode. This "
"means your system administrator has "
"prohibited any changes to the panel's "
"configuration to take place."));
gtk_widget_show (l);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox),
l, FALSE, FALSE, 0);
}
gtk_widget_show (about); gtk_widget_show (about);
} }
...@@ -1216,17 +1234,7 @@ add_menu_to_panel (GtkWidget *widget, gpointer data) ...@@ -1216,17 +1234,7 @@ add_menu_to_panel (GtkWidget *widget, gpointer data)
const char *menudir = data; const char *menudir = data;
gboolean main_menu; gboolean main_menu;
PanelWidget *panel; PanelWidget *panel;
DistributionType distribution = get_distribution_type (); int flags = get_default_menu_flags ();
int flags = MAIN_MENU_SYSTEM_SUB | MAIN_MENU_APPLETS_SUB |
MAIN_MENU_PANEL_SUB | MAIN_MENU_DESKTOP_SUB;
/*guess distribution menus*/
if (distribution != DISTRIBUTION_UNKNOWN)
flags |= MAIN_MENU_DISTRIBUTION_SUB;
/*guess KDE menus*/
if (g_file_test (kde_menudir, G_FILE_TEST_IS_DIR))
flags |= MAIN_MENU_KDE_SUB;
panel = get_panel_from_menu_data (widget, TRUE); panel = get_panel_from_menu_data (widget, TRUE);
...@@ -1318,6 +1326,7 @@ ditem_properties_apply_timeout (gpointer data) ...@@ -1318,6 +1326,7 @@ ditem_properties_apply_timeout (gpointer data)
GtkWidget *dedit = data; GtkWidget *dedit = data;
GnomeDesktopItem *ditem; GnomeDesktopItem *ditem;
const char *loc; const char *loc;
GError *error = NULL;
g_object_set_data (G_OBJECT (dedit), "apply_timeout", NULL); g_object_set_data (G_OBJECT (dedit), "apply_timeout", NULL);
...@@ -1326,10 +1335,17 @@ ditem_properties_apply_timeout (gpointer data) ...@@ -1326,10 +1335,17 @@ ditem_properties_apply_timeout (gpointer data)
gnome_desktop_item_save (ditem, gnome_desktop_item_save (ditem,
loc /* under */, loc /* under */,
TRUE /* force */, TRUE /* force */,
NULL /* error */); &error);
/* FIXME: we don't want to really handle errors here though, /* save the error for later */
* only on OK, but make sure that we know by the time we if (error != NULL) {
* hit OK that something went wrong here */ g_object_set_data_full (G_OBJECT (dedit), "SavingError",
g_strdup (error->message),
(GDestroyNotify) g_free);
g_clear_error (&error);
} else {
g_object_set_data (G_OBJECT (dedit), "SavingError", NULL);
}
gnome_desktop_item_unref (ditem); gnome_desktop_item_unref (ditem);
return FALSE; return FALSE;
...@@ -1366,6 +1382,7 @@ static void ...@@ -1366,6 +1382,7 @@ static void
ditem_properties_close (GtkWidget *widget, gpointer data) ditem_properties_close (GtkWidget *widget, gpointer data)
{ {
GtkWidget *dedit = data; GtkWidget *dedit = data;
const char *saving_error;
gpointer timeout_data = g_object_get_data (G_OBJECT (dedit), gpointer timeout_data = g_object_get_data (G_OBJECT (dedit),
"apply_timeout"); "apply_timeout");
guint timeout = GPOINTER_TO_UINT (timeout_data); guint timeout = GPOINTER_TO_UINT (timeout_data);
...@@ -1377,6 +1394,14 @@ ditem_properties_close (GtkWidget *widget, gpointer data) ...@@ -1377,6 +1394,14 @@ ditem_properties_close (GtkWidget *widget, gpointer data)
ditem_properties_apply_timeout (dedit); ditem_properties_apply_timeout (dedit);
} }
saving_error = g_object_get_data (G_OBJECT (dedit), "SavingError");
if (saving_error != NULL) {
panel_error_dialog ("cant_save_entry",
_("<b>Cannot save changes to menu entry</b>\n\n"
"Details: %s"), saving_error);
}
} }
static gboolean static gboolean
...@@ -2415,6 +2440,7 @@ create_menu_at_fr (GtkWidget *menu, ...@@ -2415,6 +2440,7 @@ create_menu_at_fr (GtkWidget *menu,
GtkWidget *menuitem; GtkWidget *menuitem;
MenuFinfo *mf = NULL; MenuFinfo *mf = NULL;
DirRec *dr = (DirRec *)fr; DirRec *dr = (DirRec *)fr;
char *menubase;
g_return_val_if_fail(!(fr&&fr->type!=FILE_REC_DIR),menu); g_return_val_if_fail(!(fr&&fr->type!=FILE_REC_DIR),menu);
...@@ -2424,12 +2450,14 @@ create_menu_at_fr (GtkWidget *menu, ...@@ -2424,12 +2450,14 @@ create_menu_at_fr (GtkWidget *menu,
/* unfilled out, but the pointer will be correct */ /* unfilled out, but the pointer will be correct */
mf = g_new0 (MenuFinfo, 1); mf = g_new0 (MenuFinfo, 1);
menubase = g_path_get_basename (fr->name);
/*get this info ONLY if we haven't gotten it already*/ /*get this info ONLY if we haven't gotten it already*/
if (dir_name == NULL) if (dir_name == NULL)
dir_name = (fr != NULL && fr->fullname != NULL) dir_name = (fr != NULL && fr->fullname != NULL)
? fr->fullname ? fr->fullname
: _("Menu"); : menubase;
if (pixmap_name == NULL) if (pixmap_name == NULL)
pixmap_name = (fr != NULL && fr->icon != NULL) pixmap_name = (fr != NULL && fr->icon != NULL)
? fr->icon ? fr->icon
...@@ -2495,6 +2523,8 @@ create_menu_at_fr (GtkWidget *menu, ...@@ -2495,6 +2523,8 @@ create_menu_at_fr (GtkWidget *menu,
g_object_set_data (G_OBJECT (menu), "mf", mfl); g_object_set_data (G_OBJECT (menu), "mf", mfl);
g_free (menubase);
return menu; return menu;
} }
...@@ -2545,28 +2575,28 @@ menu_deactivate (GtkWidget *w, gpointer data) ...@@ -2545,28 +2575,28 @@ menu_deactivate (GtkWidget *w, gpointer data)
menu->age = 0; menu->age = 0;
} }
/*
* FIXME: figure out how to handle internationalised strings.
* FIXME: lazily create a hashtable
*/
static const gchar * static const gchar *
applet_menu_get_category_icon (const gchar *category) applet_menu_get_category_icon (const gchar *untranslated_category)
{ {
if (!strcmp (category, "Amusements")) { static GHashTable *hash = NULL;
return "gnome-amusements.png";
} else if (!strcmp (category, "Clocks")) { if (hash == NULL) {
return "gnome-clock.png"; hash = g_hash_table_new (g_str_hash, g_str_equal);
} else if (!strcmp (category, "Monitors")) { g_hash_table_insert (hash,
return "gnome-monitor.png"; "Amusements", "gnome-amusements.png");
} else if (!strcmp (category, "Multimedia")) { g_hash_table_insert (hash,
return "gnome-multimedia.png"; "Clocks", "gnome-clock.png");
} else if (!strcmp (category, "Network")) { g_hash_table_insert (hash,
return "gnome-networktool.png"; "Monitors", "gnome-monitor.png");
} else if (!strcmp (category, "Utility")) { g_hash_table_insert (hash,
return "gnome-util.png"; "Multimedia", "gnome-multimedia.png");
} g_hash_table_insert (hash,
"Network", "gnome-networktool.png");
return NULL; g_hash_table_insert (hash,
"Utility", "gnome-util.png");
}
return g_hash_table_lookup (hash, untranslated_category);
} }
static GtkWidget * static GtkWidget *
...@@ -2620,6 +2650,8 @@ create_applets_menu (GtkWidget *menu) ...@@ -2620,6 +2650,8 @@ create_applets_menu (GtkWidget *menu)
GtkWidget *prev_menu = NULL; GtkWidget *prev_menu = NULL;
const gchar *prev_category = NULL; const gchar *prev_category = NULL;
gint i; gint i;
const GList *langs_glist;
GSList *langs_gslist;
CORBA_exception_init (&env); CORBA_exception_init (&env);
...@@ -2638,21 +2670,33 @@ create_applets_menu (GtkWidget *menu) ...@@ -2638,21 +2670,33 @@ create_applets_menu (GtkWidget *menu)
g_signal_connect (G_OBJECT (menu), "destroy", G_CALLBACK (menu_destroy), NULL); g_signal_connect (G_OBJECT (menu), "destroy", G_CALLBACK (menu_destroy), NULL);
/* Evil evil evil evil, we need to convert to
* a GSList from a GList */
langs_glist = gnome_i18n_get_language_list ("LC_MESSAGES");
langs_gslist = NULL;
while (langs_glist != NULL) {
langs_gslist = g_slist_append (langs_gslist, langs_glist->data);
langs_glist = langs_glist->next;
}
for (i = 0; i < list->_length; i++) { for (i = 0; i < list->_length; i++) {
Bonobo_ServerInfo *info; Bonobo_ServerInfo *info;
GtkWidget *menuitem; GtkWidget *menuitem;
const gchar *name; const gchar *name;
const gchar *icon; const gchar *icon;
const gchar *category; const gchar *category;
const gchar *untranslated_category;
const gchar *iid; const gchar *iid;
info = &list->_buffer [i]; info = &list->_buffer [i];
iid = info->iid; iid = info->iid;
name = bonobo_server_info_prop_lookup (info, "name", NULL); name = bonobo_server_info_prop_lookup (info, "name", langs_gslist);
icon = bonobo_server_info_prop_lookup (info, "panel:icon", NULL); icon = bonobo_server_info_prop_lookup (info, "panel:icon", langs_gslist);
category = bonobo_server_info_prop_lookup (info, "panel:category", NULL); category = bonobo_server_info_prop_lookup (info, "panel:category", langs_gslist);
untranslated_category =
bonobo_server_info_prop_lookup (info, "panel:category", NULL);
if (string_empty (name)) { if (string_empty (name)) {
continue; continue;
...@@ -2673,7 +2717,7 @@ create_applets_menu (GtkWidget *menu) ...@@ -2673,7 +2717,7 @@ create_applets_menu (GtkWidget *menu)
g_signal_connect (G_OBJECT (prev_menu), "show", g_signal_connect (G_OBJECT (prev_menu), "show",
G_CALLBACK (our_gtk_menu_position), NULL); G_CALLBACK (our_gtk_menu_position), NULL);
cat_icon = applet_menu_get_category_icon (category); cat_icon = applet_menu_get_category_icon (untranslated_category);
menuitem = applet_menu_append (menu, category, cat_icon); menuitem = applet_menu_append (menu, category, cat_icon);
...@@ -2692,6 +2736,8 @@ create_applets_menu (GtkWidget *menu) ...@@ -2692,6 +2736,8 @@ create_applets_menu (GtkWidget *menu)
0 /* flags */); 0 /* flags */);
} }
g_slist_free (langs_gslist);
CORBA_free (list); CORBA_free (list);
CORBA_exception_free (&env); CORBA_exception_free (&env);
...@@ -2886,7 +2932,6 @@ create_new_panel (GtkWidget *w, gpointer data) ...@@ -2886,7 +2932,6 @@ create_new_panel (GtkWidget *w, gpointer data)
break; break;
case FOOBAR_PANEL: { case FOOBAR_PANEL: {
GtkWidget *dialog; GtkWidget *dialog;
gchar *s;
if (!foobar_widget_exists (screen)) { if (!foobar_widget_exists (screen)) {
const char *panel_id; const char *panel_id;
...@@ -2899,18 +2944,9 @@ create_new_panel (GtkWidget *w, gpointer data) ...@@ -2899,18 +2944,9 @@ create_new_panel (GtkWidget *w, gpointer data)
gtk_widget_show (panel); gtk_widget_show (panel);
break; break;
} }
s = _("You can only have one menu panel at a time."); dialog = panel_error_dialog ("only_one_foobar",
_("You can only have one menu panel at a time."));
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
s);
/* FIXME: What the fuck are we doing here?
* gtk_window_set_wmclass (GTK_WINDOW (dialog),
* "only_one_foobar", "Panel");
* gtk_widget_show_all (dialog);
*/
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
break; break;
} }
default: break; default: break;
...@@ -3941,6 +3977,30 @@ create_root_menu (GtkWidget *root_menu, ...@@ -3941,6 +3977,30 @@ create_root_menu (GtkWidget *root_menu,
return root_menu; return root_menu;
} }
static char *
get_menu_tooltip (GtkWidget *menu)
{
GString *tooltip;
GSList *mfl;
if (menu == NULL)
return g_strdup (_("Menu"));
tooltip = g_string_new (_("Menu:"));
mfl = g_object_get_data (G_OBJECT (menu), "mf");
while (mfl != NULL) {
MenuFinfo *mf = mfl->data;
g_string_append_c (tooltip, ' ');
g_string_append (tooltip, mf->dir_name);
mfl = mfl->next;
}
return g_string_free (tooltip, FALSE);
}
void void
add_menu_widget (Menu *menu, add_menu_widget (Menu *menu,
...@@ -3979,6 +4039,8 @@ add_menu_widget (Menu *menu, ...@@ -3979,6 +4039,8 @@ add_menu_widget (Menu *menu,
gtk_tooltips_set_tip (panel_tooltips, menu->button, gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Main Menu"), NULL); _("Main Menu"), NULL);
} else { } else {
char *tooltip;
menu->menu = NULL; menu->menu = NULL;
for(li = menudirl; li != NULL; li = li->next) for(li = menudirl; li != NULL; li = li->next)
menu->menu = create_menu_at (menu->menu, li->data, menu->menu = create_menu_at (menu->menu, li->data,
...@@ -3986,9 +4048,10 @@ add_menu_widget (Menu *menu, ...@@ -3986,9 +4048,10 @@ add_menu_widget (Menu *menu,
NULL, NULL, NULL, NULL,
fake_subs, FALSE); fake_subs, FALSE);
/* FIXME: A more descriptive name would be better */ tooltip = get_menu_tooltip (menu->menu);
gtk_tooltips_set_tip (panel_tooltips, menu->button, gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Menu"), NULL); tooltip, NULL);
g_free (tooltip);
if(menu->menu == NULL) { if(menu->menu == NULL) {
int flags; int flags;
...@@ -4159,14 +4222,6 @@ create_panel_menu (PanelWidget *panel, const char *menudir, gboolean main_menu, ...@@ -4159,14 +4222,6 @@ create_panel_menu (PanelWidget *panel, const char *menudir, gboolean main_menu,
GDK_ACTION_MOVE); GDK_ACTION_MOVE);
GTK_WIDGET_SET_FLAGS (menu->button, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS (menu->button, GTK_NO_WINDOW);
if (main_menu)
gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Main Menu"), NULL);
else
/* FIXME: A more descriptive name would be better */
gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Menu"), NULL);
g_signal_connect (G_OBJECT (menu->button), "drag_data_get", g_signal_connect (G_OBJECT (menu->button), "drag_data_get",
G_CALLBACK (drag_data_get_cb), G_CALLBACK (drag_data_get_cb),
NULL); NULL);
...@@ -4189,6 +4244,16 @@ create_panel_menu (PanelWidget *panel, const char *menudir, gboolean main_menu, ...@@ -4189,6 +4244,16 @@ create_panel_menu (PanelWidget *panel, const char *menudir, gboolean main_menu,
g_slist_free(list); g_slist_free(list);
} }
if (main_menu) {
gtk_tooltips_set_tip (panel_tooltips, menu->button,
_("Main Menu"), NULL);
} else {
char *tooltip = get_menu_tooltip (menu->menu);
gtk_tooltips_set_tip (panel_tooltips, menu->button,
tooltip, NULL);
g_free (tooltip);
}
g_free (pixmap_name); g_free (pixmap_name);
return menu; return menu;
......
...@@ -2874,8 +2874,6 @@ panel_widget_tab_move (PanelWidget *panel, ...@@ -2874,8 +2874,6 @@ panel_widget_tab_move (PanelWidget *panel,
ad = panel->currently_dragged_applet; ad = panel->currently_dragged_applet;
if (!ad) { if (!ad) {
GtkWidgetClass *class;
g_return_if_fail (GTK_WIDGET_HAS_FOCUS (panel)); g_return_if_fail (GTK_WIDGET_HAS_FOCUS (panel));
GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (panel), GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (panel), GTK_CAN_FOCUS);
......
...@@ -100,15 +100,10 @@ try_adding_status(guint32 winid) ...@@ -100,15 +100,10 @@ try_adding_status(guint32 winid)
} }
static void static void
try_checking_swallows (WnckWindow *window) try_checking_swallows (gulong xid, const char *name)
{ {
gulong xid;
const char *name;
GList *li; GList *li;
name = wnck_window_get_name (window);
xid = wnck_window_get_xid (window);
if (name == NULL) if (name == NULL)
return; return;
...@@ -125,36 +120,53 @@ try_checking_swallows (WnckWindow *window) ...@@ -125,36 +120,53 @@ try_checking_swallows (WnckWindow *window)
} }
} }
typedef struct {
char *name;
gulong xid;
} XWin;
void void
xstuff_go_through_client_list (void) xstuff_go_through_client_list (void)
{ {
WnckScreen *screen = wnck_screen_get (0 /* FIXME screen number */); WnckScreen *screen = wnck_screen_get (0 /* FIXME screen number */);
GList *windows, *li; GList *windows, *li, *our_windows = NULL;
windows = g_list_copy (wnck_screen_get_windows (screen)); /* Avoid possible race by copying out information first */
windows = wnck_screen_get_windows (screen);
while (windows != NULL) {
WnckWindow *window = windows->data;
XWin *xw = g_new0 (XWin, 1);
xw->name = g_strdup (wnck_window_get_name (window));
xw->xid = wnck_window_get_xid (window);
gdk_error_trap_push (); our_windows = g_list_prepend (our_windows, xw);
/* FIXME: is this a possible race? Can the WnckWindows disappear while windows = windows->next;
* we're traversing them? I think they can, fix this! */ }
gdk_error_trap_push ();
/* just for status dock stuff for now */ /* just for status dock stuff for now */
for (li = windows; li != NULL; li = li->next) { for (li = our_windows; li != NULL; li = li->next) {
WnckWindow *window = li->data; XWin *xw = li->data;
const char *name = wnck_window_get_name (window);
/* skip own windows */ /* skip own windows */
if (name != NULL && if (xw->name != NULL &&
strcmp (name, "panel") == 0) strcmp (xw->name, "panel") == 0)
continue; continue;
if (check_swallows != NULL) if (check_swallows != NULL)
try_checking_swallows (window); try_checking_swallows (xw->xid, xw->name);
try_adding_status (wnck_window_get_xid (window)); try_adding_status (xw->xid);
li->data = NULL;
g_free (xw->name);
xw->name = NULL;
g_free (xw);
} }
gdk_flush(); gdk_flush();
gdk_error_trap_pop (); gdk_error_trap_pop ();
g_list_free (windows); g_list_free (our_windows);
} }
void void
......
Markdown is supported
0% or