Example #1
0
static void
update_actions_any_cb (EMailReader *reader,
                       guint32 state,
                       GtkActionGroup *action_group)
{
	gboolean sensitive;

	sensitive =
		(state & E_MAIL_READER_SELECTION_SINGLE) ||
		(state & E_MAIL_READER_SELECTION_MULTIPLE);

	gtk_action_group_set_sensitive (action_group, sensitive);
}
Example #2
0
static void
gpview_device_ctrl_update_connected_cb(GObject *unused, GParamSpec *pspec, GPViewDeviceCtrl *ctrl)
{
    GPViewDeviceCtrlPrivate *privat = GPVIEW_DEVICE_CTRL_GET_PRIVATE(ctrl);

    if (privat != NULL)
    {
        gtk_action_group_set_sensitive(
            privat->action_group_connected,
            gparts_database_connected(privat->database)
            );
    }
}
static gboolean
fire_selection_changed (SeahorseKeyserverResults* self)
{
	gint rows;
	GtkTreeSelection* selection;
	g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);

	selection = gtk_tree_view_get_selection (self->pv->view);
	rows = gtk_tree_selection_count_selected_rows (selection);
	if (self->pv->import_actions)
		gtk_action_group_set_sensitive (self->pv->import_actions, rows > 0);
	g_signal_emit_by_name (self, "selection-changed");
	return FALSE;
}
static gboolean 
fire_selection_changed (SeahorseKeyserverResults* self) 
{
	gint rows;
	GtkTreeSelection* selection;
	g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);

	selection = gtk_tree_view_get_selection (self->pv->view);
	rows = gtk_tree_selection_count_selected_rows (selection);
	seahorse_viewer_set_numbered_status (SEAHORSE_VIEWER (self), ngettext ("Selected %d key", "Selected %d keys", rows), rows);
	gtk_action_group_set_sensitive (self->pv->object_actions, rows > 0);
	g_signal_emit_by_name (G_OBJECT (SEAHORSE_VIEW (self)), "selection-changed");
	return FALSE;
}
Example #5
0
static void
update_ui (PlumaSpellPlugin *plugin)
{
	PlumaSpellPluginPrivate *data;
	PlumaWindow *window;
	PlumaDocument *doc;
	PlumaView *view;
	gboolean autospell;
	GtkAction *action;

	pluma_debug (DEBUG_PLUGINS);

	data = plugin->priv;
	window = PLUMA_WINDOW (data->window);
	doc = pluma_window_get_active_document (window);
	view = pluma_window_get_active_view (window);

	autospell = (doc != NULL &&
	             pluma_automatic_spell_checker_get_from_document (doc) != NULL);

	if (doc != NULL)
	{
		PlumaTab *tab;
		PlumaTabState state;

		tab = pluma_window_get_active_tab (window);
		state = pluma_tab_get_state (tab);

		/* If the document is loading we can't get the metadata so we
		   endup with an useless speller */
		if (state == PLUMA_TAB_STATE_NORMAL)
		{
			action = gtk_action_group_get_action (data->action_group,
							      "AutoSpell");
	
			g_signal_handlers_block_by_func (action, auto_spell_cb,
							 plugin);
			set_auto_spell (window, doc, autospell);
			gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
						      autospell);
			g_signal_handlers_unblock_by_func (action, auto_spell_cb,
							   plugin);
		}
	}

	gtk_action_group_set_sensitive (data->action_group,
					(view != NULL) &&
					gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
}
Example #6
0
static void
update_ui_real (GeditWindow *window,
		WindowData *data)
{
	GeditDocument *doc;
	GeditView *view;
	gboolean autospell;
	GtkAction *action;

	gedit_debug (DEBUG_PLUGINS);

	doc = gedit_window_get_active_document (window);
	view = gedit_window_get_active_view (window);

	autospell = (doc != NULL &&
	             gedit_automatic_spell_checker_get_from_document (doc) != NULL);

	if (doc != NULL)
	{
		GeditTab *tab;
		GeditTabState state;

		tab = gedit_window_get_active_tab (window);
		state = gedit_tab_get_state (tab);

		/* If the document is loading we can't get the metadata so we
		   endup with an useless speller */
		if (state == GEDIT_TAB_STATE_NORMAL)
		{
			action = gtk_action_group_get_action (data->action_group,
							      "AutoSpell");
	
			g_signal_handlers_block_by_func (action, auto_spell_cb,
							 window);
			set_auto_spell (window, doc, autospell);
			gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
						      autospell);
			g_signal_handlers_unblock_by_func (action, auto_spell_cb,
							   window);
		}
	}

	gtk_action_group_set_sensitive (data->action_group,
					(view != NULL) &&
					gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
}
Example #7
0
int
clip_GTK_ACTIONGROUPSETSENSITIVE(ClipMachine * ClipMachineMemory)
{
   C_object *cagroup = _fetch_co_arg(ClipMachineMemory);

   gboolean  sensitive = _clip_parl(ClipMachineMemory, 2);

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object));
   CHECKARG(2, LOGICAL_type_of_ClipVarType);

   gtk_action_group_set_sensitive(GTK_ACTION_GROUP(cagroup->object), sensitive);

   return 0;
 err:
   return 1;
}
Example #8
0
static void _set_admin_mode(GtkToggleAction *action)
{
//	GtkAction *admin_action = NULL;
	if (action)
		working_sview_config.admin_mode
			= gtk_toggle_action_get_active(action);
	if (!working_sview_config.admin_mode)
		gtk_statusbar_pop(GTK_STATUSBAR(main_statusbar),
				  STATUS_ADMIN_MODE);
	else
		gtk_statusbar_push(GTK_STATUSBAR(main_statusbar),
				   STATUS_ADMIN_MODE,
				   "Admin mode activated! "
				   "Think before you alter anything.");

	gtk_action_group_set_sensitive(admin_action_group,
				       working_sview_config.admin_mode);
}
Example #9
0
static void
update_ui_real (CeditWindow  *window,
                WindowData   *data)
{
    CeditView *view;

    cedit_debug (DEBUG_PLUGINS);

    view = cedit_window_get_active_view (window);

    gtk_action_group_set_sensitive (data->ui_action_group,
                                    (view != NULL));

    if (data->dialog != NULL)
    {
        gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog->dialog),
                                           GTK_RESPONSE_OK,
                                           (view != NULL));
    }
}
Example #10
0
static void
update_menu_items (GObject    *gobject,
                   GParamSpec *pspec,
                   gpointer    user_data)
{
	BluetoothApplet *applet = BLUETOOTH_APPLET (gobject);
	gboolean enabled;
	GObject *object;

	enabled = bluetooth_applet_get_show_full_menu (applet);

	object = gtk_builder_get_object (xml, "adapter-action-group");
	gtk_action_group_set_visible (GTK_ACTION_GROUP (object), enabled);
	gtk_action_group_set_visible (devices_action_group, enabled);

	if (enabled == FALSE)
		return;

	gtk_action_group_set_sensitive (GTK_ACTION_GROUP (object), TRUE);
}
Example #11
0
static void
update_menu_items (void)
{
	gboolean enabled;
	GObject *object;

	if (num_adapters_present == 0)
		enabled = FALSE;
	else
		enabled = (num_adapters_present - num_adapters_powered) <= 0;

	object = gtk_builder_get_object (xml, "adapter-action-group");
	gtk_action_group_set_visible (GTK_ACTION_GROUP (object), enabled);
	gtk_action_group_set_visible (devices_action_group, enabled);

	if (enabled == FALSE)
		return;

	gtk_action_group_set_sensitive (GTK_ACTION_GROUP (object), TRUE);
}
Example #12
0
/* Start the compiling process. Called from the main thread. */
void
i7_story_compile(I7Story *story, gboolean release, gboolean refresh)
{
    I7_STORY_USE_PRIVATE(story, priv);

    i7_document_save(I7_DOCUMENT(story));
    i7_story_stop_running_game(story);
    if(priv->copy_blorb_dest_file) {
        g_object_unref(priv->copy_blorb_dest_file);
        priv->copy_blorb_dest_file = NULL;
    }
    if(priv->compiler_output_file) {
        g_object_unref(priv->compiler_output_file);
        priv->compiler_output_file = NULL;
    }
    gtk_action_group_set_sensitive(priv->compile_action_group, FALSE);

    /* Set up the compiler */
    CompilerData *data = g_slice_new0(CompilerData);
    data->story = story;
    data->create_blorb = release && i7_story_get_create_blorb(story);
    data->use_debug_flags = !release;
    data->refresh_only = refresh;

    gchar *filename;
    if(data->create_blorb) {
        if(i7_story_get_story_format(story) == I7_STORY_FORMAT_GLULX)
            filename = g_strdup("output.gblorb");
        else
            filename = g_strdup("output.zblorb");
    } else {
        filename = g_strconcat("output.", i7_story_get_extension(story), NULL);
    }
    data->input_file = i7_document_get_file(I7_DOCUMENT(story));
    data->builddir_file = g_file_get_child(data->input_file, "Build");
    data->output_file = g_file_get_child(data->builddir_file, filename);
    g_free(filename);

    prepare_ni_compiler(data);
    start_ni_compiler(data);
}
Example #13
0
/* Clean up the compiling stuff and notify the user that compiling has finished.
 All compiler tool chains must call this function at the end!! This function is
 called from a child process watch, so the GDK lock is not held and must be
 acquired for any GUI calls. */
