static void
on_checkbutton_toggled (GtkToggleButton *togglebutton, gpointer user_data)
{
    Preference pref;

    pref = GPOINTER_TO_INT (user_data);
    preferences_set_bool (preferences_get_key (pref),
                          gtk_toggle_button_get_active (togglebutton));
}
Beispiel #2
0
static void
view_hide_side_effects (WarlockView *view)
{
	view->shown = FALSE;

	/* save the status of the window */
	if (view->shown_key != NULL)
		preferences_set_bool (view->shown_key, FALSE);

	// Update the menu checkmark
	if (view->menuitem != NULL)
		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
				(view->menuitem), FALSE);
}
Beispiel #3
0
static void
view_show (WarlockView *view)
{
	GtkWidget *frame;

        g_assert (view != NULL);

	view->shown = TRUE;

	/* save the status of the window */
	if (view->shown_key != NULL)
		preferences_set_bool (view->shown_key, TRUE);

	// Update the menu checkmark
	if (view->menuitem != NULL)
		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
				(view->menuitem), TRUE);

	// If the window was already created, just show it.
	if (view->scrolled_window != NULL) {
		gtk_widget_show (GTK_WIDGET (view->widget));
		return;
	}

	/* FIXME: this is all an awful mess */
	if (view->widget == NULL) {
		int width, height;
		view->widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
		g_object_ref (view->widget);
		gtk_window_set_title (GTK_WINDOW (view->widget), view->title);
		gtk_widget_hide_on_delete (view->widget);
		frame = gtk_frame_new (view->title);
		gtk_container_add (GTK_CONTAINER (view->widget), frame);
		gtk_window_set_role (GTK_WINDOW (view->widget), view->name);
		width = preferences_get_int (preferences_get_window_key
				(view->name, "width"));
		height = preferences_get_int (preferences_get_window_key
				(view->name, "height"));
		gtk_window_set_default_size (GTK_WINDOW (view->widget), width,
				height);
		g_signal_connect (G_OBJECT (view->widget), "configure-event",
			G_CALLBACK (view_resized),
			(gpointer) view->name);
		g_signal_connect (G_OBJECT (view->widget), "delete-event",
			G_CALLBACK (view_deleted),
			(gpointer) view);
	} else {
		frame = view->widget;
	}

        view->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	view->buffer = w_string_new ("");
	warlock_view_create_text_view (view);

        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
			(view->scrolled_window), GTK_POLICY_NEVER,
			GTK_POLICY_ALWAYS);

        gtk_container_add (GTK_CONTAINER (view->scrolled_window),
			view->text_view);
        gtk_container_add (GTK_CONTAINER (frame),
			view->scrolled_window);

        gtk_widget_show_all (view->widget);
}