/*! \fn gboolean CDesktopAppChooser::m_DoModal(void)
    \brief Desktop App Chooser runs in modal mode.

    \return TRUE or FALSE
*/
gboolean CDesktopAppChooser::m_DoModal(void)
{
  /* Sets a window modal or non-modal. */
  gtk_window_set_modal(GTK_WINDOW(m_pWidgets[APPCHOOSER_GtkWindow_Main]), TRUE);

  if( m_pwParent != NULL )
  {
     /* Dialog windows should be set transient for the main application window they were spawned from.
        This allows window managers to e.g. keep the dialog on top of the main window, or center the
        dialog over the main window. */
     gtk_window_set_transient_for(GTK_WINDOW(m_pWidgets[APPCHOOSER_GtkWindow_Main]), GTK_WINDOW(m_pwParent));

     /* Creates the GDK (windowing system) resources associated with a widget. */
     gtk_widget_realize(m_pWidgets[APPCHOOSER_GtkWindow_Main]);

     /* Sets hints about the window management functions to make available via buttons on the window frame. */
     gdk_window_set_functions(m_pWidgets[APPCHOOSER_GtkWindow_Main]->window, (GdkWMFunction)(GDK_FUNC_CLOSE|GDK_FUNC_MOVE));
  }

  /* Show all widgets */
  gtk_widget_show_all(m_pWidgets[APPCHOOSER_GtkWindow_Main]);

  /* Start to run. */
  gtk_main();

//-------------- When the modal is terminated, it must grab the current list store of the tree-view, else it will make a big big trouble!	
  /* To decrease the reference counter of the menu directory object. */
  gmenu_tree_item_unref(m_RootDir);

  /* To decrease the reference counter of the menu tree object. */
  gmenu_tree_unref(m_MenuTree);

  return TRUE;
}
Пример #2
0
void wxTopLevelWindowGTK::GTKHandleRealized()
{
    wxNonOwnedWindow::GTKHandleRealized();

    gdk_window_set_decorations(gtk_widget_get_window(m_widget),
                               (GdkWMDecoration)m_gdkDecor);
    gdk_window_set_functions(gtk_widget_get_window(m_widget),
                               (GdkWMFunction)m_gdkFunc);

    // GTK's shrinking/growing policy
    if ( !(m_gdkFunc & GDK_FUNC_RESIZE) )
        gtk_window_set_resizable(GTK_WINDOW(m_widget), FALSE);
#ifndef __WXGTK3__
    else
        gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
#endif

    const wxIconBundle& icons = GetIcons();
    if (icons.GetIconCount())
        SetIcons(icons);

#ifdef __WXGTK3__
    if (gtk_window_get_has_resize_grip(GTK_WINDOW(m_widget)))
    {
        // Grip window can end up obscured, probably due to deferred show.
        // Reset grip to ensure it is visible.
        gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), false);
        gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), true);
    }
#endif
}
Пример #3
0
void wxTopLevelWindowGTK::GTKHandleRealized()
{
    wxNonOwnedWindow::GTKHandleRealized();

    GdkWindow* window = gtk_widget_get_window(m_widget);

    gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
    gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);

    const wxIconBundle& icons = GetIcons();
    if (icons.GetIconCount())
        SetIcons(icons);

    GdkCursor* cursor = g_globalCursor.GetCursor();
    if (wxIsBusy() && !gtk_window_get_modal(GTK_WINDOW(m_widget)))
        cursor = g_busyCursor.GetCursor();

    if (cursor)
        gdk_window_set_cursor(window, cursor);

#ifdef __WXGTK3__
    if (gtk_window_get_has_resize_grip(GTK_WINDOW(m_widget)))
    {
        // Grip window can end up obscured, probably due to deferred show.
        // Reset grip to ensure it is visible.
        gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), false);
        gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), true);
    }
