static void panel_drawer_use_custom_icon_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, Drawer *drawer) { gboolean use_custom_icon; char *custom_icon = NULL; if (!entry->value || entry->value->type != GCONF_VALUE_BOOL) return; use_custom_icon = gconf_value_get_bool (entry->value); if (use_custom_icon) { const char *key; key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, drawer->info->id, "custom_icon"); custom_icon = gconf_client_get_string (client, key, NULL); } button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); g_free (custom_icon); }
static void setup_button (Launcher *launcher) { char *comment; char *name; char *str; char *icon; char *unescaped_str; g_return_if_fail (launcher != NULL); name = panel_key_file_get_locale_string (launcher->key_file, "Name"); comment = panel_key_file_get_locale_string (launcher->key_file, "Comment"); /* Setup tooltip */ if (!PANEL_GLIB_STR_EMPTY (name) && !PANEL_GLIB_STR_EMPTY (comment)) str = g_strdup_printf ("%s\n%s", name, comment); else if (!PANEL_GLIB_STR_EMPTY (name)) str = g_strdup (name); else str = g_strdup (comment); g_free (name); g_free (comment); /* If we can unescape the string, then we probably have an escaped * string (a location e.g.). If we can't, then it most probably means * we have a % that is not here to encode a character, and we don't * want to unescape in this case. See bug #170516 for details. */ unescaped_str = g_uri_unescape_string (str, NULL); if (unescaped_str) { g_free (str); str = unescaped_str; } panel_util_set_tooltip_text (launcher->button, str); /* Setup accessible name */ panel_a11y_set_atk_name_desc (launcher->button, str, NULL); g_free (str); /* Setup icon */ icon = panel_key_file_get_locale_string (launcher->key_file, "Icon"); if (icon && icon[0] == '\0') { g_free (icon); icon = NULL; } if (!icon) icon = guess_icon_from_exec (button_widget_get_icon_theme (BUTTON_WIDGET (launcher->button)), launcher->key_file); if (!icon) icon = g_strdup (PANEL_ICON_LAUNCHER); button_widget_set_icon_name (BUTTON_WIDGET (launcher->button), icon); g_free (icon); }
static void panel_menu_button_set_icon (PanelMenuButton *button) { char *icon_path; icon_path = panel_menu_button_get_icon (button); button_widget_set_icon_name (BUTTON_WIDGET (button), icon_path); g_free (icon_path); }
static void panel_drawer_custom_icon_changed (GSettings *settings, gchar *key, Drawer *drawer) { g_return_if_fail (drawer != NULL); g_return_if_fail (drawer->button != NULL); gboolean use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY); char *custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY); if (use_custom_icon && custom_icon != NULL && custom_icon [0] != '\0') { button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); } else { button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), PANEL_ICON_DRAWER); } g_free (custom_icon); }
static void panel_drawer_custom_icon_changed (GSettings *settings, gchar *key, Drawer *drawer) { char *custom_icon; custom_icon = g_settings_get_string (settings, key); if (custom_icon && custom_icon [0]) { gboolean use_custom_icon; use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY); if (use_custom_icon) button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); } g_free (custom_icon); }
void panel_action_button_set_type (PanelActionButton *button, PanelActionButtonType type) { g_return_if_fail (type > PANEL_ACTION_NONE && type < PANEL_ACTION_LAST); if (type == button->priv->type) return; button->priv->type = type; if (actions [type].icon_name != NULL) button_widget_set_icon_name (BUTTON_WIDGET (button), actions [type].icon_name); panel_util_set_tooltip_text (GTK_WIDGET (button), _(actions [type].tooltip)); panel_a11y_set_atk_name_desc (GTK_WIDGET (button), _(actions [type].tooltip), NULL); panel_action_button_update_sensitivity (button); }
static void panel_action_button_style_updated (PanelActionButton *button) { if (actions [button->priv->type].icon_name != NULL) button_widget_set_icon_name (BUTTON_WIDGET (button), actions [button->priv->type].icon_name); }