summaryrefslogtreecommitdiffstats
path: root/src/ink-comboboxentry-action.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2013-02-07 11:47:37 +0000
committertavmjong-free <tavmjong@free.fr>2013-02-07 11:47:37 +0000
commita3d3d3df4c67f666083e7c4c2ea56bb94705bbbf (patch)
tree5a9f0a673ca35bbfbfcb1949f8fff24e35ea66ab /src/ink-comboboxentry-action.cpp
parentAdd fonts (and font-lists) used in document to top of Text tool-bar font-fami... (diff)
downloadinkscape-a3d3d3df4c67f666083e7c4c2ea56bb94705bbbf.tar.gz
inkscape-a3d3d3df4c67f666083e7c4c2ea56bb94705bbbf.zip
Add separator between fonts in document and fonts on sytem in font-family drop-down menu.
Separator style depends on GTK theme (may be invisible). (bzr r12105)
Diffstat (limited to 'src/ink-comboboxentry-action.cpp')
-rw-r--r--src/ink-comboboxentry-action.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp
index 78becbd53..5adc3e73a 100644
--- a/src/ink-comboboxentry-action.cpp
+++ b/src/ink-comboboxentry-action.cpp
@@ -53,6 +53,7 @@ enum {
PROP_ENTRY_WIDTH,
PROP_EXTRA_WIDTH,
PROP_CELL_DATA_FUNC,
+ PROP_SEPARATOR_FUNC,
PROP_POPUP,
PROP_FOCUS_WIDGET
};
@@ -109,6 +110,10 @@ static void ink_comboboxentry_action_set_property (GObject *object, guint proper
action->cell_data_func = g_value_get_pointer( value );
break;
+ case PROP_SEPARATOR_FUNC:
+ action->separator_func = g_value_get_pointer( value );
+ break;
+
case PROP_POPUP:
action->popup = g_value_get_boolean( value );
break;
@@ -154,6 +159,10 @@ static void ink_comboboxentry_action_get_property (GObject *object, guint proper
g_value_set_pointer (value, action->cell_data_func);
break;
+ case PROP_SEPARATOR_FUNC:
+ g_value_set_pointer (value, action->separator_func);
+ break;
+
case PROP_POPUP:
g_value_set_boolean (value, action->popup);
break;
@@ -249,6 +258,14 @@ ink_comboboxentry_action_class_init (Ink_ComboBoxEntry_ActionClass *klass)
g_object_class_install_property (
gobject_class,
+ PROP_SEPARATOR_FUNC,
+ g_param_spec_pointer ("separator_func",
+ "Separator Func",
+ "Separator Function",
+ (GParamFlags)G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ gobject_class,
PROP_POPUP,
g_param_spec_boolean ("popup",
"Entry Popup",
@@ -303,6 +320,7 @@ Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new (const gchar *name,
gint entry_width,
gint extra_width,
void *cell_data_func,
+ void *separator_func,
GtkWidget *focusWidget)
{
g_return_val_if_fail (name != NULL, NULL);
@@ -316,6 +334,7 @@ Ink_ComboBoxEntry_Action *ink_comboboxentry_action_new (const gchar *name,
"entry_width", entry_width,
"extra_width", extra_width,
"cell_data_func", cell_data_func,
+ "separator_func", separator_func,
"focus-widget", focusWidget,
NULL);
}
@@ -365,6 +384,13 @@ GtkWidget* create_tool_item( GtkAction* action )
NULL, NULL );
}
+ // Optionally add separator function...
+ if( ink_comboboxentry_action->separator_func != NULL ) {
+ gtk_combo_box_set_row_separator_func( ink_comboboxentry_action->combobox,
+ GtkTreeViewRowSeparatorFunc (ink_comboboxentry_action->separator_func),
+ NULL, NULL );
+ }
+
// Optionally widen the combobox width... which widens the drop-down list in list mode.
if( ink_comboboxentry_action->extra_width > 0 ) {
GtkRequisition req;
@@ -469,7 +495,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink
// Explicitly set text in GtkEntry box (won't be set if text not in list).
gtk_entry_set_text( ink_comboboxentry_action->entry, text );
- // Show or hide warning
+ // Show or hide warning -- this might be better moved to text-toolbox.cpp
bool clear = true;
if( ink_comboboxentry_action->active == -1 &&
ink_comboboxentry_action->warning != NULL ) {