summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2010-04-26 08:23:10 +0000
committerJon A. Cruz <jon@joncruz.org>2010-04-26 08:23:10 +0000
commitde755b67163eb082bf839796713db368701de105 (patch)
treefc60daa0c2dc4695ee8ce7ec5368ac042cd3ed6c /src
parentwebslicer is starting to export image pieces (diff)
downloadinkscape-de755b67163eb082bf839796713db368701de105.tar.gz
inkscape-de755b67163eb082bf839796713db368701de105.zip
Add warning dialog for other than "newest" GTK.
(bzr r9376)
Diffstat (limited to 'src')
-rw-r--r--src/ink-comboboxentry-action.cpp24
-rw-r--r--src/ink-comboboxentry-action.h20
2 files changed, 35 insertions, 9 deletions
diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp
index 60332e02e..de0af347c 100644
--- a/src/ink-comboboxentry-action.cpp
+++ b/src/ink-comboboxentry-action.cpp
@@ -7,6 +7,7 @@
*
* Author(s):
* Tavmjong Bah
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2010 Authors
*
@@ -245,6 +246,9 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action)
action->active = -1;
action->text = NULL;
action->entry_completion = NULL;
+#if !GTK_CHECK_VERSION(2,16,0)
+ action->indicator = NULL;
+#endif
action->popup = false;
action->warning = NULL;
action->altx_name = NULL;
@@ -314,7 +318,15 @@ GtkWidget* create_tool_item( GtkAction* action )
{
GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0);
+#if GTK_CHECK_VERSION(2,16,0)
gtk_container_add( GTK_CONTAINER(align), comboBoxEntry );
+#else // GTK_CHECK_VERSION(2,16,0)
+ GtkWidget *hbox = gtk_hbox_new( FALSE, 0 );
+ ink_comboboxentry_action->indicator = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_box_pack_start( GTK_BOX(hbox), comboBoxEntry, TRUE, TRUE, 0 );
+ gtk_box_pack_start( GTK_BOX(hbox), ink_comboboxentry_action->indicator, FALSE, FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER(align), hbox );
+#endif // GTK_CHECK_VERSION(2,16,0)
gtk_container_add( GTK_CONTAINER(item), align );
}
@@ -359,7 +371,9 @@ GtkWidget* create_tool_item( GtkAction* action )
}
+#if GTK_CHECK_VERSION(2,16,0)
gtk_action_connect_proxy( GTK_ACTION( action ), item );
+#endif
gtk_widget_show_all( item );
@@ -430,13 +444,18 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink
gtk_entry_set_icon_tooltip_text( ink_comboboxentry_action->entry,
GTK_ENTRY_ICON_SECONDARY,
ink_comboboxentry_action->warning );
-
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, ink_comboboxentry_action->warning );
#endif // GTK_CHECK_VERSION(2,16,0)
} else {
#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_from_icon_name( GTK_ENTRY(ink_comboboxentry_action->entry),
GTK_ENTRY_ICON_SECONDARY,
NULL );
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), NULL, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, NULL );
#endif // GTK_CHECK_VERSION(2,16,0)
}
}
@@ -486,6 +505,7 @@ void ink_comboboxentry_action_popup_disable( Ink_ComboBoxEntry_Action* action )
if( action->entry_completion ) {
gtk_object_destroy( GTK_OBJECT( action->entry_completion ) );
+ action->entry_completion = 0;
}
}
@@ -500,6 +520,8 @@ void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action,
gtk_entry_set_icon_tooltip_text( GTK_ENTRY(action->entry),
GTK_ENTRY_ICON_SECONDARY,
action->warning );
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(action->indicator), action->warning ? GTK_STOCK_DIALOG_WARNING : 0, GTK_ICON_SIZE_SMALL_TOOLBAR );
#endif // GTK_CHECK_VERSION(2,16,0)
}
}
diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h
index b1228f749..031803d8a 100644
--- a/src/ink-comboboxentry-action.h
+++ b/src/ink-comboboxentry-action.h
@@ -7,6 +7,7 @@
*
* Author(s):
* Tavmjong Bah
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2010 Authors
*
@@ -46,10 +47,13 @@ struct _Ink_ComboBoxEntry_Action {
GtkComboBoxEntry *combobox;
GtkEntry *entry;
GtkEntryCompletion *entry_completion;
+#if !GTK_CHECK_VERSION(2,16,0)
+ GtkWidget *indicator;
+#endif
gpointer cell_data_func; // drop-down menu format
- gint active; // Index of active menu item (-1 if not in list).
+ gint active; // Index of active menu item (-1 if not in list).
gchar *text; // Text of active menu item or entry box.
gint width; // Width of GtkComboBoxEntry in characters.
gboolean popup; // Do we pop-up an entry-completion dialog?
@@ -62,14 +66,14 @@ GType ink_comboboxentry_action_get_type (void);
/**
* Creates a GtkAction subclass that wraps a GtkComboBoxEntry object.
- */
+ */
Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new ( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *stock_id,
- GtkTreeModel *model,
- gint width = -1,
- gpointer cell_data_func = NULL );
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *stock_id,
+ GtkTreeModel *model,
+ gint width = -1,
+ gpointer cell_data_func = NULL );
GtkTreeModel *ink_comboboxentry_action_get_model( Ink_ComboBoxEntry_Action* action );
GtkComboBoxEntry *ink_comboboxentry_action_get_comboboxentry( Ink_ComboBoxEntry_Action* action );