[goobox] use symbolic icons
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] use symbolic icons
- Date: Thu, 2 Jun 2011 20:49:05 +0000 (UTC)
commit b304da9bb595fdbfc8a3e3040f568f740bda25de
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Jun 2 21:54:02 2011 +0200
use symbolic icons
src/goo-stock.h | 23 ++++++++++------
src/goo-volume-tool-button.c | 4 +-
src/goo-window.c | 58 ++++++++++++++++++++++++++----------------
src/ui.h | 22 ++++++++--------
4 files changed, 63 insertions(+), 44 deletions(-)
---
diff --git a/src/goo-stock.h b/src/goo-stock.h
index e150814..ac3c096 100644
--- a/src/goo-stock.h
+++ b/src/goo-stock.h
@@ -23,16 +23,21 @@
#ifndef GOO_STOCK_H
#define GOO_STOCK_H
-#define GOO_STOCK_EJECT "media-eject"
-#define GOO_STOCK_EXTRACT "gtk-cdrom"
+#define GOO_STOCK_PLAY "media-playback-start-symbolic"
+#define GOO_STOCK_PAUSE "media-playback-pause-symbolic"
+#define GOO_STOCK_STOP "media-playback-stop-symbolic"
+#define GOO_STOCK_NEXT "media-skip-forward-symbolic"
+#define GOO_STOCK_PREV "media-skip-backward-symbolic"
+#define GOO_STOCK_EJECT "media-eject-symbolic"
+#define GOO_STOCK_EXTRACT "document-save-symbolic"
#define GOO_STOCK_RESET "goo-reset"
-#define GOO_STOCK_NO_DISC "gnome-dev-removable"
-#define GOO_STOCK_DATA_DISC "gnome-dev-cdrom"
-#define GOO_STOCK_AUDIO_CD "gnome-dev-cdrom-audio"
-#define GOO_STOCK_VOLUME_MAX "audio-volume-high"
-#define GOO_STOCK_VOLUME_MED "audio-volume-medium"
-#define GOO_STOCK_VOLUME_MIN "audio-volume-low"
-#define GOO_STOCK_VOLUME_ZERO "audio-volume-muted"
+#define GOO_STOCK_NO_DISC "media-optical-symbolic"
+#define GOO_STOCK_DATA_DISC "drive-harddisk-symbolic"
+#define GOO_STOCK_AUDIO_CD "media-optical-symbolic"
+#define GOO_STOCK_VOLUME_MAX "audio-volume-high-symbolic"
+#define GOO_STOCK_VOLUME_MED "audio-volume-medium-symbolic"
+#define GOO_STOCK_VOLUME_MIN "audio-volume-low-symbolic"
+#define GOO_STOCK_VOLUME_ZERO "audio-volume-muted-symbolic"
void goo_stock_init (void);
diff --git a/src/goo-volume-tool-button.c b/src/goo-volume-tool-button.c
index 25126d9..5fd399b 100644
--- a/src/goo-volume-tool-button.c
+++ b/src/goo-volume-tool-button.c
@@ -155,7 +155,7 @@ update_volume_label (GooVolumeToolButton *button)
else
icon = GOO_STOCK_VOLUME_MAX;
- gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), icon);
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), icon);
text = g_strdup_printf ("<small>%3.0f%%</small>", value * 100.0);
gtk_label_set_markup (GTK_LABEL (button->priv->volume_label), text);
@@ -727,7 +727,7 @@ goo_volume_button_construct (GooVolumeToolButton *button)
/* Construct the toolbar button. */
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (button), FALSE);
- gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), GOO_STOCK_VOLUME_MAX);
+ gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), GOO_STOCK_VOLUME_MAX);
box = gtk_hbox_new (FALSE, 0);
diff --git a/src/goo-window.c b/src/goo-window.c
index e89c1e8..0f17717 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -250,20 +250,32 @@ window_update_sensitivity (GooWindow *window)
}
-static GdkPixbuf *
-create_void_icon (GooWindow *window)
+static int
+get_icon_size_from_settings (GtkWidget *widget,
+ GtkIconSize _gtk_icon_size)
{
GtkSettings *settings;
- int width, height, icon_size;
- GdkPixbuf *icon;
+ int width;
+ int height;
+ int icon_size;
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
-
- if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
+ settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
+ if (gtk_icon_size_lookup_for_settings (settings, _gtk_icon_size, &width, &height))
icon_size = MAX (width, height);
else
icon_size = FALLBACK_ICON_SIZE;
+ return icon_size;
+}
+
+
+static GdkPixbuf *
+create_void_icon (GooWindow *window)
+{
+ int icon_size;
+ GdkPixbuf *icon;
+
+ icon_size = get_icon_size_from_settings (GTK_WIDGET (window), GTK_ICON_SIZE_MENU);
icon = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, icon_size, icon_size);
gdk_pixbuf_fill (icon, 0x00000000);
@@ -300,8 +312,8 @@ get_iter_from_track_number (GooWindow *window,
static void
set_track_icon (GooWindow *window,
- int track_number,
- const char *stock_id)
+ int track_number,
+ const char *stock_id)
{
GtkTreeIter iter;
GdkPixbuf *icon;
@@ -310,9 +322,11 @@ set_track_icon (GooWindow *window,
return;
if (stock_id != NULL)
- icon = gtk_widget_render_icon_pixbuf (GTK_WIDGET (window),
- stock_id,
- GTK_ICON_SIZE_MENU);
+ icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
+ stock_id,
+ get_icon_size_from_settings (GTK_WIDGET (window), GTK_ICON_SIZE_MENU),
+ 0,
+ NULL);
else
icon = create_void_icon (window);
gtk_list_store_set (window->priv->list_store, &iter,
@@ -324,7 +338,7 @@ set_track_icon (GooWindow *window,
static void
set_current_track_icon (GooWindow *window,
- const char *stock_id)
+ const char *stock_id)
{
if (window->priv->current_track != NULL)
set_track_icon (window, window->priv->current_track->number, stock_id);
@@ -1262,7 +1276,7 @@ set_action_label_and_icon (GooWindow *window,
g_object_set (G_OBJECT (action),
"label", label,
"tooltip", tooltip,
- "stock_id", stock_id,
+ "icon-name", stock_id,
NULL);
g_free (path);
@@ -1288,7 +1302,7 @@ player_start_cb (GooPlayer *player,
"TogglePlay",
_("_Pause"),
_("Pause"),
- GTK_STOCK_MEDIA_PAUSE,
+ GOO_STOCK_PAUSE,
"/MenuBar/CDMenu/",
NULL);
@@ -1644,7 +1658,7 @@ player_done_cb (GooPlayer *player,
case GOO_PLAYER_ACTION_SEEK_SONG:
goo_window_set_current_track (window, goo_player_get_current_track (window->priv->player));
goo_window_select_current_track (window);
- set_current_track_icon (window, GTK_STOCK_MEDIA_PLAY);
+ set_current_track_icon (window, GOO_STOCK_PLAY);
break;
case GOO_PLAYER_ACTION_PLAY:
@@ -1654,25 +1668,25 @@ player_done_cb (GooPlayer *player,
"TogglePlay",
_("_Play"),
_("Play"),
- GTK_STOCK_MEDIA_PLAY,
+ GOO_STOCK_PLAY,
"/MenuBar/CDMenu/",
NULL);
if (action == GOO_PLAYER_ACTION_PLAY) {
- set_current_track_icon (window, GTK_STOCK_MEDIA_PLAY);
+ set_current_track_icon (window, GOO_STOCK_PLAY);
window->priv->next_timeout_handle = g_idle_add (next_time_idle, window);
}
else if (action == GOO_PLAYER_ACTION_STOP)
- set_current_track_icon (window, GTK_STOCK_MEDIA_STOP);
+ set_current_track_icon (window, GOO_STOCK_STOP);
break;
case GOO_PLAYER_ACTION_PAUSE:
- set_current_track_icon (window, GTK_STOCK_MEDIA_PAUSE);
+ set_current_track_icon (window, GOO_STOCK_PAUSE);
set_action_label_and_icon (window,
"TogglePlay",
_("_Play"),
_("Play"),
- GTK_STOCK_MEDIA_PLAY,
+ GOO_STOCK_PLAY,
"/MenuBar/CDMenu/",
NULL);
break;
@@ -2647,7 +2661,7 @@ goo_window_play (GooWindow *window)
play_track (window, 0);
}
else {
- set_current_track_icon (window, GTK_STOCK_MEDIA_PLAY);
+ set_current_track_icon (window, GOO_STOCK_PLAY);
goo_player_play (window->priv->player);
}
}
diff --git a/src/ui.h b/src/ui.h
index 3d421f9..641f79e 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -48,31 +48,31 @@ static GtkActionEntry action_entries[] = {
N_("_Keyboard shortcuts"), "",
" ",
G_CALLBACK (activate_action_shortcuts) },
- { "TogglePlay", GTK_STOCK_MEDIA_PLAY,
+ { "TogglePlay", GOO_STOCK_PLAY,
N_("_Play"), "space",
N_("Play/Pause"),
G_CALLBACK (activate_action_toggle_play) },
- { "Play", GTK_STOCK_MEDIA_PLAY,
+ { "Play", GOO_STOCK_PLAY,
N_("_Play"), NULL,
N_("Play"),
G_CALLBACK (activate_action_play) },
- { "PlaySelected", GTK_STOCK_MEDIA_PLAY,
+ { "PlaySelected", GOO_STOCK_PLAY,
N_("_Play"), NULL,
N_("Play this track"),
G_CALLBACK (activate_action_play_selected) },
- { "Pause", GTK_STOCK_MEDIA_PAUSE,
+ { "Pause", GOO_STOCK_PAUSE,
N_("_Pause"), NULL,
N_("Pause"),
G_CALLBACK (activate_action_pause) },
- { "Stop", GTK_STOCK_MEDIA_STOP,
+ { "Stop", GOO_STOCK_STOP,
N_("_Stop"), "Escape",
N_("Stop playing"),
G_CALLBACK (activate_action_stop) },
- { "Next", GTK_STOCK_MEDIA_NEXT,
+ { "Next", GOO_STOCK_NEXT,
N_("_Next"), "N",
N_("Play the next track"),
G_CALLBACK (activate_action_next) },
- { "Prev", GTK_STOCK_MEDIA_PREVIOUS,
+ { "Prev", GOO_STOCK_PREV,
N_("Pre_v"), "P",
N_("Play the previous track"),
G_CALLBACK (activate_action_prev) },
@@ -83,7 +83,7 @@ static GtkActionEntry action_entries[] = {
{ "EjectToolBar", GOO_STOCK_EJECT,
N_("_Eject"), "J",
N_("Eject the disc"),
- G_CALLBACK (activate_action_eject) },
+ G_CALLBACK (activate_action_eject) },
{ "Preferences", GTK_STOCK_PREFERENCES,
NULL, NULL,
N_("Edit various preferences"),
@@ -136,12 +136,12 @@ static GtkToggleActionEntry action_toggle_entries[] = {
{ "ViewToolbar", NULL,
N_("_Toolbar"), NULL,
N_("View the main toolbar"),
- G_CALLBACK (activate_action_view_toolbar),
+ G_CALLBACK (activate_action_view_toolbar),
TRUE },
{ "ViewStatusbar", NULL,
N_("Stat_usbar"), NULL,
N_("View the statusbar"),
- G_CALLBACK (activate_action_view_statusbar),
+ G_CALLBACK (activate_action_view_statusbar),
TRUE },
{ "PlayAll", NULL,
N_("Play _All"), NULL,
@@ -162,7 +162,7 @@ static GtkToggleActionEntry action_toggle_entries[] = {
static guint n_action_toggle_entries = G_N_ELEMENTS (action_toggle_entries);
-static const gchar *ui_info =
+static const gchar *ui_info =
"<ui>"
" <menubar name='MenuBar'>"
" <menu action='CDMenu'>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]