static void
finish_compiling(gboolean success, CompilerData *data)
{
    I7_STORY_USE_PRIVATE(data->story, priv);

    /* Display status message */
    gdk_threads_enter();
    i7_document_remove_status_message(I7_DOCUMENT(data->story), COMPILE_OPERATIONS);
    i7_document_flash_status_message(I7_DOCUMENT(data->story),
                                     success? _("Compiling succeeded.") : _("Compiling failed."),
                                     COMPILE_OPERATIONS);

    /* Switch the Results tab to the Report page */
    html_load_file(WEBKIT_WEB_VIEW(data->story->panel[LEFT]->results_tabs[I7_RESULTS_TAB_REPORT]), data->results_file);
    html_load_file(WEBKIT_WEB_VIEW(data->story->panel[RIGHT]->results_tabs[I7_RESULTS_TAB_REPORT]), data->results_file);
    g_signal_connect(data->story->panel[LEFT]->results_tabs[I7_RESULTS_TAB_REPORT], "notify::load-status", G_CALLBACK(on_load_status_finished_reload), NULL);
    g_signal_connect(data->story->panel[RIGHT]->results_tabs[I7_RESULTS_TAB_REPORT], "notify::load-status", G_CALLBACK(on_load_status_finished_reload), NULL);
    i7_story_show_tab(data->story, I7_PANE_RESULTS, I7_RESULTS_TAB_REPORT);

    gtk_action_group_set_sensitive(priv->compile_action_group, TRUE);
    gdk_threads_leave();

    /* Store the compiler output filename (the I7Story now owns the reference) */
    priv->compiler_output_file = data->output_file;

    /* Free the compiler data object */
    g_object_unref(data->input_file);
    g_object_unref(data->builddir_file);
    g_clear_object(&data->results_file);
    g_slice_free(CompilerData, data);

    /* Update */
    gdk_threads_enter();
    while(gtk_events_pending())
        gtk_main_iteration();
    gdk_threads_leave();
}
Example #14
0
 void init_actions(void)
 {
	static const gchar	*group_name[]	= { "default", "online", "offline", "selection", "clipboard", "paste", "filetransfer" };
 	GtkAction				*dunno			= gtk_action_new("Dunno",NULL,NULL,NULL);
	int						f;

	#ifdef DEBUG
		if(ACTION_GROUP_MAX != G_N_ELEMENTS(group_name))
		{
			Trace("Unexpected action_group size, found %d, expecting %d",(int) G_N_ELEMENTS(group_name),(int) ACTION_GROUP_MAX);
			exit(-1);
		}
	#endif

	for(f=0;f<ACTION_GROUP_MAX;f++)
	{
		action_group[f] = gtk_action_group_new(group_name[f]);

		Trace("action(%d): %p %s",f,action_group[f],group_name[f]);
		gtk_action_group_set_translation_domain(action_group[f], PACKAGE_NAME);
	}

	action_group[f] = 0;
	g_object_set_data(G_OBJECT(topwindow),"ActionGroups",action_group);

	for(f=0;f<G_N_ELEMENTS(action_by_id);f++)
		action_by_id[f] = dunno;

#ifdef 	X3270_FT
	set_ft_action_state(hSession,0,NULL);
	register_schange(ST_3270_MODE, set_ft_action_state);
#else
	gtk_action_group_set_sensitive(ft_actions,FALSE);
#endif

 }
