static void charset_combo_box_constructed (GObject *object) { ECharsetComboBoxPrivate *priv; GtkRadioAction *radio_action; GSList *group; priv = E_CHARSET_COMBO_BOX_GET_PRIVATE (object); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_charset_combo_box_parent_class)->constructed (object); radio_action = priv->other_action; group = gtk_radio_action_get_group (radio_action); e_action_combo_box_set_action ( E_ACTION_COMBO_BOX (object), radio_action); e_action_combo_box_add_separator_after ( E_ACTION_COMBO_BOX (object), g_slist_length (group)); e_signal_connect_notify ( object, "notify::charset", G_CALLBACK (charset_combo_box_notify_charset_cb), NULL); }
static void action_combo_box_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_ACTION: e_action_combo_box_set_action ( E_ACTION_COMBO_BOX (object), g_value_get_object (value)); return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); }
void e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; EShellView *shell_view; EShellWindow *shell_window; EShellSearchbar *searchbar; EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; GSList *group; gint ii; shell_view = E_SHELL_VIEW (task_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); action_group = ACTION_GROUP (TASKS_FILTER); e_action_group_remove_all_actions (action_group); /* Add the standard filter actions. No callback is needed * because changes in the EActionComboBox are detected and * handled by EShellSearchbar. */ gtk_action_group_add_radio_actions ( action_group, task_filter_entries, G_N_ELEMENTS (task_filter_entries), TASK_FILTER_ANY_CATEGORY, NULL, NULL); /* Retrieve the radio group from an action we just added. */ list = gtk_action_group_list_actions (action_group); radio_action = GTK_RADIO_ACTION (list->data); group = gtk_radio_action_get_group (radio_action); g_list_free (list); /* Build the category actions. */ list = e_util_dup_searchable_categories (); for (iter = list, ii = 0; iter != NULL; iter = iter->next, ii++) { const gchar *category_name = iter->data; gchar *filename; GtkAction *action; gchar *action_name; action_name = g_strdup_printf ( "task-filter-category-%d", ii); radio_action = gtk_radio_action_new ( action_name, category_name, NULL, NULL, ii); g_free (action_name); /* Convert the category icon file to a themed icon name. */ filename = e_categories_dup_icon_file_for (category_name); if (filename != NULL && *filename != '\0') { gchar *basename; gchar *cp; basename = g_path_get_basename (filename); /* Lose the file extension. */ if ((cp = strrchr (basename, '.')) != NULL) *cp = '\0'; g_object_set ( radio_action, "icon-name", basename, NULL); g_free (basename); } g_free (filename); gtk_radio_action_set_group (radio_action, group); group = gtk_radio_action_get_group (radio_action); /* The action group takes ownership of the action. */ action = GTK_ACTION (radio_action); gtk_action_group_add_action (action_group, action); g_object_unref (radio_action); } g_list_free_full (list, g_free); task_shell_content = task_shell_view->priv->task_shell_content; searchbar = e_task_shell_content_get_searchbar (task_shell_content); combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); e_shell_view_block_execute_search (shell_view); /* Use any action in the group; doesn't matter which. */ e_action_combo_box_set_action (combo_box, radio_action); ii = TASK_FILTER_UNMATCHED; e_action_combo_box_add_separator_after (combo_box, ii); ii = TASK_FILTER_TASKS_WITH_ATTACHMENTS; e_action_combo_box_add_separator_after (combo_box, ii); e_shell_view_unblock_execute_search (shell_view); }