#endif
}
Пример #4
0
static void
gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget),
                             wxTopLevelWindowGTK *win )
{
    if (g_isIdle)
        wxapp_install_idle_handler();

    // All this is for Motif Window Manager "hints" and is supposed to be
    // recognized by other WM as well. Not tested.
    gdk_window_set_decorations(win->m_widget->window,
                               (GdkWMDecoration)win->m_gdkDecor);
    gdk_window_set_functions(win->m_widget->window,
                               (GdkWMFunction)win->m_gdkFunc);

    // GTK's shrinking/growing policy
    if ((win->m_gdkFunc & GDK_FUNC_RESIZE) == 0)
        gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
    else
        gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);

    // reset the icon
    wxIconBundle iconsOld = win->GetIcons();
    if ( !iconsOld.IsEmpty() )
    {
        win->SetIcon( wxNullIcon );
        win->SetIcons( iconsOld );
    }
}
Пример #5
0
void monopoly_create_dlg(void)
{
	GtkWidget *dlg_vbox;
	GtkWidget *vbox;
	GtkWidget *lbl;
	GSList *monop_grp = NULL;

	if (monop_dlg != NULL) {
		gtk_window_present(GTK_WINDOW(monop_dlg));
		return;
	};

	/* Dialog caption */
	monop_dlg = gtk_dialog_new_with_buttons(_("Monopoly"),
						GTK_WINDOW(app_window),
						GTK_DIALOG_DESTROY_WITH_PARENT,
						GTK_STOCK_OK,
						GTK_RESPONSE_OK, NULL);
	g_signal_connect(G_OBJECT(monop_dlg), "destroy",
			 G_CALLBACK(gtk_widget_destroyed), &monop_dlg);
	gtk_widget_realize(monop_dlg);
	/* Disable close */
	gdk_window_set_functions(monop_dlg->window,
				 GDK_FUNC_ALL | GDK_FUNC_CLOSE);

	dlg_vbox = GTK_DIALOG(monop_dlg)->vbox;
	gtk_widget_show(dlg_vbox);

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(vbox);
	gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);

	/* Label */
	lbl = gtk_label_new(_("Select the resource you wish to "
			      "monopolize."));
	gtk_widget_show(lbl);
	gtk_box_pack_start(GTK_BOX(vbox), lbl, TRUE, TRUE, 0);
	gtk_misc_set_alignment(GTK_MISC(lbl), 0, 0.5);

	monop_grp = add_resource_btn(vbox, monop_grp, BRICK_RESOURCE);
	monop_grp = add_resource_btn(vbox, monop_grp, GRAIN_RESOURCE);
	monop_grp = add_resource_btn(vbox, monop_grp, ORE_RESOURCE);
	monop_grp = add_resource_btn(vbox, monop_grp, WOOL_RESOURCE);
	monop_grp = add_resource_btn(vbox, monop_grp, LUMBER_RESOURCE);

	frontend_gui_register(gui_get_dialog_button
			      (GTK_DIALOG(monop_dlg), 0), GUI_MONOPOLY,
			      "clicked");
	gtk_dialog_set_default_response(GTK_DIALOG(monop_dlg),
					GTK_RESPONSE_OK);
	/* This _must_ be after frontend_gui_register, otherwise the
	 * regeneration of the button happens before the destruction, which
	 * results in an incorrectly sensitive OK button. */
	g_signal_connect(gui_get_dialog_button(GTK_DIALOG(monop_dlg), 0),
			 "destroy", G_CALLBACK(monopoly_destroyed), NULL);
	gtk_widget_show(monop_dlg);
	frontend_gui_update();
}
Пример #6
0
bool wxTopLevelWindowGTK::EnableCloseButton( bool enable )
{
    if (enable)
        m_gdkFunc |= GDK_FUNC_CLOSE;
    else
        m_gdkFunc &= ~GDK_FUNC_CLOSE;

    if (GTK_WIDGET_REALIZED(m_widget) && (m_widget->window))
        gdk_window_set_functions( m_widget->window, (GdkWMFunction)m_gdkFunc );

    return true;
}
Пример #7
0
bool wxTopLevelWindowGTK::EnableCloseButton( bool enable )
{
    if (enable)
        m_gdkFunc |= GDK_FUNC_CLOSE;
    else
        m_gdkFunc &= ~GDK_FUNC_CLOSE;

    GdkWindow* window = gtk_widget_get_window(m_widget);
    if (window)
        gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);

    return true;
}
Пример #8
0
GtkWidget *dialog_create_modal_transient_window (const char *title,
		int close_on_esc, 
		int allow_resize, 
		GtkSignalFunc on_destroy) {
	GtkWidget *window;
	GtkWidget *parent;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
	gtk_signal_connect (GTK_OBJECT (window), "delete_event",
			GTK_SIGNAL_FUNC (window_delete_event_callback), NULL);
	if (on_destroy) {
		gtk_signal_connect (GTK_OBJECT (window), "destroy",
				GTK_SIGNAL_FUNC (on_destroy), NULL);
	}
	gtk_signal_connect (GTK_OBJECT (window), "destroy",
			GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

	if (close_on_esc) {
		gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
				GTK_SIGNAL_FUNC (destroy_on_escape), NULL);
	}

	if (title)
		gtk_window_set_title (GTK_WINDOW (window), title);

	gtk_widget_realize (window);

	gdk_window_set_decorations (window->window, (allow_resize)?
			GDK_DECOR_BORDER | GDK_DECOR_TITLE | GDK_DECOR_RESIZEH :
			GDK_DECOR_BORDER | GDK_DECOR_TITLE);

	gdk_window_set_functions (window->window, (allow_resize)?
			GDK_FUNC_MOVE | GDK_FUNC_CLOSE | GDK_FUNC_RESIZE : 
			GDK_FUNC_MOVE | GDK_FUNC_CLOSE);

	gtk_window_set_modal (GTK_WINDOW (window), TRUE);

	parent = top_window ();
	if (parent)
		gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));

	register_window (window);

	return window;
}
Пример #9
0
static void change_title_menu_cb(void)
{
	GtkWidget *dialog, *vbox, *hbox, *label, *entry;

	dialog = gtk_dialog_new_with_buttons(
						    /* Dialog caption */
						    _("Change Title"),
						    GTK_WINDOW(toplevel),
						    GTK_DIALOG_MODAL |
						    GTK_DIALOG_DESTROY_WITH_PARENT,
						    GTK_STOCK_CANCEL,
						    GTK_RESPONSE_CANCEL,
						    GTK_STOCK_OK,
						    GTK_RESPONSE_OK, NULL);
	gtk_dialog_set_default_response(GTK_DIALOG(dialog),
					GTK_RESPONSE_OK);
	g_signal_connect(G_OBJECT(dialog), "destroy",
			 G_CALLBACK(gtk_widget_destroyed), &dialog);
	gtk_widget_realize(dialog);
	gdk_window_set_functions(dialog->window,
				 GDK_FUNC_MOVE | GDK_FUNC_CLOSE);

	vbox = GTK_DIALOG(dialog)->vbox;

	hbox = gtk_hbox_new(FALSE, 5);
	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);

	/* Label */
	label = gtk_label_new(_("New title:"));
	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);

	entry = gtk_entry_new();
	gtk_entry_set_max_length(GTK_ENTRY(entry), 60);
	gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
	if (window_title != NULL)
		gtk_entry_set_text(GTK_ENTRY(entry), window_title);

	gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);

	gtk_widget_show_all(dialog);
	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
		set_window_title(gtk_entry_get_text(GTK_ENTRY(entry)));
	gtk_widget_destroy(dialog);
}
Пример #10
0
static gint
gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win )
{
    if (g_isIdle)
        wxapp_install_idle_handler();

    /* all this is for Motif Window Manager "hints" and is supposed to be
       recognized by other WM as well. not tested. */
    long decor = (long) GDK_DECOR_BORDER;
    long func = (long) GDK_FUNC_MOVE ;

    gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
    gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);

    gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);

    return FALSE;
}
Пример #11
0
static void
clutter_stage_gdk_set_user_resizable (ClutterStageWindow *stage_window,
                                      gboolean            is_resizable)
{
  ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window);
  GdkWMFunction function;

  if (stage_gdk->window == NULL)
    return;

  function = GDK_FUNC_MOVE | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE;
  if (is_resizable)
    function |= GDK_FUNC_RESIZE | GDK_FUNC_MAXIMIZE;

  gdk_window_set_functions (stage_gdk->window, function);

  clutter_stage_gdk_set_gdk_geometry (stage_gdk);
}
Пример #12
0
// Set FUNCTIONS for window
int
clip_GTK_WINDOWSETFUNCTIONS(ClipMachine * cm)
{
	C_widget *cwin = _fetch_cw_arg(cm);
	GdkWMFunction Func = _clip_parni(cm, 2);
	CHECKARG(2,NUMERIC_t);

	CHECKCWID(cwin,GTK_IS_WINDOW);
	if (cwin->widget->window)
	{
		gdk_window_set_functions(cwin->widget->window, Func);
		_clip_retl(cm, TRUE);
	}
	else
		_clip_retl(cm, FALSE);
	return 0;
err:
	return 1;
}
Пример #13
0
void wxTopLevelWindowGTK::GTKHandleRealized()
{
    wxNonOwnedWindow::GTKHandleRealized();

    gdk_window_set_decorations(gtk_widget_get_window(m_widget),
                               (GdkWMDecoration)m_gdkDecor);
    gdk_window_set_functions(gtk_widget_get_window(m_widget),
                               (GdkWMFunction)m_gdkFunc);

    // GTK's shrinking/growing policy
    if ( !(m_gdkFunc & GDK_FUNC_RESIZE) )
        gtk_window_set_resizable(GTK_WINDOW(m_widget), FALSE);
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
    else
        gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
#endif

    const wxIconBundle& icons = GetIcons();
    if (icons.GetIconCount())
        SetIcons(icons);
}
Пример #14
0
void autosplit_show(GtkWidget *main_window)
{
    GtkWidget *vbox;
    GtkWidget *table;
    GtkWidget *hbbox;
    GtkWidget *message_label;
    GtkWidget *hseparator;
    GtkWidget *ok_button, *cancel_button;

    if (autosplit_time == NULL) {
        autosplit_time = g_strdup("5:00.00");
    }

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_realize(window);
    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
    gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(main_window));
    gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ON_PARENT);
    gdk_window_set_functions(gtk_widget_get_window(window), GDK_FUNC_MOVE);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(window), vbox);
    gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
    gtk_widget_show(vbox);

    table = gtk_table_new(3, 2, FALSE);
    gtk_container_add(GTK_CONTAINER(vbox), table);
    gtk_widget_show(table);

    message_label = gtk_label_new(_("Enter the time for autosplit:"));
    gtk_misc_set_alignment(GTK_MISC(message_label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), message_label, 0, 1, 0, 1, GTK_FILL, 0, 5, 0);
    gtk_widget_show(message_label);

    message_label = gtk_label_new(_("Example (5min, 32sec, 12subsec):"));
    gtk_misc_set_alignment(GTK_MISC(message_label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), message_label, 0, 1, 1, 2, GTK_FILL, 0, 5, 0);
    gtk_widget_show(message_label);

    message_label = gtk_label_new(" 5:32.12");
    gtk_misc_set_alignment(GTK_MISC(message_label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), message_label, 1, 2, 1, 2, GTK_FILL, 0, 5, 0);
    gtk_widget_show(message_label);

    autosplit_time_entry = gtk_entry_new();
    gtk_entry_set_text(GTK_ENTRY(autosplit_time_entry), autosplit_time);
    gtk_entry_set_width_chars(GTK_ENTRY(autosplit_time_entry), 10);
    gtk_table_attach(GTK_TABLE(table), autosplit_time_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 5, 0);
    gtk_widget_show(autosplit_time_entry);

    hseparator = gtk_hseparator_new();
    gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, TRUE, 5);
    gtk_widget_show(hseparator);

    hbbox = gtk_hbutton_box_new();
    gtk_container_add(GTK_CONTAINER(vbox), hbbox);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_END);
    gtk_box_set_spacing(GTK_BOX(hbbox), 10);
    gtk_widget_show(hbbox);

    cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
    gtk_box_pack_end(GTK_BOX(hbbox), cancel_button, FALSE, FALSE, 5);
    g_signal_connect(G_OBJECT(cancel_button), "clicked", (GCallback)cancel_button_clicked, window);
    gtk_widget_show(cancel_button);

    ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
    gtk_box_pack_end(GTK_BOX(hbbox), ok_button, FALSE, FALSE, 5);
    g_signal_connect(G_OBJECT(ok_button), "clicked", (GCallback)ok_button_clicked, window);
    gtk_widget_show(ok_button);

    gtk_widget_show(window);
}
Пример #15
0
static VALUE
gdkwin_set_functions(VALUE self, VALUE func)
{
    gdk_window_set_functions(_SELF(self), RVAL2GFLAGS(func, GDK_TYPE_WM_FUNCTION));
    return self;
}
Пример #16
0
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
{
    if (show == m_fsIsShowing)
        return false; // return what?

    m_fsIsShowing = show;

#ifdef GDK_WINDOWING_X11
    Display* xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget));
    Window xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget));
    wxX11FullScreenMethod method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot);

    // NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
    //     to switch to fullscreen, which is not always available. We must
    //     check if WM supports the spec and use legacy methods if it
    //     doesn't.
    if ( method == wxX11_FS_WMSPEC )