Example #15
0
File: tasks.c Project: rosedu/osmo
void 
gui_create_tasks(GUI *appGUI) {

GtkWidget           *vbox1;
GtkWidget           *vbox2;
GtkWidget           *table;
GtkWidget           *label;
GtkWidget           *top_scrolledwindow;
GtkWidget           *hseparator;
GtkWidget           *close_button;
GtkCellRenderer     *renderer;
GtkWidget           *top_viewport;
GtkWidget           *bottom_viewport;
GtkTextBuffer       *text_buffer;
GError              *error = NULL;
GtkActionGroup      *action_group = NULL;
gchar tmpbuf[BUFFER_SIZE];

 const gchar *ui_info =
"  <toolbar name=\"toolbar\">\n"
"    <toolitem name=\"add\" action=\"add\" />\n"
"    <toolitem name=\"delete\" action=\"delete\" />\n"
"    <separator name=\"sep1\" />\n"
"    <toolitem name=\"edit\" action=\"edit\" />\n"
"  </toolbar>\n";

GtkActionEntry entries[] = {
  { "add", OSMO_STOCK_TASKS_ADD, _("New task"), NULL, _("New task"), NULL },
  { "edit", OSMO_STOCK_TASKS_EDIT, _("Edit task"), NULL, _("Edit task"), NULL },
  { "delete", OSMO_STOCK_TASKS_REMOVE, _("Remove task"), NULL, _("Remove task"), NULL },
};

guint n_entries = G_N_ELEMENTS (entries);

    appGUI->tsk->filter_index = 0;

    label = gtk_label_new(NULL);
    gtk_label_set_angle (GTK_LABEL(label), -90.0);
    sprintf(tmpbuf, "<b>%s</b>", _("Tasks"));
    gtk_label_set_markup (GTK_LABEL (label), tmpbuf);

    vbox1 = gtk_vbox_new (FALSE, 1);
    gtk_widget_show (vbox1);
    gtk_container_set_border_width (GTK_CONTAINER (vbox1), 8);
    gtk_notebook_append_page(GTK_NOTEBOOK(appGUI->notebook), vbox1, label);
    appGUI->tsk->vbox = GTK_BOX(vbox1);

    /*-------------------------------------------------------------------------------------*/

    action_group = gtk_action_group_new ("_actions");
    gtk_action_group_add_actions (action_group, entries, n_entries, NULL);
    gtk_action_group_set_sensitive(action_group, TRUE);

    appGUI->tsk->tasks_uim_widget = gtk_ui_manager_new ();

    gtk_ui_manager_insert_action_group (appGUI->tsk->tasks_uim_widget, action_group, 0);
    g_signal_connect (appGUI->tsk->tasks_uim_widget, "add_widget", G_CALLBACK (add_tasks_toolbar_widget), appGUI);

    if (!gtk_ui_manager_add_ui_from_string (appGUI->tsk->tasks_uim_widget, ui_info, -1, &error)) {
        g_message ("building toolbar failed: %s", error->message);
        g_error_free (error);
    }
    gtk_ui_manager_ensure_update (appGUI->tsk->tasks_uim_widget);

    gtk_toolbar_set_style (appGUI->tsk->tasks_toolbar, GTK_TOOLBAR_ICONS);
    gtk_toolbar_set_tooltips (appGUI->tsk->tasks_toolbar, config.enable_tooltips);

    /*-------------------------------------------------------------------------------------*/
    /* assign callbacks */

    g_signal_connect (G_OBJECT(gtk_ui_manager_get_widget (appGUI->tsk->tasks_uim_widget, "/toolbar/add")), "clicked", 
                      G_CALLBACK(tasks_add_item_cb), appGUI);
    g_signal_connect (G_OBJECT(gtk_ui_manager_get_widget (appGUI->tsk->tasks_uim_widget, "/toolbar/edit")), "clicked", 
                      G_CALLBACK(tasks_edit_item_cb), appGUI);
    g_signal_connect (G_OBJECT(gtk_ui_manager_get_widget (appGUI->tsk->tasks_uim_widget, "/toolbar/delete")), "clicked", 
                      G_CALLBACK(tasks_remove_item_cb), appGUI);

    /*-------------------------------------------------------------------------------------*/

    gtk_widget_set_sensitive(gtk_ui_manager_get_widget (appGUI->tsk->tasks_uim_widget, "/toolbar/edit"), FALSE);
    gtk_widget_set_sensitive(gtk_ui_manager_get_widget (appGUI->tsk->tasks_uim_widget, "/toolbar/delete"), FALSE);

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 6);

    table = gtk_table_new (1, 4, FALSE);
    gtk_widget_show (table);
    gtk_box_pack_start (GTK_BOX (vbox1), table, FALSE, TRUE, 0);
    gtk_table_set_col_spacings (GTK_TABLE (table), 8);

    sprintf(tmpbuf, "<b>%s:</b>", _("Category filter"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    appGUI->tsk->cf_combobox = gtk_combo_box_new_text ();
    gtk_widget_show (appGUI->tsk->cf_combobox);
    gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (appGUI->tsk->cf_combobox), FALSE);
    GTK_WIDGET_UNSET_FLAGS(appGUI->tsk->cf_combobox, GTK_CAN_FOCUS);
    gtk_table_attach (GTK_TABLE (table), appGUI->tsk->cf_combobox, 1, 2, 0, 1,
                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                     (GtkAttachOptions) (GTK_FILL), 0, 0);
    g_signal_connect(appGUI->tsk->cf_combobox, "changed", 
                     G_CALLBACK(category_filter_cb), appGUI);
    g_signal_connect(G_OBJECT(appGUI->tsk->cf_combobox), "focus", 
                     G_CALLBACK(category_combo_box_focus_cb), NULL);

    appGUI->tsk->n_items_label = gtk_label_new ("");
    gtk_widget_show (appGUI->tsk->n_items_label);
    gtk_widget_set_size_request (appGUI->tsk->n_items_label, 100, -1);
    gtk_table_attach (GTK_TABLE (table), appGUI->tsk->n_items_label, 3, 4, 0, 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_use_markup (GTK_LABEL (appGUI->tsk->n_items_label), TRUE);

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 6);

    /*-------------------------------------------------------------------------------------*/

    appGUI->tsk->tasks_paned = gtk_vpaned_new();
    gtk_widget_show (appGUI->tsk->tasks_paned);
    gtk_paned_set_position(GTK_PANED(appGUI->tsk->tasks_paned), 99999);
    gtk_box_pack_start(GTK_BOX(vbox1), appGUI->tsk->tasks_paned, TRUE, TRUE, 0);

    top_viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (top_viewport);
    gtk_viewport_set_shadow_type (GTK_VIEWPORT (top_viewport), GTK_SHADOW_NONE);
    gtk_paned_pack1 (GTK_PANED (appGUI->tsk->tasks_paned), top_viewport, FALSE, TRUE);

    top_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show (top_scrolledwindow);
    gtk_container_add (GTK_CONTAINER (top_viewport), top_scrolledwindow);

    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (top_scrolledwindow), GTK_SHADOW_IN);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (top_scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    appGUI->tsk->tasks_list_store = gtk_list_store_new(TASKS_NUM_COLUMNS, 
                                         G_TYPE_BOOLEAN,
                                         G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING,
                                         G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

    appGUI->tsk->tasks_filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(appGUI->tsk->tasks_list_store), NULL);
    gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER(appGUI->tsk->tasks_filter), 
                                            (GtkTreeModelFilterVisibleFunc)tasks_list_filter_cb, 
                                            appGUI, NULL);

    appGUI->tsk->tasks_sort = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(appGUI->tsk->tasks_filter));

    appGUI->tsk->tasks_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(appGUI->tsk->tasks_sort));
    gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(appGUI->tsk->tasks_list), config.tasks_rules_hint);
    gtk_widget_show (appGUI->tsk->tasks_list);
    GTK_WIDGET_SET_FLAGS (appGUI->tsk->tasks_list, GTK_CAN_DEFAULT);
    gtk_widget_modify_fg(GTK_WIDGET(appGUI->tsk->tasks_list), GTK_STATE_SELECTED,
                         (& GTK_WIDGET(appGUI->tsk->tasks_list)->style->base[GTK_STATE_SELECTED]));
    gtk_widget_modify_fg(GTK_WIDGET(appGUI->tsk->tasks_list), GTK_STATE_NORMAL,
                         (& GTK_WIDGET(appGUI->tsk->tasks_list)->style->bg[GTK_STATE_NORMAL]));

    g_signal_connect(G_OBJECT(appGUI->tsk->tasks_list), "button_press_event",
                     G_CALLBACK(list_dbclick_cb), appGUI);

    appGUI->tsk->tasks_list_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (appGUI->tsk->tasks_list));
    g_signal_connect(G_OBJECT(appGUI->tsk->tasks_list_selection), "changed",
                     G_CALLBACK(tasks_item_selected), appGUI);

    /* create columns */

    renderer = gtk_cell_renderer_toggle_new();
    appGUI->tsk->tasks_columns[COLUMN_DONE] = gtk_tree_view_column_new_with_attributes (_("Done"),
                             renderer,
                             "active", COLUMN_DONE,
                             NULL);
    gtk_tree_view_append_column (GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_DONE]);

    g_signal_connect (renderer, "toggled", G_CALLBACK (done_toggled), appGUI);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_DUE_DATE] = gtk_tree_view_column_new_with_attributes(_("Due date"),
                              renderer,
                              "text", COLUMN_DUE_DATE,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_DUE_DATE], config.visible_due_date_column);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_DUE_DATE]);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_DUE_DATE_JULIAN] = gtk_tree_view_column_new_with_attributes(NULL,
                              renderer,
                              "text", COLUMN_DUE_DATE_JULIAN,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_DUE_DATE_JULIAN], FALSE);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_DUE_DATE_JULIAN]);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_START_DATE_JULIAN] = gtk_tree_view_column_new_with_attributes(NULL,
                              renderer,
                              "text", COLUMN_START_DATE_JULIAN,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_START_DATE_JULIAN], FALSE);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_START_DATE_JULIAN]);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_PRIORITY] = gtk_tree_view_column_new_with_attributes(_("Priority"),
                              renderer,
                              "text", COLUMN_PRIORITY,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_PRIORITY], config.visible_priority_column);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_PRIORITY]);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_CATEGORY] = gtk_tree_view_column_new_with_attributes(_("Category"),
                              renderer,
                              "text", COLUMN_CATEGORY,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_CATEGORY], config.visible_category_column);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_CATEGORY]);

    renderer = gtk_cell_renderer_text_new();
    g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_cell_renderer_set_fixed_size(renderer, 0, -1);
    appGUI->tsk->tasks_columns[COLUMN_SUMMARY] = gtk_tree_view_column_new_with_attributes(_("Summary"),
                              renderer,
                              "text", COLUMN_SUMMARY,
                              "strikethrough", COLUMN_DONE,
                              "foreground", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_SUMMARY]);


    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_DESCRIPTION] = gtk_tree_view_column_new_with_attributes(_("Description"),
                              renderer,
                              "text", COLUMN_DESCRIPTION,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_DESCRIPTION], FALSE);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_DESCRIPTION]);

    renderer = gtk_cell_renderer_text_new();
    appGUI->tsk->tasks_columns[COLUMN_COLOR] = gtk_tree_view_column_new_with_attributes(NULL,
                              renderer,
                              "text", COLUMN_COLOR,
                              NULL);
    gtk_tree_view_column_set_visible (appGUI->tsk->tasks_columns[COLUMN_COLOR], FALSE);
    gtk_tree_view_append_column(GTK_TREE_VIEW(appGUI->tsk->tasks_list), appGUI->tsk->tasks_columns[COLUMN_COLOR]);

    /* configure list options */

    gtk_container_add (GTK_CONTAINER (top_scrolledwindow), appGUI->tsk->tasks_list);
    gtk_tree_view_set_enable_search (GTK_TREE_VIEW(appGUI->tsk->tasks_list), FALSE);

    /* configure sorting */

    gtk_tree_sortable_set_sort_func((GtkTreeSortable *)appGUI->tsk->tasks_sort, 0, 
                                    (GtkTreeIterCompareFunc)custom_tasks_sort_function, NULL, NULL);

    gtk_tree_sortable_set_sort_column_id((GtkTreeSortable *)appGUI->tsk->tasks_sort, COLUMN_DUE_DATE, config.tasks_sorting_order);
    gtk_tree_sortable_set_sort_column_id((GtkTreeSortable *)appGUI->tsk->tasks_sort, COLUMN_PRIORITY, config.tasks_sorting_order);
    gtk_tree_sortable_set_sort_column_id((GtkTreeSortable *)appGUI->tsk->tasks_sort, COLUMN_DONE, config.tasks_sorting_order);

    /*----------------------------------------------------------------------------*/

    bottom_viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (bottom_viewport);
    gtk_viewport_set_shadow_type (GTK_VIEWPORT (bottom_viewport), GTK_SHADOW_NONE);
    gtk_paned_pack2 (GTK_PANED (appGUI->tsk->tasks_paned), bottom_viewport, TRUE, TRUE);

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox2);
    gtk_container_set_border_width (GTK_CONTAINER (vbox2), 0);
    gtk_container_add (GTK_CONTAINER (bottom_viewport), vbox2);

    appGUI->tsk->panel_hbox = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox2), appGUI->tsk->panel_hbox, FALSE, FALSE, 0);
    gtk_widget_show(appGUI->tsk->panel_hbox);

    sprintf(tmpbuf, "%s:", _("Task details"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (appGUI->tsk->panel_hbox), label, FALSE, FALSE, 0);

    if (config.default_stock_icons) {
        close_button = gui_stock_button(GTK_STOCK_CLOSE, FALSE);
    } else {
        close_button = gui_stock_button(OSMO_STOCK_BUTTON_CLOSE, FALSE);
    }
    GTK_WIDGET_UNSET_FLAGS(close_button, GTK_CAN_FOCUS);
    gtk_button_set_relief (GTK_BUTTON(close_button), GTK_RELIEF_NONE);
    gtk_tooltips_set_tip (appGUI->osmo_tooltips, close_button, _("Close description panel"), NULL);
    gtk_box_pack_end (GTK_BOX (appGUI->tsk->panel_hbox), close_button, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (close_button), "clicked",
                        G_CALLBACK (panel_close_desc_cb), appGUI);

    appGUI->tsk->panel_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show (appGUI->tsk->panel_scrolledwindow);
    gtk_box_pack_start (GTK_BOX (vbox2), appGUI->tsk->panel_scrolledwindow, TRUE, TRUE, 0);
    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (appGUI->tsk->panel_scrolledwindow), GTK_SHADOW_IN);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (appGUI->tsk->panel_scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    appGUI->tsk->tasks_desc_textview = gtk_text_view_new ();
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (appGUI->tsk->tasks_desc_textview), GTK_WRAP_WORD);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview), 4);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview), 4);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview), 4);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview), FALSE);
    gtk_text_view_set_editable(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview), FALSE);
    gtk_widget_show (appGUI->tsk->tasks_desc_textview);
    gtk_container_add (GTK_CONTAINER (appGUI->tsk->panel_scrolledwindow), appGUI->tsk->tasks_desc_textview);

    text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(appGUI->tsk->tasks_desc_textview));
    gtk_text_buffer_create_tag (text_buffer, "italic",
                  "style", PANGO_STYLE_ITALIC, NULL);
    appGUI->tsk->font_tag_object = gtk_text_buffer_create_tag (text_buffer, "info_font",
                      "font", (gchar *) config.task_info_font, NULL);

}
Example #16
0
 void action_group_set_sensitive(ACTION_GROUP_ID id, gboolean status)
 {
	gtk_action_group_set_sensitive(action_group[id],status);
 }
