[goffice] GUI: ...and pixmap toolbar buttons too.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GUI: ...and pixmap toolbar buttons too.
- Date: Sat, 1 Feb 2014 02:54:13 +0000 (UTC)
commit e14e8c0c2fa821002b893519ce5a53dc1ed8862e
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 31 21:53:51 2014 -0500
GUI: ...and pixmap toolbar buttons too.
ChangeLog | 6 ++++++
NEWS | 1 +
goffice/gtk/go-action-combo-pixmaps.c | 32 +++++++++++++++++++-------------
goffice/gtk/go-combo-pixmaps.c | 23 ++++++++++++++++++++++-
goffice/gtk/go-combo-pixmaps.h | 1 +
5 files changed, 49 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5c86504..9eb34c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,14 @@
2014-01-31 Morten Welinder <terra gnome org>
+ * goffice/gtk/go-action-combo-pixmaps.c (cb_toolbar_reconfigured):
+ Redo all icons here.
+
* goffice/gtk/go-combo-color.c (go_combo_color_set_icon): New
function.
+ * goffice/gtk/go-combo-pixmaps.c
+ (go_combo_pixmaps_clear_elements): New function.
+
* goffice/gtk/go-action-combo-pixmaps.c (make_icon): Simplify
sizing.
diff --git a/NEWS b/NEWS
index eaeef64..e6912ee 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Morten:
* Improve "General" format.
* Improve Undo/Redo toolbar items.
* Improve Color selector toolbar items.
+ * Improve Pixmap selector toolbar items.
--------------------------------------------------------------------------
goffice 0.10.9:
diff --git a/goffice/gtk/go-action-combo-pixmaps.c b/goffice/gtk/go-action-combo-pixmaps.c
index e2fd786..c587fb7 100644
--- a/goffice/gtk/go-action-combo-pixmaps.c
+++ b/goffice/gtk/go-action-combo-pixmaps.c
@@ -129,15 +129,31 @@ cb_selection_changed (GOComboPixmaps *combo, int id, GOActionComboPixmaps *pacti
}
static void
-cb_toolbar_reconfigured (GOToolComboPixmaps *tool)
+cb_toolbar_reconfigured (GOToolComboPixmaps *tool, GtkAction *a)
{
GtkOrientation o = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (tool));
GtkReliefStyle relief = gtk_tool_item_get_relief_style (GTK_TOOL_ITEM (tool));
+ GOActionComboPixmaps *paction = (GOActionComboPixmaps *)a;
+ GOActionComboPixmapsElement const *el = paction->elements;
g_object_set (G_OBJECT (tool->combo),
"show-arrow", o == GTK_ORIENTATION_HORIZONTAL,
NULL);
+ go_combo_pixmaps_clear_elements (tool->combo);
+ for ( ; el->stock_id != NULL ; el++) {
+ GdkPixbuf *icon = make_icon (a, el->stock_id, GTK_WIDGET (tool));
+ /*
+ * FIXME FIXME FIXME: we must find a better solution for
+ * translating strings not in goffice domain
+ */
+ go_combo_pixmaps_add_element (tool->combo,
+ icon,
+ el->id,
+ gettext (el->untranslated_tooltip));
+ }
+ go_combo_pixmaps_select_id (tool->combo, paction->selected_id);
+
go_combo_box_set_relief (GO_COMBO_BOX (tool->combo), relief);
}
@@ -146,23 +162,13 @@ go_action_combo_pixmaps_create_tool_item (GtkAction *a)
{
GOActionComboPixmaps *paction = (GOActionComboPixmaps *)a;
GOToolComboPixmaps *tool = g_object_new (GO_TYPE_TOOL_COMBO_PIXMAPS, NULL);
- GOActionComboPixmapsElement const *el = paction->elements;
tool->combo = go_combo_pixmaps_new (paction->ncols);
- for ( ; el->stock_id != NULL ; el++) {
- GdkPixbuf *icon = make_icon (a, el->stock_id, GTK_WIDGET (tool));
-/* FIXME FIXME FIXME we must find a better solution for translating strings not in goffice domain */
- go_combo_pixmaps_add_element (tool->combo,
- icon,
- el->id,
- gettext (el->untranslated_tooltip));
- }
- go_combo_pixmaps_select_id (tool->combo, paction->selected_id);
g_signal_connect (tool, "toolbar-reconfigured",
G_CALLBACK (cb_toolbar_reconfigured),
- NULL);
- cb_toolbar_reconfigured (tool);
+ a);
+ cb_toolbar_reconfigured (tool, a);
go_gtk_widget_disable_focus (GTK_WIDGET (tool->combo));
gtk_container_add (GTK_CONTAINER (tool), GTK_WIDGET (tool->combo));
diff --git a/goffice/gtk/go-combo-pixmaps.c b/goffice/gtk/go-combo-pixmaps.c
index ec13dce..60ee78e 100644
--- a/goffice/gtk/go-combo-pixmaps.c
+++ b/goffice/gtk/go-combo-pixmaps.c
@@ -201,6 +201,28 @@ cb_swatch_key_press (GtkWidget *button, GdkEventKey *event, GOComboPixmaps *comb
}
/**
+ * go_combo_pixmaps_clear_elements:
+ * @combo: #GOComboPixmaps
+ *
+ * Remove all elements.
+ */
+void
+go_combo_pixmaps_clear_elements (GOComboPixmaps *combo)
+{
+ GList *children, *l;
+
+ children = gtk_container_get_children (GTK_CONTAINER (combo->grid));
+ for (l = children; l; l = l->next) {
+ GtkWidget *child = l->data;
+ gtk_container_remove (GTK_CONTAINER (combo->grid), child);
+ }
+ g_list_free (children);
+
+ g_array_set_size (combo->elements, 0);
+}
+
+
+/**
* go_combo_pixmaps_add_element:
* @combo: #GOComboPixmaps
* @pixbuf: (transfer full): #GdkPixbuf
@@ -208,7 +230,6 @@ cb_swatch_key_press (GtkWidget *button, GdkEventKey *event, GOComboPixmaps *comb
* @tooltip: optional
*
**/
-
void
go_combo_pixmaps_add_element (GOComboPixmaps *combo,
GdkPixbuf *pixbuf, int id, char const *tooltip)
diff --git a/goffice/gtk/go-combo-pixmaps.h b/goffice/gtk/go-combo-pixmaps.h
index 2c55c5f..9d1ebab 100644
--- a/goffice/gtk/go-combo-pixmaps.h
+++ b/goffice/gtk/go-combo-pixmaps.h
@@ -38,6 +38,7 @@ typedef struct _GOMenuPixmaps GOMenuPixmaps;
GType go_combo_pixmaps_get_type (void);
GOComboPixmaps *go_combo_pixmaps_new (int ncols);
+void go_combo_pixmaps_clear_elements (GOComboPixmaps *combo);
void go_combo_pixmaps_add_element (GOComboPixmaps *combo,
GdkPixbuf *pixbuf, int id,
char const *tooltip);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]