#endif // GDK_WINDOWING_X11
    {
        if (show)
            gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
        else
            gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
    }
#ifdef GDK_WINDOWING_X11
    else
    {
        GdkWindow* window = gtk_widget_get_window(m_widget);
        Window xid = GDK_WINDOW_XID(window);

        if (show)
        {
            GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y );
            GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height );

            GdkScreen* screen = gtk_widget_get_screen(m_widget);
            const int screen_width = gdk_screen_get_width(screen);
            const int screen_height = gdk_screen_get_height(screen);

            gint client_x, client_y, root_x, root_y;
            gint width, height;

            m_fsSaveGdkFunc = m_gdkFunc;
            m_fsSaveGdkDecor = m_gdkDecor;
            m_gdkFunc = m_gdkDecor = 0;
            gdk_window_set_decorations(window, (GdkWMDecoration)0);
            gdk_window_set_functions(window, (GdkWMFunction)0);

            gdk_window_get_origin(window, &root_x, &root_y);
            gdk_window_get_geometry(window, &client_x, &client_y, &width, &height);

            gdk_window_move_resize(
                window, -client_x, -client_y, screen_width + 1, screen_height + 1);

            wxSetFullScreenStateX11(xdpy,
                                    (WXWindow)xroot,
                                    (WXWindow)xid,
                                    show, &m_fsSaveFrame, method);
        }
        else // hide
        {
            m_gdkFunc = m_fsSaveGdkFunc;
            m_gdkDecor = m_fsSaveGdkDecor;
            gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
            gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);

            wxSetFullScreenStateX11(xdpy,
                                    (WXWindow)xroot,
                                    (WXWindow)xid,
                                    show, &m_fsSaveFrame, method);

            SetSize(m_fsSaveFrame.x, m_fsSaveFrame.y,
                    m_fsSaveFrame.width, m_fsSaveFrame.height);
        }
    }