Example #17
0
 static void set_ft_action_state(H3270 *session,int state,void *dunno)
 {
	gtk_action_group_set_sensitive(action_group[ACTION_GROUP_FT],state);
 }
Example #18
0
/* Returns a menubar widget made from the above menu */
static GtkWidget *_get_menubar_menu(GtkWidget *window, GtkWidget *notebook)
{
	GtkAccelGroup *accel_group = NULL;
	GError *error = NULL;
	char *ui_description;

	GtkActionEntry entries[] = {
		{"actions", NULL, "_Actions", "<alt>a"},
		{"options", NULL, "_Options", "<alt>o"},
		{"displays", NULL, "_Query", "<alt>q"},
		{"batch_job", NULL, "Batch Job", "", "Submit batch job",
		 G_CALLBACK(create_create_popup)},
		{"partition", NULL, "Partition", "", "Create partition",
		 G_CALLBACK(create_create_popup)},
		{"reservation", NULL, "Reservation", "", "Create reservation",
		 G_CALLBACK(create_create_popup)},
		{"search", GTK_STOCK_FIND, "Search", ""},
		{"jobid", NULL, "Job ID",
		 "", "Search for jobid",
		 G_CALLBACK(create_search_popup)},
		{"user_jobs", NULL, "Specific User's Job(s)",
		 "", "Search for a specific users job(s)",
		 G_CALLBACK(create_search_popup)},
		{"state_jobs", NULL, "Job(s) in a Specific State",
		 "", "Search for job(s) in a specific state",
		 G_CALLBACK(create_search_popup)},
		{"partition_name", NULL, "Slurm Partition Name",
		 "", "Search for a specific SLURM partition",
		 G_CALLBACK(create_search_popup)},
		{"partition_state", NULL, "Slurm Partition State",
		 "", "Search for SLURM partitions in a given state",
		 G_CALLBACK(create_search_popup)},
		{"reservation_name", NULL, "Reservation Name",
		 "", "Search for reservation",
		 G_CALLBACK(create_search_popup)},
		{"tab_pos", NULL, "_Tab Position"},
		{"create", GTK_STOCK_ADD, "Create"},
		{"interval", GTK_STOCK_REFRESH, "Set Refresh _Interval",
		 "<control>i", "Change Refresh Interval",
		 G_CALLBACK(change_refresh_popup)},
		{"refresh", GTK_STOCK_REFRESH, "Refresh",
		 "F5", "Refreshes page", G_CALLBACK(refresh_main)},
		{"config", GTK_STOCK_INFO, "_Config Info",
		 "<control>c", "Displays info from slurm.conf file",
		 G_CALLBACK(create_config_popup)},
		{"dbconfig", GTK_STOCK_INFO, "_Database Config Info",
		 "<control>d",
		 "Displays info relevant to the "
		 "configuration of the Slurm Database.",
		 G_CALLBACK(create_dbconfig_popup)},
		{"exit", GTK_STOCK_QUIT, "E_xit",
		 "<control>x", "Exits Program", G_CALLBACK(_delete)},
		{"help", NULL, "_Help", "<alt>h"},
		{"about", GTK_STOCK_ABOUT, "Ab_out", "<control>o",
		 "About", G_CALLBACK(about_popup)},
		{"usage", GTK_STOCK_HELP, "Usage", "",
		 "Usage", G_CALLBACK(usage_popup)},
		//{"manual", GTK_STOCK_HELP, "_Manual", "<control>m"},
		{"grid_specs", GTK_STOCK_EDIT, "Set Grid _Properties",
		 "<control>p", "Change Grid Properties",
		 G_CALLBACK(change_grid_popup)},
		{"defaults", GTK_STOCK_EDIT, "_Set Default Settings",
		 "<control>s", "Change Default Settings",
		 G_CALLBACK(configure_defaults)},
	};

	GtkActionEntry bg_entries[] = {
		{"bg_block_name", NULL, "BG Block Name",
		 "", "Search for a specific BG Block",
		 G_CALLBACK(create_search_popup)},
		{"bg_block_size", NULL, "BG Block Size",
		 "",
		 "Search for BG Blocks having given size in cnodes",
		 G_CALLBACK(create_search_popup)},
		{"bg_block_state", NULL, "BG Block State",
		 "",
		 "Search for BG Blocks having given state",
		 G_CALLBACK(create_search_popup)},
		{"node_name_bg", NULL,
		 "Midplane(s) Name",
		 "", "Search for a specific Midplane(s)",
		 G_CALLBACK(create_search_popup)},
		{"node_state_bg", NULL,
		 "Midplane State",
		 "", "Search for a Midplane in a given state",
		 G_CALLBACK(create_search_popup)},
	};

	GtkActionEntry nonbg_entries[] = {
		{"node_name", NULL,
		 "Node(s) Name",
		 "", "Search for a specific Node(s)",
		 G_CALLBACK(create_search_popup)},
		{"node_state", NULL,
		 "Node State",
		 "", "Search for a Node in a given state",
		 G_CALLBACK(create_search_popup)},
	};

	GtkActionEntry admin_entries[] = {
		{"reconfig", GTK_STOCK_REDO, "SLUR_M Reconfigure",
		 "<control>m", "Reconfigures System",
		 G_CALLBACK(_reconfigure)},
		{"debugflags", GTK_STOCK_DIALOG_WARNING,
		 "Slurmctld DebugFlags",
		 "", "Set slurmctld DebugFlags",
		 G_CALLBACK(_get_current_debug_flags)},
		{"debuglevel", GTK_STOCK_DIALOG_WARNING,
		 "Slurmctld Debug Level",
		 "", "Set slurmctld debug level",
		 G_CALLBACK(_get_current_debug)},
	};

	GtkRadioActionEntry radio_entries[] = {
		{"tab_top", GTK_STOCK_GOTO_TOP, "_Top",
		 "<control>T", "Move tabs to top", GTK_POS_TOP},
		{"tab_bottom", GTK_STOCK_GOTO_BOTTOM, "_Bottom",
		 "<control>B", "Move tabs to the bottom", GTK_POS_BOTTOM},
		{"tab_left", GTK_STOCK_GOTO_FIRST, "_Left",
		 "<control>L", "Move tabs to the Left", GTK_POS_LEFT},
		{"tab_right", GTK_STOCK_GOTO_LAST, "_Right",
		 "<control>R", "Move tabs to the Right", GTK_POS_RIGHT}
	};

	GtkToggleActionEntry toggle_entries[] = {
		{"grid", GTK_STOCK_SELECT_COLOR, "Show _Grid",
		 "<control>g", "Visual display of cluster",
		 G_CALLBACK(_set_grid), working_sview_config.show_grid},
		{"hidden", GTK_STOCK_SELECT_COLOR, "Show _Hidden",
		 "<control>h", "Display Hidden Partitions/Jobs",
		 G_CALLBACK(_set_hidden), working_sview_config.show_hidden},
		{"page_opts", GTK_STOCK_SELECT_COLOR, "Save Page Options",
		 "<control>w", "Save Page Options",
		 G_CALLBACK(_set_page_opts),
		 working_sview_config.save_page_opts},
#ifdef WANT_TOPO_ON_MAIN_OPTIONS
		{"topoorder", GTK_STOCK_SELECT_COLOR, "Set Topology Grid",
		 "<control>t", "Set Topology Grid",
		 G_CALLBACK(_set_topogrid),
		 working_sview_config.grid_topological},
#endif
		{"ruled", GTK_STOCK_SELECT_COLOR, "R_uled Tables",
		 "<control>u", "Have ruled tables or not",
		 G_CALLBACK(_set_ruled), working_sview_config.ruled_treeview},
		{"admin", GTK_STOCK_PREFERENCES,
		 "_Admin Mode", "<control>a",
		 "Allows user to change or update information",
		 G_CALLBACK(_set_admin_mode),
		 working_sview_config.admin_mode}
	};

	GtkRadioActionEntry debug_entries[] = {
		{"debug_quiet", NULL, "quiet(0)", "", "Quiet level", 0},
		{"debug_fatal", NULL, "fatal(1)", "", "Fatal level", 1},
		{"debug_error", NULL, "error(2)", "", "Error level", 2},
		{"debug_info", NULL, "info(3)", "", "Info level", 3},
		{"debug_verbose", NULL, "verbose(4)", "", "Verbose level", 4},
		{"debug_debug", NULL, "debug(5)", "", "Debug debug level", 5},
		{"debug_debug2", NULL, "debug2(6)", "", "Debug2 level", 6},
		{"debug_debug3", NULL, "debug3(7)", "", "Debug3 level", 7},
		{"debug_debug4", NULL, "debug4(8)", "", "Debug4 level", 8},
		{"debug_debug5", NULL, "debug5(9)", "", "Debug5 level", 9},
	};

	char *all_debug_flags = debug_flags2str(0xFFFFFFFFFFFFFFFF);
	char *last = NULL;
	char *tok = strtok_r(all_debug_flags, ",", &last);

	/* set up the global debug_actions */
	debug_actions = xmalloc(sizeof(GtkToggleActionEntry));

	while (tok) {
		xrealloc(debug_actions,
			 (debug_action_entries + 1)
			 * sizeof(GtkToggleActionEntry));
		debug_actions[debug_action_entries].name =
			debug_actions[debug_action_entries].label =
			debug_actions[debug_action_entries].tooltip =
			xstrdup(tok);
		debug_actions[debug_action_entries].callback =
			G_CALLBACK(_set_flags);
		debug_action_entries++;
		tok = strtok_r(NULL, ",", &last);
	}
	xfree(all_debug_flags);

	/* Make an accelerator group (shortcut keys) */
	menu_action_group = gtk_action_group_new ("MenuActions");
	gtk_action_group_add_actions(menu_action_group, entries,
				     G_N_ELEMENTS(entries), window);

	gtk_action_group_add_actions(menu_action_group, bg_entries,
				     G_N_ELEMENTS(bg_entries), window);
	gtk_action_group_add_actions(menu_action_group, nonbg_entries,
				     G_N_ELEMENTS(nonbg_entries),
				     window);

	gtk_action_group_add_radio_actions(menu_action_group, radio_entries,
					   G_N_ELEMENTS(radio_entries),
					   working_sview_config.tab_pos,
					   G_CALLBACK(_tab_pos), notebook);
	gtk_action_group_add_toggle_actions(menu_action_group, debug_actions,
					    debug_action_entries, NULL);
	gtk_action_group_add_radio_actions(menu_action_group, debug_entries,
					   G_N_ELEMENTS(debug_entries),
					   -1, G_CALLBACK(_set_debug),
					   notebook);
	gtk_action_group_add_toggle_actions(menu_action_group, toggle_entries,
					    G_N_ELEMENTS(toggle_entries),
					    NULL);
	admin_action_group = gtk_action_group_new ("MenuAdminActions");
	gtk_action_group_add_actions(admin_action_group, admin_entries,
				     G_N_ELEMENTS(admin_entries),
				     window);
	gtk_action_group_set_sensitive(admin_action_group,
				       working_sview_config.admin_mode);

	g_ui_manager = gtk_ui_manager_new();
	gtk_ui_manager_insert_action_group(g_ui_manager, menu_action_group, 0);
	gtk_ui_manager_insert_action_group(g_ui_manager, admin_action_group, 1);

	accel_group = gtk_ui_manager_get_accel_group(g_ui_manager);
	gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
	ui_description = _get_ui_description();
	if (!(g_menu_id = gtk_ui_manager_add_ui_from_string(
		      g_ui_manager, ui_description, -1, &error))) {
		xfree(ui_description);
		g_error("building menus failed: %s", error->message);
		g_error_free (error);
		exit (0);
	}
	xfree(ui_description);
	/* GList *action_list = */
	/*	gtk_action_group_list_actions(menu_action_group); */
	/* GtkAction *action = NULL; */
	/* int i=0; */
	/* while ((action = g_list_nth_data(action_list, i++))) { */
	/*	g_print("got %s and %x\n", gtk_action_get_name(action), */
	/*		action); */
	/* } */

	/* Get the pointers to the correct action so if we ever need
	   to change it we can effect the action directly so
	   everything stays in sync.
	*/
	default_sview_config.action_admin =
		(GtkToggleAction *)gtk_action_group_get_action(
			menu_action_group, "admin");
	default_sview_config.action_grid =
		(GtkToggleAction *)gtk_action_group_get_action(
			menu_action_group, "grid");
	default_sview_config.action_hidden =
		(GtkToggleAction *)gtk_action_group_get_action(
			menu_action_group, "hidden");
	default_sview_config.action_page_opts =
		(GtkToggleAction *)gtk_action_group_get_action(
			menu_action_group, "page_opts");
//	default_sview_config.action_gridtopo =
//		(GtkToggleAction *)gtk_action_group_get_action(
//			menu_action_group, "topoorder");
	default_sview_config.action_ruled =
		(GtkToggleAction *)gtk_action_group_get_action(
			menu_action_group, "ruled");
	/* Pick the first one of the Radio, it is how GTK references
	   the group in the future.
	*/
	default_sview_config.action_tab =
		(GtkRadioAction *)gtk_action_group_get_action(
			menu_action_group, "tab_top");
	/* g_print("action grid is %x\n", default_sview_config.action_grid); */
	/* Finally, return the actual menu bar created by the item factory. */
	return gtk_ui_manager_get_widget (g_ui_manager, "/main");
}
static void
update_sensitivity (GeditCollaborationWindowHelper *helper)
{
	gboolean has_selection;
	GtkTreeIter selected;
	GtkTreeIter sorted;
	InfcBrowser *browser = NULL;
	InfDiscovery *discovery = NULL;
	GtkTreeModel *model;
	GtkAction *action;
	GtkTreePath *path;
	gboolean toplevel = FALSE;

	model = GTK_TREE_MODEL (helper->priv->browser_store);

	has_selection =
		inf_gtk_browser_view_get_selected (INF_GTK_BROWSER_VIEW (helper->priv->browser_view),
		                                   &sorted);

	if (has_selection)
	{
		gtk_tree_model_sort_convert_iter_to_child_iter (
			GTK_TREE_MODEL_SORT (
				inf_gtk_browser_view_get_model (
					INF_GTK_BROWSER_VIEW (helper->priv->browser_view)
				)
			),
			&selected,
			&sorted
		);
	}

	if (has_selection)
	{
		/* Check if the iter is a top-level (aka. browser node) */
		gtk_tree_model_get (model,
		                    &selected,
		                    INF_GTK_BROWSER_MODEL_COL_BROWSER,
		                    &browser,
		                    INF_GTK_BROWSER_MODEL_COL_DISCOVERY,
		                    &discovery,
		                    -1);

		path = gtk_tree_model_get_path (model, &selected);
		toplevel = gtk_tree_path_get_depth (path) == 1;
		gtk_tree_path_free (path);
	}

	gtk_action_group_set_sensitive (get_action_group (helper, "action_group_connected"),
	                                browser != NULL &&
	                                infc_browser_get_status (browser) == INFC_BROWSER_CONNECTED);

	action = get_action (helper, "SessionDisconnect");
	gtk_action_set_sensitive (action,
	                          toplevel &&
	                          browser != NULL &&
	                          infc_browser_get_status (browser) != INFC_BROWSER_DISCONNECTED);

	/* Handle other actions manually */
	action = get_action (helper, "ItemDelete");
	gtk_action_set_sensitive (action,
	                          has_selection &&
	                          (!toplevel || (
	                          discovery == NULL &&
	                          (browser == NULL ||
	                           infc_browser_get_status (browser) != INFC_BROWSER_CONNECTED))));


	action = get_action (helper, "BookmarkEdit");
	gtk_action_set_sensitive (action,
	                          has_selection &&
	                          discovery == NULL &&
	                          toplevel);

	if (browser)
	{
		g_object_unref (browser);
	}

	if (discovery)
	{
		g_object_unref (discovery);
	}
}
Example #20
0
static void remmina_main_init(RemminaMain *remminamain)
{
	RemminaMainPriv *priv;
	GtkWidget *vbox;
	GtkWidget *menubar;
	GtkWidget *hbox;
	GtkWidget *quickconnect;
	GtkWidget *tool_item;
	GtkUIManager *uimanager;
	GtkActionGroup *action_group;
	GtkWidget *scrolledwindow;
	GtkWidget *tree;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;
	GError *error;

	priv = g_new0(RemminaMainPriv, 1);
	remminamain->priv = priv;

	remminamain->priv->expanded_group = remmina_string_array_new_from_string(remmina_pref.expanded_group);

	/* Create main window */
	g_signal_connect(G_OBJECT(remminamain), "delete-event", G_CALLBACK(remmina_main_on_delete_event), NULL);
	g_signal_connect(G_OBJECT(remminamain), "destroy", G_CALLBACK(remmina_main_destroy), NULL);
	g_signal_connect(G_OBJECT(remminamain), "window-state-event", G_CALLBACK(remmina_main_on_window_state_event), NULL);
	gtk_container_set_border_width(GTK_CONTAINER(remminamain), 0);
	gtk_window_set_title(GTK_WINDOW(remminamain), _("Remmina Remote Desktop Client"));
	gtk_window_set_default_size(GTK_WINDOW(remminamain), remmina_pref.main_width, remmina_pref.main_height);
	gtk_window_set_position(GTK_WINDOW(remminamain), GTK_WIN_POS_CENTER);
	if (remmina_pref.main_maximize)
	{
		gtk_window_maximize(GTK_WINDOW(remminamain));
	}

	/* Create the main container */
#if GTK_VERSION == 3
	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
#elif GTK_VERSION == 2
	vbox = gtk_vbox_new(FALSE, 0);
#endif
	gtk_container_add(GTK_CONTAINER(remminamain), vbox);
	gtk_widget_show(vbox);

	/* Create the menubar and toolbar */
	uimanager = gtk_ui_manager_new();
	priv->uimanager = uimanager;

	action_group = gtk_action_group_new("RemminaMainActions");
	gtk_action_group_set_translation_domain(action_group, NULL);
	gtk_action_group_add_actions(action_group, remmina_main_ui_menu_entries, G_N_ELEMENTS(remmina_main_ui_menu_entries),
			remminamain);
	gtk_action_group_add_toggle_actions(action_group, remmina_main_ui_toggle_menu_entries,
			G_N_ELEMENTS(remmina_main_ui_toggle_menu_entries), remminamain);
	gtk_action_group_add_radio_actions(action_group, remmina_main_ui_view_file_mode_entries,
			G_N_ELEMENTS(remmina_main_ui_view_file_mode_entries), remmina_pref.view_file_mode,
			G_CALLBACK(remmina_main_action_view_file_mode), remminamain);

	gtk_ui_manager_insert_action_group(uimanager, action_group, 0);
	g_object_unref(action_group);
	priv->main_group = action_group;

	action_group = gtk_action_group_new("RemminaMainFileSensitiveActions");
	gtk_action_group_set_translation_domain(action_group, NULL);
	gtk_action_group_add_actions(action_group, remmina_main_ui_file_sensitive_menu_entries,
			G_N_ELEMENTS(remmina_main_ui_file_sensitive_menu_entries), remminamain);

	gtk_ui_manager_insert_action_group(uimanager, action_group, 0);
	g_object_unref(action_group);
	priv->file_sensitive_group = action_group;

	error = NULL;
	gtk_ui_manager_add_ui_from_string(uimanager, remmina_main_ui_xml, -1, &error);
	if (error)
	{
		g_message("building menus failed: %s", error->message);
		g_error_free(error);
	}

	remmina_plugin_manager_for_each_plugin(REMMINA_PLUGIN_TYPE_TOOL, remmina_main_add_tool_plugin, remminamain);

	menubar = gtk_ui_manager_get_widget(uimanager, "/MenuBar");
	gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);

	priv->toolbar = gtk_ui_manager_get_widget(uimanager, "/ToolBar");
