static void gtk_tool_button_sync_action_properties (GtkActivatable *activatable, GtkAction *action) { GtkToolButton *button; GIcon *icon; const gchar *stock_id; GtkIconSet *icon_set = NULL; parent_activatable_iface->sync_action_properties (activatable, action); if (!action) return; if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; stock_id = gtk_action_get_stock_id (action); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); gtk_tool_button_set_use_underline (button, TRUE); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_tool_button_set_stock_id (button, stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); if (stock_id) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS; icon_set = gtk_icon_factory_lookup_default (stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; } if (icon_set != NULL) gtk_tool_button_set_icon_widget (button, NULL); else if ((icon = gtk_action_get_gicon (action)) != NULL) { GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); GtkWidget *image = gtk_tool_button_get_icon_widget (button); if (!image) { image = gtk_image_new (); gtk_widget_show (image); gtk_tool_button_set_icon_widget (button, image); } gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (gtk_action_get_icon_name (action)) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); else gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); }
static void action_task_list_new_cb (GtkAction *action, ETaskShellView *task_shell_view) { EShell *shell; EShellView *shell_view; EShellWindow *shell_window; ESourceRegistry *registry; ECalClientSourceType source_type; GtkWidget *config; GtkWidget *dialog; const gchar *icon_name; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); registry = e_shell_get_registry (shell); source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS; config = e_cal_source_config_new (registry, NULL, source_type); dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); gtk_window_set_transient_for ( GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); icon_name = gtk_action_get_icon_name (action); gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_window_set_title (GTK_WINDOW (dialog), _("New Task List")); gtk_widget_show (dialog); }
static void action_address_book_new_cb (GtkAction *action, EBookShellView *book_shell_view) { EShellView *shell_view; EShellWindow *shell_window; ESourceRegistry *registry; GtkWidget *config; GtkWidget *dialog; const gchar *icon_name; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); registry = book_shell_view->priv->registry; config = e_book_source_config_new (registry, NULL); dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); gtk_window_set_transient_for ( GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); icon_name = gtk_action_get_icon_name (action); gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_window_set_title (GTK_WINDOW (dialog), _("New Address Book")); gtk_widget_show (dialog); }
static void build_menu (NemoBlankDesktopWindow *window) { if (window->details->popup_menu) { return; } NemoActionManager *desktop_action_manager = nemo_desktop_manager_get_action_manager (); if (window->details->actions_changed_id == 0) { window->details->actions_changed_id = g_signal_connect_swapped (desktop_action_manager, "changed", G_CALLBACK (actions_changed_cb), window); } GList *action_list = nemo_action_manager_list_actions (desktop_action_manager); if (g_list_length (action_list) == 0) return; window->details->popup_menu = gtk_menu_new (); gboolean show; g_object_get (gtk_settings_get_default (), "gtk-menu-images", &show, NULL); gtk_menu_attach_to_widget (GTK_MENU (window->details->popup_menu), GTK_WIDGET (window), NULL); GtkWidget *item; GList *l; NemoAction *action; for (l = action_list; l != NULL; l = l->next) { action = l->data; if (action->show_in_blank_desktop && action->dbus_satisfied) { gchar *label = nemo_action_get_label (action, NULL, NULL); item = gtk_image_menu_item_new_with_mnemonic (label); g_free (label); const gchar *stock_id = gtk_action_get_stock_id (GTK_ACTION (action)); const gchar *icon_name = gtk_action_get_icon_name (GTK_ACTION (action)); if (stock_id || icon_name) { GtkWidget *image = stock_id ? gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU) : gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), show); } gtk_widget_set_visible (item, TRUE); g_signal_connect (item, "activate", G_CALLBACK (action_activated_callback), action); gtk_menu_shell_append (GTK_MENU_SHELL (window->details->popup_menu), item); } } }
static void activatable_update_icon_name (GtkImageMenuItem *image_menu_item, GtkAction *action) { GtkWidget *image; const gchar *icon_name = gtk_action_get_icon_name (action); image = gtk_image_menu_item_get_image (image_menu_item); if (GTK_IS_IMAGE (image) && (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY || gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME)) { gtk_image_set_from_icon_name (GTK_IMAGE (image), icon_name, GTK_ICON_SIZE_MENU); } }
static gboolean activatable_update_icon_name (GtkImageMenuItem *image_menu_item, GtkAction *action) { const gchar *icon_name = gtk_action_get_icon_name (action); if (icon_name) { GtkWidget *image; image = gtk_image_menu_item_ensure_image (image_menu_item); gtk_image_set_from_icon_name (GTK_IMAGE (image), icon_name, GTK_ICON_SIZE_MENU); return TRUE; } return FALSE; }
static void gtk_tool_button_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { GtkToolButton *button; GtkWidget *image; parent_activatable_iface->update (activatable, action, property_name); if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); if (strcmp (property_name, "short-label") == 0) gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); else if (strcmp (property_name, "stock-id") == 0) gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action)); else if (strcmp (property_name, "gicon") == 0) { const gchar *stock_id = gtk_action_get_stock_id (action); GIcon *icon = gtk_action_get_gicon (action); GtkIconSize icon_size = GTK_ICON_SIZE_BUTTON; if ((stock_id && gtk_icon_factory_lookup_default (stock_id)) || !icon) image = NULL; else { image = gtk_tool_button_get_icon_widget (button); icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); if (!image) image = gtk_image_new (); } gtk_tool_button_set_icon_widget (button, image); gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (strcmp (property_name, "icon-name") == 0) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); }
static void action_task_list_properties_cb (GtkAction *action, ETaskShellView *task_shell_view) { EShellView *shell_view; EShellWindow *shell_window; ETaskShellSidebar *task_shell_sidebar; ECalClientSourceType source_type; ESource *source; ESourceSelector *selector; ESourceRegistry *registry; GtkWidget *config; GtkWidget *dialog; const gchar *icon_name; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); source = e_source_selector_ref_primary_selection (selector); g_return_if_fail (source != NULL); source_type = E_CAL_CLIENT_SOURCE_TYPE_TASKS; registry = e_source_selector_get_registry (selector); config = e_cal_source_config_new (registry, source, source_type); g_object_unref (source); dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); gtk_window_set_transient_for ( GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); icon_name = gtk_action_get_icon_name (action); gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_window_set_title (GTK_WINDOW (dialog), _("Task List Properties")); gtk_widget_show (dialog); }
static void action_address_book_properties_cb (GtkAction *action, EBookShellView *book_shell_view) { EShellView *shell_view; EShellWindow *shell_window; EBookShellSidebar *book_shell_sidebar; ESource *source; ESourceSelector *selector; ESourceRegistry *registry; GtkWidget *config; GtkWidget *dialog; const gchar *icon_name; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); book_shell_sidebar = book_shell_view->priv->book_shell_sidebar; selector = e_book_shell_sidebar_get_selector (book_shell_sidebar); source = e_source_selector_ref_primary_selection (selector); g_return_if_fail (source != NULL); registry = e_source_selector_get_registry (selector); config = e_book_source_config_new (registry, source); g_object_unref (source); dialog = e_source_config_dialog_new (E_SOURCE_CONFIG (config)); gtk_window_set_transient_for ( GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); icon_name = gtk_action_get_icon_name (action); gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_window_set_title ( GTK_WINDOW (dialog), _("Address Book Properties")); gtk_widget_show (dialog); }
void e_composer_actions_init (EMsgComposer *composer) { GtkActionGroup *action_group; GtkAccelGroup *accel_group; GtkUIManager *ui_manager; EHTMLEditor *editor; EContentEditor *cnt_editor; gboolean visible; GIcon *gcr_gnupg_icon; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); editor = e_msg_composer_get_editor (composer); cnt_editor = e_html_editor_get_content_editor (editor); ui_manager = e_html_editor_get_ui_manager (editor); /* Composer Actions */ action_group = composer->priv->composer_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, entries, G_N_ELEMENTS (entries), composer); gtk_action_group_add_toggle_actions ( action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Asynchronous Actions */ action_group = composer->priv->async_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, async_entries, G_N_ELEMENTS (async_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Character Set Actions */ action_group = composer->priv->charset_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); e_charset_add_radio_actions ( action_group, "charset-", composer->priv->charset, G_CALLBACK (action_charset_cb), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Fine Tuning */ g_object_set ( ACTION (ATTACH), "short-label", _("Attach"), NULL); g_object_set ( ACTION (PICTURE_GALLERY), "is-important", TRUE, NULL); g_object_set ( ACTION (SAVE_DRAFT), "short-label", _("Save Draft"), NULL); #define init_toolbar_option(x, always_visible) \ gtk_action_set_visible (ACTION (TOOLBAR_ ## x), always_visible); \ e_binding_bind_property ( \ ACTION (x), "active", \ ACTION (TOOLBAR_ ## x), "active", \ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); \ e_binding_bind_property ( \ ACTION (x), "label", \ ACTION (TOOLBAR_ ## x), "label", \ G_BINDING_SYNC_CREATE); \ e_binding_bind_property ( \ ACTION (x), "tooltip", \ ACTION (TOOLBAR_ ## x), "tooltip", \ G_BINDING_SYNC_CREATE); \ e_binding_bind_property ( \ ACTION (x), "sensitive", \ ACTION (TOOLBAR_ ## x), "sensitive", \ G_BINDING_SYNC_CREATE); \ g_signal_connect (ACTION (TOOLBAR_ ## x), "toggled", \ G_CALLBACK (composer_actions_toolbar_option_toggled_cb), composer); init_toolbar_option (PGP_SIGN, FALSE); init_toolbar_option (PGP_ENCRYPT, FALSE); init_toolbar_option (PRIORITIZE_MESSAGE, TRUE); init_toolbar_option (REQUEST_READ_RECEIPT, TRUE); init_toolbar_option (SMIME_SIGN, FALSE); init_toolbar_option (SMIME_ENCRYPT, FALSE); #undef init_toolbar_option /* Borrow a GnuPG icon from gcr to distinguish between GPG and S/MIME Sign/Encrypt actions */ gcr_gnupg_icon = g_themed_icon_new ("gcr-gnupg"); if (gcr_gnupg_icon) { GIcon *temp_icon; GIcon *action_icon; GEmblem *emblem; GtkAction *action; emblem = g_emblem_new (gcr_gnupg_icon); action = ACTION (TOOLBAR_PGP_SIGN); action_icon = g_themed_icon_new (gtk_action_get_icon_name (action)); temp_icon = g_emblemed_icon_new (action_icon, emblem); g_object_unref (action_icon); gtk_action_set_gicon (action, temp_icon); g_object_unref (temp_icon); action = ACTION (TOOLBAR_PGP_ENCRYPT); action_icon = g_themed_icon_new (gtk_action_get_icon_name (action)); temp_icon = g_emblemed_icon_new (action_icon, emblem); g_object_unref (action_icon); gtk_action_set_gicon (action, temp_icon); g_object_unref (temp_icon); g_object_unref (emblem); g_object_unref (gcr_gnupg_icon); } e_binding_bind_property ( cnt_editor, "html-mode", ACTION (PICTURE_GALLERY), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "edit-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "format-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "insert-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "options-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "picture-gallery"), "sensitive", G_BINDING_SYNC_CREATE); #if defined (ENABLE_SMIME) visible = TRUE; #else visible = FALSE; #endif gtk_action_set_visible (ACTION (SMIME_ENCRYPT), visible); gtk_action_set_visible (ACTION (SMIME_SIGN), visible); accel_group = gtk_ui_manager_get_accel_group (ui_manager); g_signal_connect (accel_group, "accel-activate", G_CALLBACK (composer_actions_accel_activate_cb), composer); }
GtkWidget * gimp_action_view_new (GimpUIManager *manager, const gchar *select_action, gboolean show_shortcuts) { GtkTreeView *view; GtkTreeViewColumn *column; GtkCellRenderer *cell; GtkTreeStore *store; GtkTreeModel *filter; GtkAccelGroup *accel_group; GList *list; GtkTreePath *select_path = NULL; g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), NULL); store = gtk_tree_store_new (GIMP_ACTION_VIEW_N_COLUMNS, G_TYPE_BOOLEAN, /* COLUMN_VISIBLE */ GTK_TYPE_ACTION, /* COLUMN_ACTION */ G_TYPE_STRING, /* COLUMN_ICON_NAME */ G_TYPE_STRING, /* COLUMN_LABEL */ G_TYPE_STRING, /* COLUMN_LABEL_CASEFOLD */ G_TYPE_STRING, /* COLUMN_NAME */ G_TYPE_UINT, /* COLUMN_ACCEL_KEY */ GDK_TYPE_MODIFIER_TYPE, /* COLUMN_ACCEL_MASK */ G_TYPE_CLOSURE); /* COLUMN_ACCEL_CLOSURE */ accel_group = gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (manager)); for (list = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (manager)); list; list = g_list_next (list)) { GimpActionGroup *group = list->data; GList *actions; GList *list2; GtkTreeIter group_iter; gtk_tree_store_append (store, &group_iter, NULL); gtk_tree_store_set (store, &group_iter, GIMP_ACTION_VIEW_COLUMN_ICON_NAME, group->icon_name, GIMP_ACTION_VIEW_COLUMN_LABEL, group->label, -1); actions = gtk_action_group_list_actions (GTK_ACTION_GROUP (group)); actions = g_list_sort (actions, (GCompareFunc) gimp_action_name_compare); for (list2 = actions; list2; list2 = g_list_next (list2)) { GtkAction *action = list2->data; const gchar *name = gtk_action_get_name (action); const gchar *icon_name = gtk_action_get_icon_name (action); gchar *label; gchar *label_casefold; guint accel_key = 0; GdkModifierType accel_mask = 0; GClosure *accel_closure = NULL; GtkTreeIter action_iter; if (gimp_action_is_gui_blacklisted (name)) continue; label = gimp_strip_uline (gtk_action_get_label (action)); if (! (label && strlen (label))) { g_free (label); label = g_strdup (name); } label_casefold = g_utf8_casefold (label, -1); if (show_shortcuts) { accel_closure = gtk_action_get_accel_closure (action); if (accel_closure) { GtkAccelKey *key; key = gtk_accel_group_find (accel_group, gimp_action_view_accel_find_func, accel_closure); if (key && key->accel_key && key->accel_flags & GTK_ACCEL_VISIBLE) { accel_key = key->accel_key; accel_mask = key->accel_mods; } } } gtk_tree_store_append (store, &action_iter, &group_iter); gtk_tree_store_set (store, &action_iter, GIMP_ACTION_VIEW_COLUMN_VISIBLE, TRUE, GIMP_ACTION_VIEW_COLUMN_ACTION, action, GIMP_ACTION_VIEW_COLUMN_ICON_NAME, icon_name, GIMP_ACTION_VIEW_COLUMN_LABEL, label, GIMP_ACTION_VIEW_COLUMN_LABEL_CASEFOLD, label_casefold, GIMP_ACTION_VIEW_COLUMN_NAME, name, GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY, accel_key, GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK, accel_mask, GIMP_ACTION_VIEW_COLUMN_ACCEL_CLOSURE, accel_closure, -1); g_free (label); g_free (label_casefold); if (select_action && ! strcmp (select_action, name)) { select_path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &action_iter); } } g_list_free (actions); } filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL); g_object_unref (store); view = g_object_new (GIMP_TYPE_ACTION_VIEW, "model", filter, "rules-hint", TRUE, NULL); g_object_unref (filter); gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter), GIMP_ACTION_VIEW_COLUMN_VISIBLE); GIMP_ACTION_VIEW (view)->manager = g_object_ref (manager); GIMP_ACTION_VIEW (view)->show_shortcuts = show_shortcuts; gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), GIMP_ACTION_VIEW_COLUMN_LABEL); column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Action")); cell = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell, FALSE); gtk_tree_view_column_set_attributes (column, cell, "icon-name", GIMP_ACTION_VIEW_COLUMN_ICON_NAME, NULL); cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_set_attributes (column, cell, "text", GIMP_ACTION_VIEW_COLUMN_LABEL, NULL); gtk_tree_view_append_column (view, column); if (show_shortcuts) { g_signal_connect (view, "button-press-event", G_CALLBACK (gimp_action_view_button_press), NULL); g_signal_connect (accel_group, "accel-changed", G_CALLBACK (gimp_action_view_accel_changed), view); column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Shortcut")); cell = gtk_cell_renderer_accel_new (); g_object_set (cell, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, "editable", TRUE, NULL); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_set_attributes (column, cell, "accel-key", GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY, "accel-mods", GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK, NULL); g_signal_connect (cell, "accel-edited", G_CALLBACK (gimp_action_view_accel_edited), view); g_signal_connect (cell, "accel-cleared", G_CALLBACK (gimp_action_view_accel_cleared), view); gtk_tree_view_append_column (view, column); } column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Name")); cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_set_attributes (column, cell, "text", GIMP_ACTION_VIEW_COLUMN_NAME, NULL); gtk_tree_view_append_column (view, column); if (select_path) { gimp_action_view_select_path (GIMP_ACTION_VIEW (view), select_path); gtk_tree_path_free (select_path); } return GTK_WIDGET (view); }
static void seahorse_generate_select_constructed (GObject *obj) { SeahorseGenerateSelect *self = SEAHORSE_GENERATE_SELECT (obj); gchar *text; GtkCellRenderer *pixcell; GtkTreeSelection *selection; GtkTreeIter iter; GList *actions; GList *l, *k; GIcon *icon; GtkBuilder *builder; const gchar *path; GError *error = NULL; const gchar *icon_name; GtkAction *action; G_OBJECT_CLASS (seahorse_generate_select_parent_class)->constructed (obj); self->store = gtk_list_store_new (COLUMN_N_COLUMNS, G_TYPE_ICON, G_TYPE_STRING, GTK_TYPE_ACTION); gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (self->store), on_list_sort, NULL, NULL); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->store), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); self->action_groups = seahorse_registry_object_instances ("generator"); for (l = self->action_groups; l != NULL; l = g_list_next (l)) { actions = gtk_action_group_list_actions (l->data); for (k = actions; k != NULL; k = g_list_next (k)) { action = k->data; text = g_strdup_printf (TEMPLATE, gtk_action_get_label (action), gtk_action_get_tooltip (action)); icon = gtk_action_get_gicon (action); if (icon == NULL) { icon_name = gtk_action_get_icon_name (action); if (icon_name) icon = g_themed_icon_new (icon_name); gtk_action_get_stock_id (action); } else { g_object_ref (icon); } gtk_list_store_append (self->store, &iter); gtk_list_store_set (self->store, &iter, COLUMN_TEXT, text, COLUMN_ICON, icon, COLUMN_ACTION, k->data, -1); g_clear_object (&icon); } g_list_free (actions); } builder = gtk_builder_new (); path = "/org/gnome/Seahorse/seahorse-generate-select.xml"; gtk_builder_add_from_resource (builder, path, &error); if (error != NULL) { g_warning ("couldn't load ui file: %s", path); g_clear_error (&error); g_object_unref (builder); return; } /* Setup the dialog */ gtk_window_set_modal (GTK_WINDOW (self), TRUE); gtk_window_set_default_size (GTK_WINDOW (self), -1, 410); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), GTK_WIDGET (gtk_builder_get_object (builder, "generate-select")), TRUE, TRUE, 0); gtk_dialog_add_buttons (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Continue"), GTK_RESPONSE_OK, NULL); /* Hook it into the view */ self->view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "keytype-tree")); g_object_unref (builder); pixcell = gtk_cell_renderer_pixbuf_new (); g_object_set (pixcell, "stock-size", GTK_ICON_SIZE_DND, NULL); gtk_tree_view_insert_column_with_attributes (self->view, -1, "", pixcell, "gicon", COLUMN_ICON, NULL); gtk_tree_view_insert_column_with_attributes (self->view, -1, "", gtk_cell_renderer_text_new (), "markup", COLUMN_TEXT, NULL); gtk_tree_view_set_model (self->view, GTK_TREE_MODEL (self->store)); /* Setup selection, select first item */ selection = gtk_tree_view_get_selection (self->view); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->store), &iter); gtk_tree_selection_select_iter (selection, &iter); g_signal_connect (self->view, "row-activated", G_CALLBACK (on_row_activated), self); g_object_set (self->view, "height-request", 410, NULL); g_signal_connect (self, "response", G_CALLBACK (on_response), self); }