[gnumeric] Dead kittens: simplify using new goffice function.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Dead kittens: simplify using new goffice function.
- Date: Sun, 4 Jan 2015 23:00:21 +0000 (UTC)
commit 145330713995cc46673aac6b016418ab25763110
Author: Morten Welinder <terra gnome org>
Date: Sun Jan 4 17:59:56 2015 -0500
Dead kittens: simplify using new goffice function.
src/dialogs/dialog-cell-format.c | 5 ++---
src/dialogs/dialog-cell-sort.c | 12 ++++++------
src/dialogs/dialog-consolidate.c | 4 ++--
src/dialogs/dialog-define-names.c | 22 +++++++---------------
src/dialogs/dialog-hyperlink.c | 7 +++----
src/dialogs/dialog-preferences.c | 2 +-
src/dialogs/dialog-printer-setup.c | 5 ++---
src/dialogs/dialog-sheet-order.c | 31 ++++++++++++-------------------
src/dialogs/dialog-workbook-attr.c | 9 +++------
src/item-grid.c | 2 +-
10 files changed, 39 insertions(+), 60 deletions(-)
---
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 6781684..27a0126 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -1822,8 +1822,6 @@ build_validation_error_combo (FormatState *state, GtkComboBox *box)
{
GtkListStore *store;
GtkCellRenderer *renderer;
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wbcg_toplevel (state->wbcg)));
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
unsigned ui;
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
@@ -1832,7 +1830,8 @@ build_validation_error_combo (FormatState *state, GtkComboBox *box)
for (ui = 0; ui < G_N_ELEMENTS (validation_error_actions); ui++) {
const char *icon_name = validation_error_actions[ui].icon_name;
GdkPixbuf *pixbuf = icon_name
- ? gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL)
+ ? go_gtk_widget_render_icon_pixbuf (GTK_WIDGET (wbcg_toplevel (state->wbcg)),
+ icon_name, GTK_ICON_SIZE_MENU)
: NULL;
GtkTreeIter iter;
diff --git a/src/dialogs/dialog-cell-sort.c b/src/dialogs/dialog-cell-sort.c
index f931853..b2dc21b 100644
--- a/src/dialogs/dialog-cell-sort.c
+++ b/src/dialogs/dialog-cell-sort.c
@@ -1172,13 +1172,13 @@ dialog_cell_sort (WBCGtk *wbcg)
state->dialog = go_gtk_builder_get_widget (state->gui, "CellSort");
state->image_ascending =
- gtk_widget_render_icon_pixbuf (state->dialog,
- GTK_STOCK_SORT_ASCENDING,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
+ go_gtk_widget_render_icon_pixbuf (state->dialog,
+ "view-sort-ascending",
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
state->image_descending =
- gtk_widget_render_icon_pixbuf (state->dialog,
- GTK_STOCK_SORT_DESCENDING,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
+ go_gtk_widget_render_icon_pixbuf (state->dialog,
+ "view-sort-descending",
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
dialog_init (state);
gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
diff --git a/src/dialogs/dialog-consolidate.c b/src/dialogs/dialog-consolidate.c
index 44c561e..e46646c 100644
--- a/src/dialogs/dialog-consolidate.c
+++ b/src/dialogs/dialog-consolidate.c
@@ -505,8 +505,8 @@ dialog_consolidate_tool_init (ConsolidateState *state)
state->areas_index = -1;
setup_widgets (state, state->base.gui);
- state->pixmap = gtk_widget_render_icon_pixbuf
- (GTK_WIDGET(state->base.dialog),
+ state->pixmap = go_gtk_widget_render_icon_pixbuf
+ (GTK_WIDGET (state->base.dialog),
"gnumeric-exprentry",
GTK_ICON_SIZE_LARGE_TOOLBAR);
diff --git a/src/dialogs/dialog-define-names.c b/src/dialogs/dialog-define-names.c
index 5d24a24..7a906bf 100644
--- a/src/dialogs/dialog-define-names.c
+++ b/src/dialogs/dialog-define-names.c
@@ -1048,13 +1048,6 @@ cb_name_guru_selection_function (G_GNUC_UNUSED GtkTreeSelection *selection,
return FALSE;
}
-static GdkPixbuf *
-get_icon (GtkIconTheme *theme, const char *icon_name)
-{
- return gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL);
-}
-
-
static gboolean
name_guru_init (NameGuruState *state, WBCGtk *wbcg, gboolean is_paste_dialog)
{
@@ -1062,8 +1055,7 @@ name_guru_init (NameGuruState *state, WBCGtk *wbcg, gboolean is_paste_dialog)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wbcg_toplevel (wbcg)));
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
+ GtkWidget *widget = GTK_WIDGET (wbcg_toplevel (wbcg));
state->is_paste_dialog = is_paste_dialog;
state->has_pasted = FALSE;
@@ -1189,7 +1181,7 @@ name_guru_init (NameGuruState *state, WBCGtk *wbcg, gboolean is_paste_dialog)
"changed",
G_CALLBACK (name_guru_update_sensitivity),
state);
- state->image_paste = get_icon (theme, "edit-paste");
+ state->image_paste = go_gtk_widget_render_icon_pixbuf (widget, "edit-paste",
GTK_ICON_SIZE_MENU);
state->image_add = NULL;
state->image_delete = NULL;
state->image_lock = NULL;
@@ -1197,11 +1189,11 @@ name_guru_init (NameGuruState *state, WBCGtk *wbcg, gboolean is_paste_dialog)
state->image_down = NULL;
} else {
state->image_paste = NULL;
- state->image_add = get_icon (theme, "list-add");
- state->image_delete = get_icon (theme, "list-remove");
- state->image_lock = get_icon (theme, "gnumeric-protection-yes");
- state->image_up = get_icon (theme, "go-up");
- state->image_down = get_icon (theme, "do-down");
+ state->image_add = go_gtk_widget_render_icon_pixbuf (widget, "list-add", GTK_ICON_SIZE_MENU);
+ state->image_delete = go_gtk_widget_render_icon_pixbuf (widget, "list-remove",
GTK_ICON_SIZE_MENU);
+ state->image_lock = go_gtk_widget_render_icon_pixbuf (widget, "gnumeric-protection-yes",
GTK_ICON_SIZE_MENU);
+ state->image_up = go_gtk_widget_render_icon_pixbuf (widget, "go-up", GTK_ICON_SIZE_MENU);
+ state->image_down = go_gtk_widget_render_icon_pixbuf (widget, "do-down", GTK_ICON_SIZE_MENU);
}
state->search_entry = go_gtk_builder_get_widget (state->gui, "search_entry");
diff --git a/src/dialogs/dialog-hyperlink.c b/src/dialogs/dialog-hyperlink.c
index 037df32..47dd58b 100644
--- a/src/dialogs/dialog-hyperlink.c
+++ b/src/dialogs/dialog-hyperlink.c
@@ -479,8 +479,6 @@ dhl_init (HyperlinkState *state)
GtkListStore *store;
GtkTreeIter iter;
GtkCellRenderer *renderer;
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wbcg_toplevel (state->wbcg)));
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
#ifdef GNM_NO_MAILTO
gtk_widget_hide (go_gtk_builder_get_widget (state->gui, "email-grid"));
@@ -525,8 +523,9 @@ dhl_init (HyperlinkState *state)
g_object_unref (store);
for (i = 0 ; i < G_N_ELEMENTS (type); i++) {
- GdkPixbuf *pixbuf =
- gtk_icon_theme_load_icon (theme, type[i].icon_name, 16, 0, NULL);
+ GdkPixbuf *pixbuf = go_gtk_widget_render_icon_pixbuf
+ (GTK_WIDGET (wbcg_toplevel (state->wbcg)),
+ type[i].icon_name, GTK_ICON_SIZE_MENU);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
0, pixbuf,
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 1e46cc8..dc2136d 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -1216,7 +1216,7 @@ static page_info_t const page_info[] = {
{N_("Auto Correct"), GTK_STOCK_DIALOG_ERROR, NULL, &pref_autocorrect_general_page_initializer},
{N_("Font"), GTK_STOCK_ITALIC, NULL, &pref_font_initializer },
{N_("Files"), GTK_STOCK_FLOPPY, NULL, &pref_file_page_initializer },
- {N_("Tools"), GTK_STOCK_EXECUTE, NULL, &pref_tool_page_initializer },
+ {N_("Tools"), GTK_STOCK_EXECUTE, NULL, &pref_tool_page_initializer },
{N_("Undo"), GTK_STOCK_UNDO, NULL, &pref_undo_page_initializer },
{N_("Windows"), "gnumeric-object-combo", NULL, &pref_window_page_initializer },
{N_("Header/Footer"), GTK_STOCK_ITALIC, "1", &pref_font_hf_initializer },
diff --git a/src/dialogs/dialog-printer-setup.c b/src/dialogs/dialog-printer-setup.c
index 563e80a..086c2d5 100644
--- a/src/dialogs/dialog-printer-setup.c
+++ b/src/dialogs/dialog-printer-setup.c
@@ -1136,13 +1136,12 @@ hf_insert_hf_stock_tag (HFCustomizeState *hf_state, GtkTextBuffer *buffer,
if (gtk_text_buffer_insert_interactive_at_cursor
(buffer, "", -1, TRUE)) {
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wbcg_toplevel
(hf_state->printer_setup_state->wbcg)));
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
+ GtkWidget *w = GTK_WIDGET (wbcg_toplevel (hf_state->printer_setup_state->wbcg));
gtk_text_buffer_get_iter_at_mark
(buffer, &iter, gtk_text_buffer_get_insert (buffer));
- pix = gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL);
+ pix = go_gtk_widget_render_icon_pixbuf (w, icon_name, GTK_ICON_SIZE_BUTTON);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pix);
g_object_unref (pix);
gtk_text_iter_backward_char (&iter);
diff --git a/src/dialogs/dialog-sheet-order.c b/src/dialogs/dialog-sheet-order.c
index 3ce787e..a60ea6c 100644
--- a/src/dialogs/dialog-sheet-order.c
+++ b/src/dialogs/dialog-sheet-order.c
@@ -1426,14 +1426,6 @@ destroy_cb (GObject *obj)
g_object_set_data (obj, "state", NULL);
}
-static GdkPixbuf *
-get_icon (GtkWidget *widget, const char *icon_name)
-{
- GdkScreen *screen = gtk_widget_get_screen (widget);
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
- return gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL);
-}
-
void
dialog_sheet_order (WBCGtk *wbcg)
{
@@ -1443,6 +1435,7 @@ dialog_sheet_order (WBCGtk *wbcg)
GOColorGroup *cg;
Workbook *wb;
GtkWidget *widget;
+ GdkPixbuf *icon;
g_return_if_fail (wbcg != NULL);
@@ -1483,11 +1476,11 @@ dialog_sheet_order (WBCGtk *wbcg)
state->cancel_btn = go_gtk_builder_get_widget (gui, "cancel_button");
state->advanced_check = go_gtk_builder_get_widget (gui, "advanced-check");
state->initial_colors_set = FALSE;
- state->image_padlock = get_icon (widget, "gnumeric-protection-yes");
- state->image_padlock_no = get_icon (widget, "gnumeric-protection-no");
- state->image_visible = get_icon (widget, "gnumeric-visible");
- state->image_ltr = get_icon (widget, "format-text-direction-ltr");
- state->image_rtl = get_icon (widget, "format-text-direction-rtl");
+ state->image_padlock = go_gtk_widget_render_icon_pixbuf (widget, "gnumeric-protection-yes",
GTK_ICON_SIZE_MENU);
+ state->image_padlock_no = go_gtk_widget_render_icon_pixbuf (widget, "gnumeric-protection-no",
GTK_ICON_SIZE_MENU);
+ state->image_visible = go_gtk_widget_render_icon_pixbuf (widget, "gnumeric-visible",
GTK_ICON_SIZE_MENU);
+ state->image_ltr = go_gtk_widget_render_icon_pixbuf (widget, "format-text-direction-ltr",
GTK_ICON_SIZE_MENU);
+ state->image_rtl = go_gtk_widget_render_icon_pixbuf (widget, "format-text-direction-rtl",
GTK_ICON_SIZE_MENU);
/* Listen for changes in the sheet order. */
state->sheet_order_changed_listener = g_signal_connect (G_OBJECT (wb),
"sheet_order_changed", G_CALLBACK (cb_sheet_order_changed),
@@ -1502,9 +1495,9 @@ dialog_sheet_order (WBCGtk *wbcg)
grid = GTK_GRID (go_gtk_builder_get_widget (gui,"main-grid"));
cg = go_color_group_fetch ("back_color_group",
wb_control_view (WORKBOOK_CONTROL (wbcg)));
- state->ccombo_back = go_combo_color_new (
- gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gnumeric-bucket", 24, 0, NULL),
- _("Default"), 0, cg);
+ icon = go_gtk_widget_render_icon_pixbuf (widget, "gnumeric-bucket", GTK_ICON_SIZE_LARGE_TOOLBAR);
+ state->ccombo_back = go_combo_color_new (icon, _("Default"), 0, cg);
+ g_object_unref (icon);
g_object_unref (cg);
go_combo_color_set_instant_apply (
GO_COMBO_COLOR (state->ccombo_back), TRUE);
@@ -1513,9 +1506,9 @@ dialog_sheet_order (WBCGtk *wbcg)
cg = go_color_group_fetch ("fore_color_group",
wb_control_view (WORKBOOK_CONTROL (wbcg)));
- state->ccombo_fore = go_combo_color_new (
- gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "font", 24, 0, NULL),
- _("Default"), 0, cg);
+ icon = go_gtk_widget_render_icon_pixbuf (widget, "font", GTK_ICON_SIZE_LARGE_TOOLBAR);
+ state->ccombo_fore = go_combo_color_new (icon, _("Default"), 0, cg);
+ g_object_unref (icon);
g_object_unref (cg);
go_combo_color_set_instant_apply (
GO_COMBO_COLOR (state->ccombo_fore), TRUE);
diff --git a/src/dialogs/dialog-workbook-attr.c b/src/dialogs/dialog-workbook-attr.c
index 4466c22..eb63ea7 100644
--- a/src/dialogs/dialog-workbook-attr.c
+++ b/src/dialogs/dialog-workbook-attr.c
@@ -166,13 +166,10 @@ attr_dialog_add_item (AttrState *state, char const *page_name,
int page, char const* parent_path)
{
GtkTreeIter iter, parent;
- GdkPixbuf *icon = NULL;
+ GdkPixbuf *icon = icon_name
+ ? go_gtk_widget_render_icon_pixbuf (GTK_WIDGET (wbcg_toplevel (state->wbcg)), icon_name,
GTK_ICON_SIZE_MENU)
+ : NULL;
- if (icon_name != NULL) {
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wbcg_toplevel (state->wbcg)));
- GtkIconTheme *theme = gtk_icon_theme_get_for_screen (screen);
- icon = gtk_icon_theme_load_icon (theme, icon_name, 16, 0, NULL);
- }
if (parent_path && gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (state->store),
&parent, parent_path))
gtk_tree_store_append (state->store, &iter, &parent);
diff --git a/src/item-grid.c b/src/item-grid.c
index 38cc48e..e00bdbe 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -209,7 +209,7 @@ item_grid_realize (GocItem *item)
display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
ig->cursor_link = gdk_cursor_new_for_display (display, GDK_HAND2);
cursor_cross_pixbuf =
- gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ gtk_icon_theme_load_icon (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET
(item->canvas))),
"cursor-cross", 32, 0, NULL);
ig->cursor_cross =
gdk_cursor_new_from_pixbuf (display,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]