#if GTK_VERSION == 3
	gtk_style_context_add_class(gtk_widget_get_style_context(priv->toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
#endif
	gtk_box_pack_start(GTK_BOX(vbox), priv->toolbar, FALSE, FALSE, 0);

	tool_item = gtk_ui_manager_get_widget(uimanager, "/ToolBar/ConnectionConnect");
	gtk_tool_item_set_is_important (GTK_TOOL_ITEM(tool_item), TRUE);

	tool_item = gtk_ui_manager_get_widget(uimanager, "/ToolBar/ConnectionNew");
	gtk_tool_item_set_is_important (GTK_TOOL_ITEM(tool_item), TRUE);

	remmina_main_create_quick_search(remminamain);

	gtk_window_add_accel_group(GTK_WINDOW(remminamain), gtk_ui_manager_get_accel_group(uimanager));

	gtk_action_group_set_sensitive(priv->file_sensitive_group, FALSE);

	/* Add a Fast Connection box */
#if GTK_VERSION == 3
	hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
#elif GTK_VERSION == 2
	hbox = gtk_hbox_new(FALSE, 0);
#endif

	priv->quickconnect_protocol = gtk_combo_box_text_new();
#if GTK_VERSION == 3
	gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "RDP", "RDP");
	gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "VNC", "VNC");
	gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "NX", "NX");
	gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "SSH", "SSH");