#endif // GDK_WINDOWING_X11

    // documented behaviour is to show the window if it's still hidden when
    // showing it full screen
    if (show)
        Show();

    return true;
}
Пример #17
0
void mainwindow_init () {
	DPRINT (__DEBUG_GENERAL__,"mainwindow_init: plugin initialization");

	// Get a reference to the config
	plugin_config = get_xmms_config();

	// Only init once
	if (mainwindow_data.window == NULL) {
		gtk_init (NULL,NULL);
	 	gdk_rgb_init();

		DPRINT (__DEBUG_GTK__,"mainwindow_init: creating gtk window");

		// Create Window
		mainwindow_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
		gtk_window_set_title (mainwindow_data.window,PLUGIN_NAME);

		// Create drawing-area widget, must exist before expose signal connect (?!)
	  	mainwindow_data.drawing_area = gtk_drawing_area_new ();

		// Register events we want to know
		gtk_widget_set_events (mainwindow_data.window,GDK_BUTTON_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);
		// Handle singla window manager closing
	  	gtk_signal_connect (GTK_OBJECT(mainwindow_data.window),"delete_event",GTK_SIGNAL_FUNC(mainwindow_sigquit),NULL);
		// Handle signal for window movement
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.window),"button_press_event",  GTK_SIGNAL_FUNC(mainwindow_sigpress),NULL);
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.window),"button_release_event",GTK_SIGNAL_FUNC(mainwindow_sigrelease),NULL);
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.window),"motion_notify_event", GTK_SIGNAL_FUNC(mainwindow_sigmotion),NULL);
		// Window signal for repaint signal
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.drawing_area),"expose_event", GTK_SIGNAL_FUNC(mainwindow_sigexpose), NULL);
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.drawing_area),"size-request", GTK_SIGNAL_FUNC(mainwindow_sigsizerequest), NULL);
		gtk_signal_connect (GTK_OBJECT(mainwindow_data.drawing_area),"state-changed", GTK_SIGNAL_FUNC(mainwindow_sigstatechanged), NULL);

		// Hide all window manager decorations, we have a skin
		gtk_widget_realize (mainwindow_data.window);
		gdk_window_set_decorations (mainwindow_data.window->window,0);
		gdk_window_set_functions   (mainwindow_data.window->window,0);
		gdk_window_set_back_pixmap (mainwindow_data.window->window, NULL, FALSE);
		gtk_window_set_policy	   (GTK_WINDOW(mainwindow_data.window),FALSE,FALSE,FALSE);

		// Container with our drawing area widget
		gtk_container_add (GTK_CONTAINER (mainwindow_data.window), mainwindow_data.drawing_area);
		gtk_widget_show (mainwindow_data.drawing_area);
		gtk_widget_show_all (mainwindow_data.window);

	}
	// Load skin
	mainwindow_loadskin (NULL,LOADSKIN_NORMAL);

	// Alocate memory for current filename
	current_filename = (char *) malloc (1);
	current_filename[0] = 0;

	// Create a first window, without a cover right now
	loadimage (NULL);

	// Init search functions
	findcover_init();

	// Add a timer
	if (mainwindow_data.window_timer==0) {
		mainwindow_data.window_timer = g_timeout_add (COVER_RECHECK_MS,(GSourceFunc)checkcover,NULL);
	}
}
Пример #18
0
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
{
    if (show == m_fsIsShowing)
        return false; // return what?

    if (show)
    {
        // Preserve menubar accelerators during full-screen operation
        wxFrame* frame = wxDynamicCast(this, wxFrame);
        if (frame)
        {
            if (frame->GetMenuBar())
            {
                wxAcceleratorTable table(wxCreateAcceleratorTableForMenuBar(frame->GetMenuBar()));
                if (table.IsOk())
                    SetAcceleratorTable(table);
            }
#if wxUSE_TOOLBAR
            if (frame->GetToolBar() && frame->GetToolBar()->IsShown())
            {
                frame->GetToolBar()->Show(false);
            }
#endif
        }
    }
#if wxUSE_TOOLBAR
    else
    {
        // FIXME: we need to remember whether the toolbar was previously hidden
        wxFrame* frame = wxDynamicCast(this, wxFrame);
        if (frame && frame->GetToolBar())
        {
            frame->GetToolBar()->Show(true);
        }
    }
#endif

    m_fsIsShowing = show;

    wxX11FullScreenMethod method =
        wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
                                 (WXWindow)GDK_ROOT_WINDOW());

