diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-04-13 05:36:46 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-04-13 05:36:46 +0000 |
| commit | c99316f9975a7d8c990e1af9d7b72f95a4b0d58d (patch) | |
| tree | e7dae76b0f5267ef3cf59a36da94d665a77656bb | |
| parent | Minor fix of pointer check. (diff) | |
| download | inkscape-c99316f9975a7d8c990e1af9d7b72f95a4b0d58d.tar.gz inkscape-c99316f9975a7d8c990e1af9d7b72f95a4b0d58d.zip | |
Added method to fetch currently active text.
(bzr r9322)
| -rw-r--r-- | src/ege-select-one-action.cpp | 15 | ||||
| -rw-r--r-- | src/ege-select-one-action.h | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 50967ecb2..834b06b3b 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -278,6 +278,21 @@ gint ege_select_one_action_get_active( EgeSelectOneAction* action ) return action->private_data->active; } +gchar *ege_select_one_action_get_active_text( EgeSelectOneAction* action ) +{ + GtkTreeIter iter; + gchar *str = 0; + g_return_val_if_fail( IS_EGE_SELECT_ONE_ACTION(action), 0 ); + + if ( gtk_tree_model_iter_nth_child( action->private_data->model, &iter, NULL, action->private_data->active ) ) { + gtk_tree_model_get( action->private_data->model, &iter, + action->private_data->labelColumn, &str, + -1 ); + } + + return str; +} + void ege_select_one_action_set_active( EgeSelectOneAction* action, gint val ) { g_object_set( G_OBJECT(action), "active", val, NULL ); diff --git a/src/ege-select-one-action.h b/src/ege-select-one-action.h index d0c9d6de7..2ecf7efc5 100644 --- a/src/ege-select-one-action.h +++ b/src/ege-select-one-action.h @@ -122,6 +122,14 @@ GtkTreeModel *ege_select_one_action_get_model(EgeSelectOneAction* action ); gint ege_select_one_action_get_active( EgeSelectOneAction* action ); /** + * Returns the text of the currently selected item. + * + * @param action The action to fetch the text for. + * @return the selected text. The caller is responsible to call g_free() on it when done. + */ +gchar *ege_select_one_action_get_active_text( EgeSelectOneAction* action ); + +/** * Sets the currently selected item. * * @param action The action to fetch the selected index for. |