#elif GTK_VERSION == 2
	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "RDP");
	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "VNC");
	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "NX");
	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->quickconnect_protocol), "SSH");
#endif
	gtk_combo_box_set_active(GTK_COMBO_BOX(priv->quickconnect_protocol), 0);
	gtk_widget_show(priv->quickconnect_protocol);
	gtk_box_pack_start(GTK_BOX(hbox), priv->quickconnect_protocol, FALSE, FALSE, 0);

	priv->quickconnect_server = gtk_entry_new();
	gtk_entry_set_width_chars(GTK_ENTRY(priv->quickconnect_server), 25);
	gtk_widget_show(priv->quickconnect_server);
	gtk_box_pack_start(GTK_BOX(hbox), priv->quickconnect_server, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(priv->quickconnect_server), "key-press-event", G_CALLBACK(remmina_main_quickconnect_on_key_press), remminamain);

	quickconnect = gtk_button_new_with_label("Connect !");
	gtk_widget_show(quickconnect);
	gtk_box_pack_start(GTK_BOX(hbox), quickconnect, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(quickconnect), "clicked", G_CALLBACK(remmina_main_quickconnect_on_click), remminamain);

	gtk_container_add(GTK_CONTAINER(vbox), hbox);
	gtk_widget_show(hbox);

	/* Create the scrolled window for the file list */
	scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scrolledwindow);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0);

	/* Create the remmina file list */
	tree = gtk_tree_view_new();

	column = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(column, _("Name"));
	gtk_tree_view_column_set_resizable(column, TRUE);
	gtk_tree_view_column_set_sort_column_id(column, NAME_COLUMN);
	renderer = gtk_cell_renderer_pixbuf_new();
	gtk_tree_view_column_pack_start(column, renderer, FALSE);
	gtk_tree_view_column_add_attribute(column, renderer, "icon-name", PROTOCOL_COLUMN);
	g_object_set(G_OBJECT(renderer), "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(column, renderer, FALSE);
	gtk_tree_view_column_add_attribute(column, renderer, "text", NAME_COLUMN);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);

	renderer = gtk_cell_renderer_text_new();
	column = gtk_tree_view_column_new_with_attributes(_("Group"), renderer, "text", GROUP_COLUMN, NULL);
	gtk_tree_view_column_set_resizable(column, TRUE);
	gtk_tree_view_column_set_sort_column_id(column, GROUP_COLUMN);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
	priv->group_column = column;

	renderer = gtk_cell_renderer_text_new();
	column = gtk_tree_view_column_new_with_attributes(_("Server"), renderer, "text", SERVER_COLUMN, NULL);
	gtk_tree_view_column_set_resizable(column, TRUE);
	gtk_tree_view_column_set_sort_column_id(column, SERVER_COLUMN);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);

	gtk_container_add(GTK_CONTAINER(scrolledwindow), tree);
	gtk_widget_show(tree);

	gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)), remmina_main_selection_func,
			remminamain, NULL);
	g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK(remmina_main_file_list_on_button_press), remminamain);
	g_signal_connect(G_OBJECT(tree), "key-press-event", G_CALLBACK(remmina_main_file_list_on_key_press), remminamain);

	priv->file_list = tree;

	/* Create statusbar */
	priv->statusbar = gtk_statusbar_new();
	gtk_box_pack_start(GTK_BOX(vbox), priv->statusbar, FALSE, FALSE, 0);
	gtk_widget_show(priv->statusbar);

	/* Prepare the data */
	remmina_main_load_files(remminamain, FALSE);

	/* Load the preferences */
	if (remmina_pref.hide_toolbar)
	{
		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_action_group_get_action(priv->main_group, "ViewToolbar")),
				FALSE);
	}
	if (remmina_pref.hide_statusbar)
	{
		gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_action_group_get_action(priv->main_group, "ViewStatusbar")),
				FALSE);
	}
	if (remmina_pref.show_quick_search)
	{
		gtk_toggle_action_set_active(
				GTK_TOGGLE_ACTION(gtk_action_group_get_action(priv->main_group, "ViewQuickSearch")), TRUE);
	}
	if (remmina_pref.small_toolbutton)
	{
		gtk_toggle_action_set_active(
				GTK_TOGGLE_ACTION(gtk_action_group_get_action(priv->main_group, "ViewSmallToolbutton")), TRUE);
	}

	/* Drag-n-drop support */
	gtk_drag_dest_set(GTK_WIDGET(remminamain), GTK_DEST_DEFAULT_ALL, remmina_drop_types, 1, GDK_ACTION_COPY);
	g_signal_connect(G_OBJECT(remminamain), "drag-data-received", G_CALLBACK(remmina_main_on_drag_data_received), NULL);

	priv->initialized = TRUE;

	remmina_widget_pool_register(GTK_WIDGET(remminamain));
}
Example #21
0
/*
  This is the real implementation of the sensitivity update.
  TODO: move it to the DDisplay as it belongs to it IMHO
 */