#if GTK_CHECK_VERSION(2,2,0)
    // NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
    //     to switch to fullscreen, which is not always available. We must
    //     check if WM supports the spec and use legacy methods if it
    //     doesn't.
    if ( (method == wxX11_FS_WMSPEC) && !gtk_check_version(2,2,0) )
    {
        if (show)
        {
            m_fsSaveFlag = style;
            gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
        }
        else
        {
            m_fsSaveFlag = 0;
            gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
        }
    }
    else
#endif // GTK+ >= 2.2.0
    {
        GdkWindow *window = m_widget->window;

        if (show)
        {
            m_fsSaveFlag = style;
            GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y );
            GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height );

            int screen_width,screen_height;
            wxDisplaySize( &screen_width, &screen_height );

            gint client_x, client_y, root_x, root_y;
            gint width, height;

            if (method != wxX11_FS_WMSPEC)
            {
                // don't do it always, Metacity hates it
                m_fsSaveGdkFunc = m_gdkFunc;
                m_fsSaveGdkDecor = m_gdkDecor;
                m_gdkFunc = m_gdkDecor = 0;
                gdk_window_set_decorations(window, (GdkWMDecoration)0);
                gdk_window_set_functions(window, (GdkWMFunction)0);
            }

            gdk_window_get_origin (m_widget->window, &root_x, &root_y);
            gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
                                     &width, &height, NULL);

            gdk_window_move_resize (m_widget->window, -client_x, -client_y,
                                    screen_width + 1, screen_height + 1);

            wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
                                    (WXWindow)GDK_ROOT_WINDOW(),
                                    (WXWindow)GDK_WINDOW_XWINDOW(window),
                                    show, &m_fsSaveFrame, method);
        }
        else // hide
        {
            m_fsSaveFlag = 0;
            if (method != wxX11_FS_WMSPEC)
            {
                // don't do it always, Metacity hates it
                m_gdkFunc = m_fsSaveGdkFunc;
                m_gdkDecor = m_fsSaveGdkDecor;
                gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
                gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
            }

            wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
                                    (WXWindow)GDK_ROOT_WINDOW(),
                                    (WXWindow)GDK_WINDOW_XWINDOW(window),
                                    show, &m_fsSaveFrame, method);

            SetSize(m_fsSaveFrame.x, m_fsSaveFrame.y,
                    m_fsSaveFrame.width, m_fsSaveFrame.height);
        }
    }

    // documented behaviour is to show the window if it's still hidden when
    // showing it full screen
    if ( show && !IsShown() )
        Show();

    return true;
}
Пример #19
0
void plenty_create_dlg(const gint * bank)
{
	GtkWidget *dlg_vbox;
	GtkWidget *vbox;
	const char *str;
	gint r;
	gint total;

	plenty.dlg = gtk_dialog_new_with_buttons(_("Year of Plenty"),
						 GTK_WINDOW(app_window),
						 GTK_DIALOG_DESTROY_WITH_PARENT,
						 GTK_STOCK_OK,
						 GTK_RESPONSE_OK, NULL);
	g_signal_connect(GTK_OBJECT(plenty.dlg), "destroy",
			 G_CALLBACK(gtk_widget_destroyed), &plenty.dlg);
	gtk_widget_realize(plenty.dlg);
	/* Disable close */
	gdk_window_set_functions(plenty.dlg->window,
				 GDK_FUNC_ALL | GDK_FUNC_CLOSE);

	dlg_vbox = GTK_DIALOG(plenty.dlg)->vbox;
	gtk_widget_show(dlg_vbox);

	vbox = gtk_vbox_new(FALSE, 5);
	gtk_widget_show(vbox);
	gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);

	total = 0;
	if (bank != NULL)
		for (r = 0; r < NO_RESOURCE; ++r) {
			plenty.bank[r] = bank[r];
			total += bank[r];
		}
	if (total == 1)
		str = _("Please choose one resource from the bank");
	else if (total >= 2) {
		total = 2;
		str = _("Please choose two resources from the bank");
	} else
		str = _("The bank is empty");
	plenty.resource_widget =
	    resource_table_new(str, RESOURCE_TABLE_MORE_IN_HAND, TRUE,
			       TRUE);
	resource_table_set_total(RESOURCETABLE(plenty.resource_widget),
				 /* Text for total in year of plenty dialog */
				 _("Total resources"), total);
	resource_table_limit_bank(RESOURCETABLE(plenty.resource_widget),
				  TRUE);
	resource_table_set_bank(RESOURCETABLE(plenty.resource_widget),
				plenty.bank);

	gtk_widget_show(plenty.resource_widget);
	gtk_box_pack_start(GTK_BOX(vbox), plenty.resource_widget, FALSE,
			   TRUE, 0);
	g_signal_connect(G_OBJECT(plenty.resource_widget), "change",
			 G_CALLBACK(amount_changed_cb), NULL);

	frontend_gui_register(gui_get_dialog_button
			      (GTK_DIALOG(plenty.dlg), 0), GUI_PLENTY,
			      "clicked");
	/* This _must_ be after frontend_gui_register, otherwise the
	 * regeneration of the button happens before the destruction, which
	 * results in an incorrectly sensitive OK button. */
	g_signal_connect(gui_get_dialog_button(GTK_DIALOG(plenty.dlg), 0),
			 "destroy", G_CALLBACK(plenty_destroyed), NULL);
	gtk_widget_show(plenty.dlg);
	frontend_gui_update();
}
Пример #20
0
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
{
    if (show == m_fsIsShowing)
        return false; // return what?

    m_fsIsShowing = show;

    wxX11FullScreenMethod method =
        wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
                                 (WXWindow)GDK_ROOT_WINDOW());

#if GTK_CHECK_VERSION(2,2,0)
    // NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
    //     to switch to fullscreen, which is not always available. We must
    //     check if WM supports the spec and use legacy methods if it
    //     doesn't.
    if ( (method == wxX11_FS_WMSPEC) && !gtk_check_version(2,2,0) )
    {
        if (show)
            gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
        else
            gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
    }
    else
#endif // GTK+ >= 2.2.0
    {
        GdkWindow *window = m_widget->window;

        if (show)
        {
            m_fsSaveFlag = style;
            GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y );
            GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height );

            int screen_width,screen_height;
            wxDisplaySize( &screen_width, &screen_height );

            gint client_x, client_y, root_x, root_y;
            gint width, height;

            if (method != wxX11_FS_WMSPEC)
            {
                // don't do it always, Metacity hates it
                m_fsSaveGdkFunc = m_gdkFunc;
                m_fsSaveGdkDecor = m_gdkDecor;
                m_gdkFunc = m_gdkDecor = 0;
                gdk_window_set_decorations(window, (GdkWMDecoration)0);
                gdk_window_set_functions(window, (GdkWMFunction)0);
            }

            gdk_window_get_origin (m_widget->window, &root_x, &root_y);
            gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
                         &width, &height, NULL);

            gdk_window_move_resize (m_widget->window, -client_x, -client_y,
                        screen_width + 1, screen_height + 1);

            wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
                                    (WXWindow)GDK_ROOT_WINDOW(),
                                    (WXWindow)GDK_WINDOW_XWINDOW(window),
                                    show, &m_fsSaveFrame, method);
        }
        else // hide
        {
            if (method != wxX11_FS_WMSPEC)
            {
                // don't do it always, Metacity hates it
                m_gdkFunc = m_fsSaveGdkFunc;
                m_gdkDecor = m_fsSaveGdkDecor;
                gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
                gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
            }

            wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
                                    (WXWindow)GDK_ROOT_WINDOW(),
                                    (WXWindow)GDK_WINDOW_XWINDOW(window),
                                    show, &m_fsSaveFrame, method);

            SetSize(m_fsSaveFrame.x, m_fsSaveFrame.y,
                    m_fsSaveFrame.width, m_fsSaveFrame.height);
        }
    }

    // documented behaviour is to show the window if it's still hidden when
    // showing it full screen
    if ( show && !IsShown() )
        Show();

    return true;
}
Пример #21
0
static int gtkDialogMapMethod(Ihandle* ih)
{
  int decorations = 0;
  int functions = 0;
  InativeHandle* parent;
  GtkWidget* fixed;
  int has_titlebar = 0;

#ifdef HILDON
  if (iupAttribGetBoolean(ih, "HILDONWINDOW")) 
  {
    HildonProgram *program = HILDON_PROGRAM(hildon_program_get_instance());
    ih->handle = hildon_window_new();
    if (ih->handle)
      hildon_program_add_window(program, HILDON_WINDOW(ih->handle)); 
  } 
  else 
  {
    iupAttribSetStr(ih, "DIALOGHINT", "YES");  /* otherwise not displayed correctly */ 
    ih->handle = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  }
#else
  ih->handle = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#endif
  if (!ih->handle)
    return IUP_ERROR;

  parent = iupDialogGetNativeParent(ih);
  if (parent)
  {
    gtk_window_set_transient_for((GtkWindow*)ih->handle, (GtkWindow*)parent);

    /* manually remove child windows when parent is destroyed */
    g_signal_connect(G_OBJECT(parent), "destroy", G_CALLBACK(gtkDialogChildDestroyEvent), ih);
  }

  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

  /* The iupgtkKeyPressEvent of the control with the focus will propagate the key up to the dialog. */
  /* Inside iupgtkKeyPressEvent we test this to avoid duplicate calls. */
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);

  g_signal_connect(G_OBJECT(ih->handle), "configure-event",    G_CALLBACK(gtkDialogConfigureEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "window-state-event", G_CALLBACK(gtkDialogWindowStateEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "delete-event",       G_CALLBACK(iupgtkDialogDeleteEvent), ih);
                                    
  gtk_window_set_default_size((GtkWindow*)ih->handle, 100, 100); /* set this to avoid size calculation problems  */

  if (iupAttribGetBoolean(ih, "DIALOGHINT")) 
    gtk_window_set_type_hint(GTK_WINDOW(ih->handle), GDK_WINDOW_TYPE_HINT_DIALOG);

  /* the container that will receive the child element. */
  fixed = gtk_fixed_new();
  gtk_container_add((GtkContainer*)ih->handle, fixed);
  gtk_widget_show(fixed);

  /* initialize the widget */
  gtk_widget_realize(ih->handle);

  if (iupAttribGet(ih, "TITLE"))
    has_titlebar = 1;
  if (iupAttribGetBoolean(ih, "RESIZE")) 
  {
    functions   |= GDK_FUNC_RESIZE;
    decorations |= GDK_DECOR_RESIZEH;

    decorations |= GDK_DECOR_BORDER;  /* has_border */
  }
  else
    iupAttribSetStr(ih, "MAXBOX", "NO");
  if (iupAttribGetBoolean(ih, "MENUBOX")) 
  {
    functions   |= GDK_FUNC_CLOSE;
    decorations |= GDK_DECOR_MENU;
    has_titlebar = 1;
  }
  if (iupAttribGetBoolean(ih, "MAXBOX")) 
  {
    functions   |= GDK_FUNC_MAXIMIZE;
    decorations |= GDK_DECOR_MAXIMIZE;
    has_titlebar = 1;
  }
  if (iupAttribGetBoolean(ih, "MINBOX")) 
  {
    functions   |= GDK_FUNC_MINIMIZE;
    decorations |= GDK_DECOR_MINIMIZE;
    has_titlebar = 1;
  }
  if (has_titlebar)
  {
    functions   |= GDK_FUNC_MOVE;
    decorations |= GDK_DECOR_TITLE;
    gtk_window_set_title((GtkWindow*)ih->handle, "");
  }
  if (iupAttribGetBoolean(ih, "BORDER") || has_titlebar)
    decorations |= GDK_DECOR_BORDER;  /* has_border */

  if (decorations == 0)
    gtk_window_set_decorated((GtkWindow*)ih->handle, FALSE);
  else
  {
    GdkWindow* window = iupgtkGetWindow(ih->handle);
    if (window)
    {
      gdk_window_set_decorations(window, (GdkWMDecoration)decorations);
      gdk_window_set_functions(window, (GdkWMFunction)functions);
    }
  }

  /* configure for DRAG&DROP */
  if (IupGetCallback(ih, "DROPFILES_CB"))
    iupAttribSetStr(ih, "DROPFILESTARGET", "YES");

  {
    /* Reset the DLGBGCOLOR global attribute 
       if it is the first time a dialog is created. 
       The value returned by gtk_style_new is not accurate. */
    GtkStyle* style = gtk_widget_get_style(ih->handle);
    if (style && IupGetGlobal("_IUP_RESET_GLOBALCOLORS"))
    {
      iupgtkUpdateGlobalColors(style);
      IupSetGlobal("_IUP_RESET_GLOBALCOLORS", NULL);
    }
  }

  /* configure the size range */
  gtkDialogSetMinMax(ih, 1, 1, 65535, 65535);  /* MINSIZE and MAXSIZE default values */

  /* Ignore VISIBLE before mapping */
  iupAttribSetStr(ih, "VISIBLE", NULL);

  if (iupStrBoolean(IupGetGlobal("INPUTCALLBACKS")))
    gtk_widget_add_events(ih->handle, GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_MOTION_MASK);

  return IUP_NOERROR;
}
Пример #22
0
void appconfig_show(GtkWidget *main_window)
{
    GtkWidget *vbox;
    GtkWidget *table;
    GtkWidget *hbbox;
    GtkWidget *ok_button;
    GtkWidget *label;

    GtkWidget *notebook;

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_realize(window);
    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
    gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(main_window));
    gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ON_PARENT);
    gdk_window_set_functions(gtk_widget_get_window(window), GDK_FUNC_MOVE);
    gtk_window_set_title( GTK_WINDOW(window), _("wavbreaker Preferences"));

    /* create the vbox for the first tab */
    vbox = gtk_vbox_new(FALSE, 10);
    gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
    gtk_container_add( GTK_CONTAINER(window), vbox);

    notebook = gtk_notebook_new();
    gtk_container_add( GTK_CONTAINER(vbox), notebook);

    /* Selectable Output Directory */
    table = gtk_table_new(2, 3, FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(table), 10);
    gtk_table_set_row_spacings( GTK_TABLE(table), 5);
    gtk_notebook_append_page( GTK_NOTEBOOK(notebook), table, gtk_label_new( _("General")));

    use_outputdir_toggle = gtk_check_button_new_with_label(_("Save output files in folder:"));
    gtk_table_attach(GTK_TABLE(table), use_outputdir_toggle,
        0, 2, 0, 1, GTK_FILL, 0, 5, 0);
    g_signal_connect(GTK_OBJECT(use_outputdir_toggle), "toggled",
        G_CALLBACK(use_outputdir_toggled), NULL);

    outputdir_entry = gtk_entry_new();
    gtk_entry_set_text(GTK_ENTRY(outputdir_entry), outputdir);
    gtk_entry_set_width_chars(GTK_ENTRY(outputdir_entry), 40);
    gtk_table_attach(GTK_TABLE(table), outputdir_entry,
        0, 1, 1, 2, GTK_EXPAND | GTK_FILL, 0, 5, 0);

    browse_button = gtk_button_new_with_label(_("Browse"));
    gtk_table_attach(GTK_TABLE(table), browse_button,
        1, 2, 1, 2, GTK_FILL, 0, 5, 0);
    g_signal_connect(G_OBJECT(browse_button), "clicked",
            (GCallback)browse_button_clicked, window);

    silence_spin_button = (GtkWidget*)gtk_spin_button_new_with_range( 1.0, 100.0, 1.0);
    gtk_spin_button_set_digits( GTK_SPIN_BUTTON(silence_spin_button), 0);
    gtk_spin_button_set_value( GTK_SPIN_BUTTON(silence_spin_button), appconfig_get_silence_percentage());
    
    label = gtk_label_new( _("Maximum volume considered silence (in percent):"));
    gtk_misc_set_alignment( GTK_MISC(label), 0.0, 0.5);

    gtk_table_attach( GTK_TABLE(table), label,
        0, 1, 2, 3, GTK_FILL, 0, 5, 0);
    gtk_table_attach( GTK_TABLE(table), silence_spin_button,
        1, 2, 2, 3, GTK_EXPAND, 0, 5, 0);

    /* Etree Filename Suffix */

    table = gtk_table_new(4, 10, FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(table), 10);
    gtk_notebook_append_page( GTK_NOTEBOOK(notebook), table, gtk_label_new( _("File Naming")));

    radio1 = gtk_radio_button_new_with_label(NULL, _("Standard (##)"));
    gtk_table_attach(GTK_TABLE(table), radio1, 0, 3, 0, 1, GTK_FILL, 0, 5, 2);
    g_signal_connect(GTK_OBJECT(radio1), "toggled",
        G_CALLBACK(radio_buttons_toggled), NULL);

    label = gtk_label_new("   ");
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), label,
            0, 1, 2, 3, GTK_FILL, 0, 5, 2);

    prepend_file_number_toggle = gtk_check_button_new_with_label(_("Prepend number before filename"));
    gtk_table_attach(GTK_TABLE(table), prepend_file_number_toggle,
            1, 3, 2, 3, GTK_FILL, 0, 5, 0);
    g_signal_connect(GTK_OBJECT(prepend_file_number_toggle), "toggled",
        G_CALLBACK(prepend_file_number_toggled), NULL);

    etree_filename_suffix_label = gtk_label_new(_("Separator:"));
    gtk_misc_set_alignment(GTK_MISC(etree_filename_suffix_label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), etree_filename_suffix_label,
            1, 2, 1, 2, GTK_FILL, 0, 5, 2);

    etree_filename_suffix_entry = gtk_entry_new();
    gtk_entry_set_text(GTK_ENTRY(etree_filename_suffix_entry), etree_filename_suffix);
    gtk_entry_set_width_chars(GTK_ENTRY(etree_filename_suffix_entry), 10);
    gtk_table_attach(GTK_TABLE(table), etree_filename_suffix_entry,
            2, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 5, 2);

    radio2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio1),
            _("etree.org (d#t##)"));
    gtk_table_attach(GTK_TABLE(table), radio2, 0, 3, 3, 4, GTK_FILL, 0, 5, 2);

    etree_cd_length_label = gtk_label_new(_("CD Length:"));
    gtk_misc_set_alignment(GTK_MISC(etree_cd_length_label), 0, 0.5);
    gtk_table_attach(GTK_TABLE(table), etree_cd_length_label,
            1, 2, 5, 6, GTK_FILL, 0, 5, 2);

    etree_cd_length_entry = gtk_entry_new();
    gtk_entry_set_text(GTK_ENTRY(etree_cd_length_entry), etree_cd_length);
    gtk_entry_set_width_chars(GTK_ENTRY(etree_cd_length_entry), 10);
    gtk_table_attach(GTK_TABLE(table), etree_cd_length_entry,
            2, 3, 5, 6, GTK_EXPAND | GTK_FILL, 0, 5, 2);

    /* OK and Cancel Buttons */
    hbbox = gtk_hbutton_box_new();
    gtk_container_add(GTK_CONTAINER(vbox), hbbox);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_END);
    gtk_box_set_spacing(GTK_BOX(hbbox), 10);

    ok_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
    gtk_box_pack_end(GTK_BOX(hbbox), ok_button, FALSE, FALSE, 5);
    g_signal_connect(G_OBJECT(ok_button), "clicked",
        (GCallback)ok_button_clicked, window);

    g_signal_connect(GTK_OBJECT(radio2), "toggled",
        G_CALLBACK(use_etree_filename_suffix_toggled), NULL);

    loading_ui = TRUE;

    gboolean use_output_dir = appconfig_get_use_outputdir() ? TRUE : FALSE;
    gtk_widget_set_sensitive(outputdir_entry, use_output_dir);
    gtk_widget_set_sensitive(browse_button, use_output_dir);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_outputdir_toggle), use_output_dir);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prepend_file_number_toggle),
            appconfig_get_prepend_file_number() ? TRUE : FALSE);

    gboolean use_etree = appconfig_get_use_etree_filename_suffix() ? TRUE : FALSE;
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio1), !use_etree);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2), use_etree);

    loading_ui = FALSE;

    gtk_widget_show_all(window);
    set_audio_function_pointers();
    radio_buttons_toggled( NULL, NULL);
}
Пример #23
0
static GtkWidget *discard_create_dlg(gint num)
{
	GtkWidget *dlg_vbox;
	GtkWidget *vbox;
	gchar *text;

	discard.dlg = gtk_dialog_new_with_buttons(
							 /* Dialog caption */
							 _(""
							   "Discard Resources"),
							 GTK_WINDOW
							 (app_window),
							 GTK_DIALOG_DESTROY_WITH_PARENT,
							 GTK_STOCK_OK,
							 GTK_RESPONSE_OK,
							 NULL);
	g_signal_connect(G_OBJECT(discard.dlg), "destroy",
			 G_CALLBACK(gtk_widget_destroyed), &discard.dlg);
	gtk_widget_realize(discard.dlg);
	/* Disable close */
	gdk_window_set_functions(discard.dlg->window,
				 GDK_FUNC_ALL | GDK_FUNC_CLOSE);

	dlg_vbox = GTK_DIALOG(discard.dlg)->vbox;
	gtk_widget_show(dlg_vbox);

	vbox = gtk_vbox_new(FALSE, 6);
	gtk_widget_show(vbox);
	gtk_box_pack_start(GTK_BOX(dlg_vbox), vbox, FALSE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);

	text = g_strdup_printf(ngettext("You must discard %d resource",
					"You must discard %d resources",
					num), num);
	discard.resource_widget =
	    resource_table_new(text, RESOURCE_TABLE_LESS_IN_HAND, FALSE,
			       TRUE);
	g_free(text);
	resource_table_set_total(RESOURCETABLE(discard.resource_widget),
				 /* Label */
				 _("Total discards"), num);
	gtk_widget_show(discard.resource_widget);
	gtk_box_pack_start(GTK_BOX(vbox), discard.resource_widget, FALSE,
			   TRUE, 0);
	g_signal_connect(G_OBJECT(discard.resource_widget), "change",
			 G_CALLBACK(amount_changed_cb), NULL);

	frontend_gui_register(gui_get_dialog_button
			      (GTK_DIALOG(discard.dlg), 0), GUI_DISCARD,
			      "clicked");
	/* This _must_ be after frontend_gui_register, otherwise the
	 * regeneration of the button happens before the destruction, which
	 * results in an incorrectly sensitive OK button. */
	g_signal_connect(gui_get_dialog_button(GTK_DIALOG(discard.dlg), 0),
			 "destroy", G_CALLBACK(button_destroyed),
			 GINT_TO_POINTER(num));
	gtk_widget_show(discard.dlg);
	frontend_gui_update();

	return discard.dlg;
}
Пример #24
0
static VALUE
rg_set_functions(VALUE self, VALUE func)
{
    gdk_window_set_functions(_SELF(self), RVAL2GDKWMFUNCTION(func));
    return self;
}