void 
diagram_update_menu_sensitivity (Diagram *dia)
{
  gint selected_count = g_list_length (dia->data->selected);
  DDisplay *ddisp = ddisplay_active();
  gboolean focus_active = (get_active_focus(dia->data) != NULL);
  gboolean textedit_active = ddisp ? textedit_mode(ddisp) : FALSE;
  GtkAction *action;

  /* Edit menu */
  if ((action = menus_get_action ("EditUndo")) != NULL)
    gtk_action_set_sensitive (action, dia ? undo_available(dia->undo, TRUE) : FALSE);
  if ((action = menus_get_action ("EditRedo")) != NULL)
    gtk_action_set_sensitive (action, dia ? undo_available(dia->undo, FALSE) : FALSE);
  if ((action = menus_get_action ("EditCopy")) != NULL)
    gtk_action_set_sensitive (action, textedit_active || selected_count > 0);
  if ((action = menus_get_action ("EditCut")) != NULL)
    gtk_action_set_sensitive (action, textedit_mode(ddisp) || selected_count > 0);
  if ((action = menus_get_action ("EditPaste")) != NULL)
    gtk_action_set_sensitive (action, textedit_active || cnp_exist_stored_objects());
  if ((action = menus_get_action ("EditDelete")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);
  if ((action = menus_get_action ("EditDuplicate")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);

  if ((action = menus_get_action ("EditCopytext")) != NULL)
    gtk_action_set_sensitive (action, focus_active);
  if ((action = menus_get_action ("EditCuttext")) != NULL)
    gtk_action_set_sensitive (action, focus_active);
  if ((action = menus_get_action ("EditPastetext")) != NULL)
    gtk_action_set_sensitive (action, focus_active);

  /* Objects menu */
  if ((action = menus_get_action ("ObjectsSendtoback")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);
  if ((action = menus_get_action ("ObjectsBringtofront")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);
  if ((action = menus_get_action ("ObjectsSendbackwards")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);
  if ((action = menus_get_action ("ObjectsBringforwards")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);

  if ((action = menus_get_action ("ObjectsLayerAbove")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);
  if ((action = menus_get_action ("ObjectsLayerBelow")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 0);

  if ((action = menus_get_action ("ObjectsGroup")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsUngroup")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && diagram_selected_any_groups (dia));
  if ((action = menus_get_action ("ObjectsParent")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && diagram_selected_can_parent (dia));
  if ((action = menus_get_action ("ObjectsUnparent")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && diagram_selected_any_children (dia));
  if ((action = menus_get_action ("ObjectsUnparentchildren")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && diagram_selected_any_parents (dia));

  if ((action = menus_get_action ("ObjectsProperties")) != NULL)
    gtk_action_set_sensitive (action, selected_count > 0);

  /* Objects->Align menu */
  if ((action = menus_get_action ("ObjectsAlignLeft")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignCenter")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignRight")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignSpreadouthorizontally")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignAdjacent")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignTop")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignMiddle")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignBottom")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignSpreadoutvertically")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignStacked")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);
  if ((action = menus_get_action ("ObjectsAlignConnected")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active && selected_count > 1);

  /* Select menu */
  if ((action = menus_get_action ("SelectAll")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectNone")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectInvert")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectTransitive")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectConnected")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectSametype")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);

  if ((action = menus_get_action ("SelectReplace")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectUnion")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectIntersection")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectRemove")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);
  if ((action = menus_get_action ("SelectInverse")) != NULL)
    gtk_action_set_sensitive (action, !textedit_active);

  /* Tools menu - toolbox actions */
  gtk_action_group_set_sensitive (menus_get_tool_actions (),  !textedit_active);

  /* View menu - should not need disabling yet */
}
Example #22
0
void
liferea_shell_update_item_menu (gboolean enabled)
{
	gtk_action_group_set_sensitive (shell->priv->itemActions, enabled);
}
Example #23
0
GtkWidget *tracksearch_window( void )
{
	GtkWidget *win;
	GtkWidget *winbox;
	GtkWidget *search_box;
	GtkWidget *search_label;
	GtkWidget *search_button;
	GtkWidget *scroll;
	GtkTreeSelection *sel;
	search_widgets *wg;
	GtkActionGroup *ag_always, *ag_track_one, *ag_track_any;
	GtkAction *close;
	GtkUIManager *ui;
	GtkWidget *context;


	/* TODO: use g_object_set_data() */
	wg = g_malloc(sizeof(search_widgets));
	memset(wg, 0, sizeof(search_widgets));


	/* top box */
	winbox = gtk_vbox_new( FALSE, 0 );



	/* input */
	search_box = gtk_hbox_new( FALSE, 0 );
	gtk_box_pack_start( GTK_BOX(winbox), search_box, FALSE, FALSE, 1 );
	gtk_widget_show( search_box );

	search_label = gtk_label_new("filter:");
	gtk_box_pack_start( GTK_BOX(search_box), search_label, FALSE, FALSE, 1 );
	gtk_widget_show( search_label );

	/* TODO: give some hint about filter syntax */
	/* TODO: input history for filter */
	/* TODO: auto complete for filter */
	wg->input = gtk_entry_new();
	g_object_set( wg->input, "activates-default", TRUE, NULL );
	gtk_box_pack_start( GTK_BOX(search_box), wg->input, TRUE, TRUE, 1 );
	gtk_widget_show( wg->input );

	search_button = gtk_button_new_with_label("search");
	gtk_signal_connect( GTK_OBJECT(search_button), "clicked",
		G_CALLBACK(search_button_on_click), wg );
	gtk_box_pack_start( GTK_BOX(search_box), search_button, FALSE, FALSE, 1 );
	GTK_WIDGET_SET_FLAGS( search_button, GTK_CAN_DEFAULT);

	gtk_widget_show( search_button );



	/* scrolled result list */
	scroll = gtk_scrolled_window_new( GTK_ADJUSTMENT(NULL), GTK_ADJUSTMENT(NULL) );
	gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),
		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );

	wg->list = track_list_new_with_list( TRUE, NULL );
	sel = gtk_tree_view_get_selection( GTK_TREE_VIEW(wg->list) );
	gtk_tree_selection_set_mode( GTK_TREE_SELECTION(sel), GTK_SELECTION_MULTIPLE );
	g_signal_connect( G_OBJECT(sel), "changed",
		G_CALLBACK(selection_on_change), NULL );
	gtk_container_add( GTK_CONTAINER(scroll), wg->list );
	gtk_widget_show( wg->list );

	gtk_box_pack_start( GTK_BOX( winbox ), scroll, TRUE, TRUE, 0 );
	gtk_widget_show( scroll );


	/* status bar */
	wg->status = gtk_statusbar_new();
	gtk_box_pack_start( GTK_BOX(winbox), wg->status, FALSE, FALSE, 0 );
	gtk_widget_show( wg->status );


	/* actions + uimanager for menu, toolbar + hotkeys */
	ag_always = gtk_action_group_new("TracksearchAlways");
        gtk_action_group_add_actions(ag_always, action_always,
		G_N_ELEMENTS(action_always), NULL );
	close = gtk_action_group_get_action( ag_always, "Close" );

	ag_track_one = gtk_action_group_new("TracksearchOne");
	g_object_set_data( G_OBJECT(sel), "agroup-one", ag_track_one);
	gtk_action_group_set_sensitive(ag_track_one, FALSE );
        gtk_action_group_add_actions(ag_track_one, action_track_one,
		G_N_ELEMENTS(action_track_one), wg->list );

	ag_track_any = gtk_action_group_new("TracksearchAny");
	g_object_set_data( G_OBJECT(sel), "agroup-any", ag_track_any);
	gtk_action_group_set_sensitive(ag_track_any, FALSE );
        gtk_action_group_add_actions(ag_track_any, action_track_any,
		G_N_ELEMENTS(action_track_any), wg->list );

	ui = gtk_ui_manager_new();
	gtk_ui_manager_insert_action_group(ui, ag_always, 0);
	gtk_ui_manager_insert_action_group(ui, ag_track_one, 1);
	gtk_ui_manager_insert_action_group(ui, ag_track_any, 2);

	/* top window */
	win = childwindow_new( "search tracks", winbox, ui, uidesc );
	gtk_window_set_default_size(GTK_WINDOW(win), 600, 300);
	g_object_set_data( G_OBJECT(close), "topwindow", win );
	gtk_window_set_default( GTK_WINDOW(win), search_button );

	gtk_signal_connect( GTK_OBJECT(win), "destroy",
		G_CALLBACK(tracksearch_on_destroy), wg);


	/* context menu */
	context = gtk_ui_manager_get_widget( ui, "/TrackPopup" );
	context_add( GTK_TREE_VIEW(wg->list), GTK_MENU(context) );

	/* free ui_manager */
	g_object_unref( G_OBJECT(ui) );


	return win;
}