/**************************************************************** Popup unit bribe dialog *****************************************************************/ void popup_bribe_dialog(struct unit *punit, int cost) { GtkWidget *shell; char buf[1024]; fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.", "Treasury contains %d gold.", client_player()->economic.gold), client_player()->economic.gold); if (cost <= client_player()->economic.gold) { shell = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, /* TRANS: %s is pre-pluralised "Treasury contains %d gold." */ PL_("Bribe unit for %d gold?\n%s", "Bribe unit for %d gold?\n%s", cost), cost, buf); gtk_window_set_title(GTK_WINDOW(shell), _("Bribe Enemy Unit")); setup_dialog(shell, toplevel); } else { shell = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, /* TRANS: %s is pre-pluralised "Treasury contains %d gold." */ PL_("Bribing the unit costs %d gold.\n%s", "Bribing the unit costs %d gold.\n%s", cost), cost, buf); gtk_window_set_title(GTK_WINDOW(shell), _("Traitors Demand Too Much!")); setup_dialog(shell, toplevel); } gtk_window_present(GTK_WINDOW(shell)); g_signal_connect(shell, "response", G_CALLBACK(bribe_response), NULL); }
static void display_properties_dialog (BonoboUIComponent *uic, PagerData *pager, const gchar *verbname) { if (pager->properties_dialog == NULL) { GladeXML *xml; xml = glade_xml_new (PAGER_GLADEDIR "/workspace-switcher.glade", NULL, NULL); pager->properties_dialog = glade_xml_get_widget (xml, "pager_properties_dialog"); g_object_add_weak_pointer (G_OBJECT (pager->properties_dialog), (gpointer *) &pager->properties_dialog); setup_dialog (xml, pager); g_object_unref (G_OBJECT (xml)); } gtk_window_set_icon_name (GTK_WINDOW (pager->properties_dialog), "gnome-panel-workspace-switcher"); gtk_window_set_screen (GTK_WINDOW (pager->properties_dialog), gtk_widget_get_screen (pager->applet)); gtk_window_present (GTK_WINDOW (pager->properties_dialog)); }
GncGWENGui * gnc_GWEN_Gui_get(GtkWidget *parent) { GncGWENGui *gui; ENTER("parent=%p", parent); if (full_gui) { if (full_gui->state == INIT || full_gui->state == RUNNING) { LEAVE("full_gui in use, state=%d", full_gui->state); return NULL; } gui = full_gui; gui->parent = parent; reset_dialog(gui); register_callbacks(gui); LEAVE("gui=%p", gui); return gui; } gui = g_new0(GncGWENGui, 1); gui->parent = parent; setup_dialog(gui); register_callbacks(gui); full_gui = gui; LEAVE("new gui=%p", gui); return gui; }
static void display_properties_dialog (BonoboUIComponent *uic, TasklistData *tasklist, const gchar *verbname) { if (tasklist->properties_dialog == NULL) { GladeXML *xml; xml = glade_xml_new (TASKLIST_GLADEDIR "/window-list.glade", NULL, NULL); tasklist->properties_dialog = glade_xml_get_widget (xml, "tasklist_properties_dialog"); g_object_add_weak_pointer (G_OBJECT (tasklist->properties_dialog), (void**) &tasklist->properties_dialog); setup_dialog (xml, tasklist); g_object_unref (G_OBJECT (xml)); } gtk_window_set_icon_name (GTK_WINDOW (tasklist->properties_dialog), "gnome-panel-window-list"); gtk_window_set_resizable (GTK_WINDOW (tasklist->properties_dialog), FALSE); gtk_window_set_screen (GTK_WINDOW (tasklist->properties_dialog), gtk_widget_get_screen (tasklist->applet)); gtk_window_present (GTK_WINDOW (tasklist->properties_dialog)); }
static void display_properties_dialog(GtkAction* action, TasklistData* tasklist) { if (tasklist->properties_dialog == NULL) { GtkBuilder* builder; GError* error; builder = gtk_builder_new(); gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE); error = NULL; gtk_builder_add_from_file(builder, TASKLIST_BUILDERDIR "/window-list.ui", &error); if (error) { g_warning("Error loading preferences: %s", error->message); g_error_free(error); return; } tasklist->properties_dialog = WID("tasklist_properties_dialog"); g_object_add_weak_pointer(G_OBJECT(tasklist->properties_dialog), (void**) &tasklist->properties_dialog); setup_dialog(builder, tasklist); g_object_unref(builder); } gtk_window_set_icon_name(GTK_WINDOW(tasklist->properties_dialog), WINDOW_LIST_ICON); gtk_window_set_resizable(GTK_WINDOW(tasklist->properties_dialog), FALSE); gtk_window_set_screen(GTK_WINDOW(tasklist->properties_dialog), gtk_widget_get_screen(tasklist->applet)); gtk_window_present(GTK_WINDOW(tasklist->properties_dialog)); }
static void display_properties_dialog (GtkAction *action, PagerData *pager) { if (pager->properties_dialog == NULL) { GtkBuilder *builder; builder = gtk_builder_new (); gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); gtk_builder_add_from_resource (builder, WNCKLET_RESOURCE_PATH "workspace-switcher.ui", NULL); pager->properties_dialog = WID ("pager_properties_dialog"); g_object_add_weak_pointer (G_OBJECT (pager->properties_dialog), (gpointer *) &pager->properties_dialog); setup_dialog (builder, pager); g_object_unref (builder); } gtk_window_set_icon_name (GTK_WINDOW (pager->properties_dialog), WORKSPACE_SWITCHER_ICON); gtk_window_set_screen (GTK_WINDOW (pager->properties_dialog), gtk_widget_get_screen (pager->applet)); gtk_window_present (GTK_WINDOW (pager->properties_dialog)); }
static void display_properties_dialog(GtkAction* action, PagerData* pager) { if (pager->properties_dialog == NULL) { GtkBuilder* builder; GError* error; builder = gtk_builder_new(); gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE); error = NULL; gtk_builder_add_from_file(builder, PAGER_BUILDERDIR "/workspace-switcher.ui", &error); if (error) { g_warning("Error loading preferences: %s", error->message); g_error_free(error); return; } pager->properties_dialog = WID("pager_properties_dialog"); g_object_add_weak_pointer(G_OBJECT(pager->properties_dialog), (gpointer*) &pager->properties_dialog); setup_dialog(builder, pager); g_object_unref(builder); } gtk_window_set_icon_name(GTK_WINDOW(pager->properties_dialog), WORKSPACE_SWITCHER_ICON); gtk_window_set_screen(GTK_WINDOW(pager->properties_dialog), gtk_widget_get_screen(pager->applet)); gtk_window_present(GTK_WINDOW(pager->properties_dialog)); }
GtkWidget * gnome_mouse_test_init (GtkBuilder *dialog) { mouse_settings = g_settings_new ("org.cinnamon.settings-daemon.peripherals.mouse"); setup_dialog (dialog); return WID ("mouse_test_window"); }
int main (int argc, char *argv[]) { GConfClient *client; GConfChangeSet *changeset; GladeXML *dialog = NULL; GtkWidget *dialog_win; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gnome_program_init ("brightside-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); client = gconf_client_get_default (); gconf_client_add_dir (client, BRIGHTSIDE_KEY_ROOT, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); conf_client = client; changeset = gconf_change_set_new (); dialog = create_dialog (); setup_dialog (dialog, changeset); dialog_win = gtk_dialog_new_with_buttons( _("Screen Actions"), NULL, GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); gtk_container_set_border_width (GTK_CONTAINER (dialog_win), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG(dialog_win)->vbox), 2); gtk_dialog_set_default_response (GTK_DIALOG (dialog_win), GTK_RESPONSE_CLOSE); g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback) dialog_button_clicked_cb, changeset); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, 0); gtk_window_set_resizable (GTK_WINDOW (dialog_win), FALSE); gtk_window_set_icon_from_file (GTK_WINDOW (dialog_win), BRIGHTSIDE_DATA "brightside.svg", NULL); gtk_widget_show_all (dialog_win); if (is_running () == FALSE) g_spawn_command_line_async ("brightside", NULL); gtk_main (); gconf_change_set_unref (changeset); g_object_unref (dialog); return 0; }
/**************************************************************** Popup the yes/no dialog for inciting, since we know the cost now *****************************************************************/ void popup_incite_dialog(struct city *pcity, int cost) { GtkWidget *shell; char buf[1024]; fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.", "Treasury contains %d gold.", client_player()->economic.gold), client_player()->economic.gold); if (INCITE_IMPOSSIBLE_COST == cost) { shell = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("You can't incite a revolt in %s."), city_name(pcity)); gtk_window_set_title(GTK_WINDOW(shell), _("City can't be incited!")); setup_dialog(shell, toplevel); } else if (cost <= client_player()->economic.gold) { shell = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, /* TRANS: %s is pre-pluralised "Treasury contains %d gold." */ PL_("Incite a revolt for %d gold?\n%s", "Incite a revolt for %d gold?\n%s", cost), cost, buf); gtk_window_set_title(GTK_WINDOW(shell), _("Incite a Revolt!")); setup_dialog(shell, toplevel); } else { shell = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, /* TRANS: %s is pre-pluralised "Treasury contains %d gold." */ PL_("Inciting a revolt costs %d gold.\n%s", "Inciting a revolt costs %d gold.\n%s", cost), cost, buf); gtk_window_set_title(GTK_WINDOW(shell), _("Traitors Demand Too Much!")); setup_dialog(shell, toplevel); } gtk_window_present(GTK_WINDOW(shell)); g_signal_connect(shell, "response", G_CALLBACK(incite_response), NULL); }
/***************************************************************************** Create a file selector for loading a lua file.. *****************************************************************************/ static void luaconsole_load_file_popup(void) { GtkWidget *filesel; /* Create the selector */ filesel = gtk_file_selection_new("Load Lua file"); setup_dialog(filesel, toplevel); gtk_window_set_position(GTK_WINDOW(filesel), GTK_WIN_POS_MOUSE); g_signal_connect(filesel, "response", G_CALLBACK(luaconsole_load_file_callback), NULL); /* Display that dialog */ gtk_window_present(GTK_WINDOW(filesel)); }
void preferences_show (void) { if (dialog == NULL) { glade_xml = glade_xml_new(g_build_filename(MINBAR_DATADIR,GLADE_MAIN_INTERFACE,NULL), NULL, NULL); glade_xml_signal_autoconnect(glade_xml); dialog = glade_xml_get_widget(glade_xml, "editcity"); setup_dialog(); update_widgets(); } gtk_window_present(GTK_WINDOW(dialog)); }
int main (int argc, char **argv) { GtkBuilder *builder; GError *error = NULL; gchar *builder_widgets[] = {"network_dialog", "adjustment1", "adjustment2", "adjustment3", "adjustment4", "delete_button_img", NULL}; GtkWidget *widget; bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init (&argc, &argv); builder = gtk_builder_new (); if (gtk_builder_add_objects_from_file (builder, MATECC_GNP_UI_FILE, builder_widgets, &error) == 0) { g_warning ("Could not load main dialog: %s", error->message); g_error_free (error); g_object_unref (builder); return (EXIT_FAILURE); } proxy_settings = g_settings_new (PROXY_SCHEMA); http_proxy_settings = g_settings_new (HTTP_PROXY_SCHEMA); https_proxy_settings = g_settings_new (HTTPS_PROXY_SCHEMA); ftp_proxy_settings = g_settings_new (FTP_PROXY_SCHEMA); socks_proxy_settings = g_settings_new (SOCKS_PROXY_SCHEMA); setup_dialog (builder); widget = _gtk_builder_get_widget (builder, "network_dialog"); capplet_set_icon (widget, "mate-network-properties"); gtk_widget_show_all (widget); gtk_main (); g_object_unref (builder); g_object_unref (proxy_settings); g_object_unref (http_proxy_settings); g_object_unref (https_proxy_settings); g_object_unref (ftp_proxy_settings); g_object_unref (socks_proxy_settings); return 0; }
GtkWidget * gnome_mouse_properties_init (GtkBuilder *dialog) { mouse_settings = g_settings_new ("org.cinnamon.settings-daemon.peripherals.mouse"); touchpad_settings = g_settings_new ("org.cinnamon.settings-daemon.peripherals.touchpad"); device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); device_added_id = g_signal_connect (device_manager, "device-added", G_CALLBACK (device_changed), dialog); device_removed_id = g_signal_connect (device_manager, "device-removed", G_CALLBACK (device_changed), dialog); create_dialog (dialog); setup_dialog (dialog); return WID ("mouse_properties_dialog"); }
/************************************************************************** Changes a tab into a window. **************************************************************************/ static void gui_dialog_detach(struct gui_dialog* dlg) { gint n; GtkWidget *window, *notebook; gulong handler_id; if (dlg->type != GUI_DIALOG_TAB) { return; } dlg->type = GUI_DIALOG_WINDOW; /* Create a new reference to the main widget, so it won't be * destroyed in gtk_notebook_remove_page() */ g_object_ref(dlg->vbox); /* Remove widget from the notebook */ notebook = dlg->v.tab.notebook; handler_id = dlg->v.tab.handler_id; g_signal_handler_disconnect(notebook, handler_id); n = gtk_notebook_page_num(GTK_NOTEBOOK(dlg->v.tab.notebook), dlg->vbox); gtk_notebook_remove_page(GTK_NOTEBOOK(dlg->v.tab.notebook), n); /* Create window and put the widget inside */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), dlg->title); setup_dialog(window, toplevel); gtk_container_add(GTK_CONTAINER(window), dlg->vbox); dlg->v.window = window; g_signal_connect(window, "delete_event", G_CALLBACK(gui_dialog_delete_handler), dlg); gtk_window_set_default_size(GTK_WINDOW(dlg->v.window), dlg->default_width, dlg->default_height); gtk_widget_show_all(window); }
/**************************************************************** Create choice dialog *****************************************************************/ GtkWidget *choice_dialog_start(GtkWindow *parent, const gchar *name, const gchar *text) { GtkWidget *dshell, *dlabel, *vbox, *bbox; dshell = gtk_window_new(GTK_WINDOW_TOPLEVEL); setup_dialog(dshell, toplevel); gtk_window_set_position (GTK_WINDOW(dshell), GTK_WIN_POS_MOUSE); gtk_window_set_title(GTK_WINDOW(dshell), name); gtk_window_set_transient_for(GTK_WINDOW(dshell), parent); gtk_window_set_destroy_with_parent(GTK_WINDOW(dshell), TRUE); vbox = gtk_grid_new(); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing(GTK_GRID(vbox), 5); gtk_container_add(GTK_CONTAINER(dshell),vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); dlabel = gtk_label_new(text); gtk_container_add(GTK_CONTAINER(vbox), dlabel); bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); gtk_box_set_spacing(GTK_BOX(bbox), 2); gtk_container_add(GTK_CONTAINER(vbox), bbox); g_object_set_data(G_OBJECT(dshell), "bbox", bbox); g_object_set_data(G_OBJECT(dshell), "nbuttons", GINT_TO_POINTER(0)); g_object_set_data(G_OBJECT(dshell), "hide", GINT_TO_POINTER(FALSE)); gtk_widget_show(vbox); gtk_widget_show(dlabel); return dshell; }
/**************************************************************** Popup dialog asking if ruleset suggested tileset should be used. *****************************************************************/ void popup_tileset_suggestion_dialog(void) { GtkWidget *dialog, *label; char buf[1024]; dialog = gtk_dialog_new_with_buttons(_("Preferred tileset"), NULL, 0, _("Load tileset"), GTK_RESPONSE_YES, _("Keep current tileset"), GTK_RESPONSE_NO, NULL); setup_dialog(dialog, toplevel); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES); gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); sprintf(buf, _("Modpack suggests using %s tileset.\n" "It might not work with other tilesets.\n" "You are currently using tileset %s."), game.control.prefered_tileset, tileset_get_name(tileset)); label = gtk_label_new(buf); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER); gtk_widget_show(label); g_signal_connect(dialog, "response", G_CALLBACK(tileset_suggestion_callback), NULL); /* In case incoming rulesets are incompatible with current tileset * we need to block their receive before user has accepted loading * of the correct tileset. */ gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); }
int main (int argc, char **argv) { GtkBuilder *dialog; GOptionContext *context; static gboolean apply_only = FALSE; static gboolean switch_to_typing_break_page = FALSE; static gboolean switch_to_a11y_page = FALSE; static GOptionEntry cap_options[] = { {"apply", 0, 0, G_OPTION_ARG_NONE, &apply_only, N_ ("Just apply settings and quit (compatibility only; now handled by daemon)"), NULL}, {"init-session-settings", 0, 0, G_OPTION_ARG_NONE, &apply_only, N_ ("Just apply settings and quit (compatibility only; now handled by daemon)"), NULL}, {"typing-break", 0, 0, G_OPTION_ARG_NONE, &switch_to_typing_break_page, N_ ("Start the page with the typing break settings showing"), NULL}, {"a11y", 0, 0, G_OPTION_ARG_NONE, &switch_to_a11y_page, N_ ("Start the page with the accessibility settings showing"), NULL}, {NULL} }; context = g_option_context_new (_("- MATE Keyboard Preferences")); g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE); capplet_init (context, &argc, &argv); activate_settings_daemon (); keyboard_settings = g_settings_new (KEYBOARD_SCHEMA); interface_settings = g_settings_new (INTERFACE_SCHEMA); typing_break_settings = g_settings_new (TYPING_BREAK_SCHEMA); dialog = create_dialog (); if (!dialog) /* Warning was already printed to console */ exit (EXIT_FAILURE); setup_dialog (dialog); if (switch_to_typing_break_page) { gtk_notebook_set_current_page (GTK_NOTEBOOK (WID ("keyboard_notebook")), 4); } else if (switch_to_a11y_page) { gtk_notebook_set_current_page (GTK_NOTEBOOK (WID ("keyboard_notebook")), 2); } capplet_set_icon (WID ("keyboard_dialog"), "preferences-desktop-keyboard"); gtk_widget_show (WID ("keyboard_dialog")); gtk_main (); finalize_a11y_tabs (); g_object_unref (keyboard_settings); g_object_unref (interface_settings); g_object_unref (typing_break_settings); return 0; }
void fx_disp_window::setup() { setup_name(); setup_dialog(); }
/**************************************************************** Bring up the global worklist report. *****************************************************************/ static GtkWidget *create_worklists_report(void) { GtkWidget *shell, *list; GtkWidget *vbox, *label, *sw; GtkCellRenderer *rend; shell = gtk_dialog_new_with_buttons(_("Edit worklists"), NULL, 0, GTK_STOCK_NEW, WORKLISTS_NEW, GTK_STOCK_DELETE, WORKLISTS_DELETE, GTK_STOCK_PROPERTIES, WORKLISTS_PROPERTIES, GTK_STOCK_CLOSE, WORKLISTS_CLOSE, NULL); setup_dialog(shell, toplevel); gtk_window_set_position(GTK_WINDOW(shell), GTK_WIN_POS_MOUSE); g_signal_connect(shell, "response", G_CALLBACK(worklists_response), NULL); g_signal_connect(shell, "destroy", G_CALLBACK(worklists_destroy_callback), NULL); vbox = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(vbox), 2); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(shell))), vbox); worklists_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(worklists_store)); gtk_widget_set_hexpand(list, TRUE); gtk_widget_set_vexpand(list, TRUE); g_object_unref(worklists_store); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); worklists_list = list; rend = gtk_cell_renderer_text_new(); g_object_set(rend, "editable", TRUE, NULL); g_signal_connect(rend, "edited", G_CALLBACK(cell_edited), NULL); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(list), -1, NULL, rend, "text", 0, NULL); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_container_add(GTK_CONTAINER(sw), list); label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE, "mnemonic-widget", list, "label", _("_Worklists:"), "xalign", 0.0, "yalign", 0.5, NULL); gtk_container_add(GTK_CONTAINER(vbox), label); gtk_container_add(GTK_CONTAINER(vbox), sw); gtk_widget_show_all(vbox); return shell; }
int main (int argc, char **argv) { GtkBuilder *dialog; GtkWidget *dialog_win, *w; gchar *start_page = NULL; GOptionContext *context; GOptionEntry cap_options[] = { {"show-page", 'p', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &start_page, /* TRANSLATORS: don't translate the terms in brackets */ N_("Specify the name of the page to show (general)"), N_("page") }, {NULL} }; context = g_option_context_new (_("- MATE Mouse Preferences")); g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE); capplet_init (context, &argc, &argv); capplet_init_stock_icons (); activate_settings_daemon (); mouse_settings = g_settings_new (MOUSE_SCHEMA); touchpad_settings = g_settings_new (TOUCHPAD_SCHEMA); dialog = create_dialog (); if (dialog) { setup_dialog (dialog); dialog_win = WID ("mouse_properties_dialog"); g_signal_connect (dialog_win, "response", G_CALLBACK (dialog_response_cb), NULL); if (start_page != NULL) { gchar *page_name; page_name = g_strconcat (start_page, "_vbox", NULL); g_free (start_page); w = WID (page_name); if (w != NULL) { GtkNotebook *nb; gint pindex; nb = GTK_NOTEBOOK (WID ("prefs_widget")); pindex = gtk_notebook_page_num (nb, w); if (pindex != -1) gtk_notebook_set_current_page (nb, pindex); } g_free (page_name); } capplet_set_icon (dialog_win, "input-mouse"); gtk_widget_show (dialog_win); gtk_main (); g_object_unref (dialog); } g_object_unref (mouse_settings); g_object_unref (touchpad_settings); return 0; }
int main (int argc, char **argv) { GConfChangeSet *changeset; GladeXML *dialog; GnomeProgram *program; GOptionContext *context; gboolean apply_only = FALSE; gboolean get_legacy = FALSE; GOptionEntry cap_options[] = { { "apply", 0, 0, G_OPTION_ARG_NONE, &apply_only, N_("Just apply settings and quit (compatibility only; now handled by daemon)"), NULL }, { "init-session-settings", 0, 0, G_OPTION_ARG_NONE, &apply_only, N_("Just apply settings and quit (compatibility only; now handled by daemon)"), NULL }, { "get-legacy", 0, 0, G_OPTION_ARG_NONE, &get_legacy, N_("Retrieve and store legacy settings"), NULL }, { NULL } }; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* Since gstreamer and gnome-vfs require threads, we * have to initialise threads here as the first call to glib. */ g_thread_init (NULL); context = g_option_context_new (N_("- GNOME Sound Preferences")); #if GLIB_CHECK_VERSION (2, 12, 0) g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); #endif g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE); g_option_context_add_group (context, gst_init_get_option_group ()); program = gnome_program_init ("gnome-sound-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_GOPTION_CONTEXT, context, NULL); activate_settings_daemon (); gconf_client = gconf_client_get_default (); gconf_client_add_dir (gconf_client, "/desktop/gnome/sound", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (gconf_client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); if (get_legacy) { get_legacy_settings (); } else { dialog = create_dialog (); if (dialog) { changeset = gconf_change_set_new (); setup_dialog (dialog, changeset); setup_devices (); dialog_win = WID ("sound_prefs_dialog"); g_signal_connect (dialog_win, "response", G_CALLBACK (dialog_response_cb), changeset); g_signal_connect (dialog_win, "destroy", G_CALLBACK (gtk_main_quit), NULL); capplet_set_icon (dialog_win, "gnome-sound-properties"); gtk_widget_show (dialog_win); gtk_main (); gconf_change_set_unref (changeset); g_object_unref (dialog); } } g_object_unref (gconf_client); g_object_unref (program); return 0; }
/**************************************************************** Create spy's tech stealing dialog *****************************************************************/ static void create_advances_list(struct player *pplayer, struct player *pvictim) { GtkWidget *sw, *label, *vbox, *view; GtkListStore *store; GtkCellRenderer *rend; GtkTreeViewColumn *col; spy_tech_shell = gtk_dialog_new_with_buttons(_("Steal Technology"), NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Steal"), GTK_RESPONSE_ACCEPT, NULL); setup_dialog(spy_tech_shell, toplevel); gtk_window_set_position(GTK_WINDOW(spy_tech_shell), GTK_WIN_POS_MOUSE); gtk_dialog_set_default_response(GTK_DIALOG(spy_tech_shell), GTK_RESPONSE_ACCEPT); label = gtk_frame_new(_("Select Advance to Steal")); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(spy_tech_shell))), label); vbox = gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(label), vbox); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); rend = gtk_cell_renderer_text_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE, "mnemonic-widget", view, "label", _("_Advances:"), "xalign", 0.0, "yalign", 0.5, NULL); gtk_container_add(GTK_CONTAINER(vbox), label); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(sw), view); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_widget_set_size_request(sw, -1, 200); gtk_container_add(GTK_CONTAINER(vbox), sw); /* Now populate the list */ if (pvictim) { /* you don't want to know what lag can do -- Syela */ GtkTreeIter it; GValue value = { 0, }; advance_index_iterate(A_FIRST, i) { if(player_invention_state(pvictim, i)==TECH_KNOWN && (player_invention_state(pplayer, i)==TECH_UNKNOWN || player_invention_state(pplayer, i)==TECH_PREREQS_KNOWN)) { gtk_list_store_append(store, &it); g_value_init(&value, G_TYPE_STRING); g_value_set_static_string(&value, advance_name_for_player(client.conn.playing, i)); gtk_list_store_set_value(store, &it, 0, &value); g_value_unset(&value); gtk_list_store_set(store, &it, 1, i, -1); } } advance_index_iterate_end; gtk_list_store_append(store, &it); g_value_init(&value, G_TYPE_STRING); { struct astring str = ASTRING_INIT; /* TRANS: %s is a unit name, e.g., Spy */ astr_set(&str, _("At %s's Discretion"), unit_name_translation(game_unit_by_number(diplomat_id))); g_value_set_string(&value, astr_str(&str)); astr_free(&str); } gtk_list_store_set_value(store, &it, 0, &value); g_value_unset(&value); gtk_list_store_set(store, &it, 1, A_UNSET, -1); } gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_tech_shell), GTK_RESPONSE_ACCEPT, FALSE); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(spy_tech_shell))); g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), "changed", G_CALLBACK(spy_advances_callback), NULL); g_signal_connect(spy_tech_shell, "response", G_CALLBACK(spy_advances_response), NULL); steal_advance = 0; gtk_tree_view_focus(GTK_TREE_VIEW(view)); }
/**************************************************************** Create rates dialog *****************************************************************/ static GtkWidget *create_rates_dialog(void) { GtkWidget *shell, *content; GtkWidget *frame, *hgrid; int i; if (!can_client_issue_orders()) { return NULL; } shell = gtk_dialog_new_with_buttons(_("Select tax, luxury and science rates"), NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); setup_dialog(shell, toplevel); gtk_dialog_set_default_response(GTK_DIALOG(shell), GTK_RESPONSE_OK); gtk_window_set_position(GTK_WINDOW(shell), GTK_WIN_POS_MOUSE); content = gtk_dialog_get_content_area(GTK_DIALOG(shell)); rates_gov_label = gtk_label_new(""); gtk_box_pack_start( GTK_BOX( content ), rates_gov_label, TRUE, TRUE, 5 ); frame = gtk_frame_new( _("Tax") ); gtk_box_pack_start( GTK_BOX( content ), frame, TRUE, TRUE, 5 ); hgrid = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(hgrid), 10); gtk_container_add(GTK_CONTAINER(frame), hgrid); rates_tax_scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 10, 1); gtk_range_set_increments(GTK_RANGE(rates_tax_scale), 1, 1); for (i = 0; i <= 10; i++) { gtk_scale_add_mark(GTK_SCALE(rates_tax_scale), i, GTK_POS_TOP, NULL); } gtk_widget_set_size_request(rates_tax_scale, 300, 40); gtk_scale_set_digits(GTK_SCALE(rates_tax_scale), 0); gtk_scale_set_draw_value(GTK_SCALE(rates_tax_scale), FALSE); gtk_container_add(GTK_CONTAINER(hgrid), rates_tax_scale); rates_tax_label = gtk_label_new(" 0%"); gtk_container_add(GTK_CONTAINER(hgrid), rates_tax_label); gtk_widget_set_size_request(rates_tax_label, 40, -1); rates_tax_toggle = gtk_check_button_new_with_label( _("Lock") ); gtk_container_add(GTK_CONTAINER(hgrid), rates_tax_toggle); frame = gtk_frame_new( _("Luxury") ); gtk_box_pack_start( GTK_BOX( content ), frame, TRUE, TRUE, 5 ); hgrid = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(hgrid), 10); gtk_container_add(GTK_CONTAINER(frame), hgrid); rates_lux_scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 10, 1); gtk_range_set_increments(GTK_RANGE(rates_lux_scale), 1, 1); for (i = 0; i <= 10; i++) { gtk_scale_add_mark(GTK_SCALE(rates_lux_scale), i, GTK_POS_TOP, NULL); } gtk_widget_set_size_request(rates_lux_scale, 300, 40); gtk_scale_set_digits(GTK_SCALE(rates_lux_scale), 0); gtk_scale_set_draw_value(GTK_SCALE(rates_lux_scale), FALSE); gtk_container_add(GTK_CONTAINER(hgrid), rates_lux_scale); rates_lux_label = gtk_label_new(" 0%"); gtk_container_add(GTK_CONTAINER(hgrid), rates_lux_label); gtk_widget_set_size_request(rates_lux_label, 40, -1); rates_lux_toggle = gtk_check_button_new_with_label( _("Lock") ); gtk_container_add(GTK_CONTAINER(hgrid), rates_lux_toggle); frame = gtk_frame_new( _("Science") ); gtk_box_pack_start( GTK_BOX( content ), frame, TRUE, TRUE, 5 ); hgrid = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(hgrid), 10); gtk_container_add(GTK_CONTAINER(frame), hgrid); rates_sci_scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 10, 1); gtk_range_set_increments(GTK_RANGE(rates_sci_scale), 1, 1); for (i = 0; i <= 10; i++) { gtk_scale_add_mark(GTK_SCALE(rates_sci_scale), i, GTK_POS_TOP, NULL); } gtk_widget_set_size_request(rates_sci_scale, 300, 40); gtk_scale_set_digits(GTK_SCALE(rates_sci_scale), 0); gtk_scale_set_draw_value(GTK_SCALE(rates_sci_scale), FALSE); gtk_container_add(GTK_CONTAINER(hgrid), rates_sci_scale); rates_sci_label = gtk_label_new(" 0%"); gtk_container_add(GTK_CONTAINER(hgrid), rates_sci_label); gtk_widget_set_size_request(rates_sci_label, 40, -1); rates_sci_toggle = gtk_check_button_new_with_label( _("Lock") ); gtk_container_add(GTK_CONTAINER(hgrid), rates_sci_toggle); g_signal_connect(shell, "response", G_CALLBACK(rates_command_callback), NULL); g_signal_connect(shell, "destroy", G_CALLBACK(gtk_widget_destroyed), &rates_dialog_shell); gtk_widget_show_all(content); gtk_widget_show_all(gtk_dialog_get_action_area(GTK_DIALOG(shell))); rates_tax_value=-1; rates_lux_value=-1; rates_sci_value=-1; rates_tax_sig = g_signal_connect_after(rates_tax_scale, "value-changed", G_CALLBACK(rates_changed_callback), NULL); rates_lux_sig = g_signal_connect_after(rates_lux_scale, "value-changed", G_CALLBACK(rates_changed_callback), NULL); rates_sci_sig = g_signal_connect_after(rates_sci_scale, "value-changed", G_CALLBACK(rates_changed_callback), NULL); rates_set_values(client.conn.playing->economic.tax, 0, client.conn.playing->economic.luxury, 0, client.conn.playing->economic.science, 0); return shell; }
/**************************************************************** Creates spy's building sabotaging dialog *****************************************************************/ static void create_improvements_list(struct player *pplayer, struct city *pcity) { GtkWidget *sw, *label, *vbox, *view; GtkListStore *store; GtkCellRenderer *rend; GtkTreeViewColumn *col; GtkTreeIter it; spy_sabotage_shell = gtk_dialog_new_with_buttons(_("Sabotage Improvements"), NULL, 0, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Sabotage"), GTK_RESPONSE_ACCEPT, NULL); setup_dialog(spy_sabotage_shell, toplevel); gtk_window_set_position(GTK_WINDOW(spy_sabotage_shell), GTK_WIN_POS_MOUSE); gtk_dialog_set_default_response(GTK_DIALOG(spy_sabotage_shell), GTK_RESPONSE_ACCEPT); label = gtk_frame_new(_("Select Improvement to Sabotage")); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(spy_sabotage_shell))), label); vbox = gtk_vbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(label), vbox); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); rend = gtk_cell_renderer_text_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, "text", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE, "mnemonic-widget", view, "label", _("_Improvements:"), "xalign", 0.0, "yalign", 0.5, NULL); gtk_container_add(GTK_CONTAINER(vbox), label); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(sw), view); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_widget_set_size_request(sw, -1, 200); gtk_container_add(GTK_CONTAINER(vbox), sw); /* Now populate the list */ gtk_list_store_append(store, &it); gtk_list_store_set(store, &it, 0, _("City Production"), 1, -1, -1); city_built_iterate(pcity, pimprove) { if (pimprove->sabotage > 0) { gtk_list_store_append(store, &it); gtk_list_store_set(store, &it, 0, city_improvement_name_translation(pcity, pimprove), 1, improvement_number(pimprove), -1); } } city_built_iterate_end; gtk_list_store_append(store, &it); { struct astring str = ASTRING_INIT; /* TRANS: %s is a unit name, e.g., Spy */ astr_set(&str, _("At %s's Discretion"), unit_name_translation(game_unit_by_number(diplomat_id))); gtk_list_store_set(store, &it, 0, astr_str(&str), 1, B_LAST, -1); astr_free(&str); } gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_sabotage_shell), GTK_RESPONSE_ACCEPT, FALSE); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(spy_sabotage_shell))); g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), "changed", G_CALLBACK(spy_improvements_callback), NULL); g_signal_connect(spy_sabotage_shell, "response", G_CALLBACK(spy_improvements_response), NULL); sabotage_improvement = -2; gtk_tree_view_focus(GTK_TREE_VIEW(view)); }
/************************************************************************** Creates a new dialog. It will be a tab or a window depending on the current user setting of 'gui_gtk3_enable_tabs'. Sets pdlg to point to the dialog once it is create, Zeroes pdlg on dialog destruction. user_data will be passed through response function check_top indicates if the layout deision should depend on the parent. **************************************************************************/ void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top) { struct gui_dialog *dlg; GtkWidget *vbox, *action_area; static int dialog_id_counter; dlg = fc_malloc(sizeof(*dlg)); dialog_list = g_list_prepend(dialog_list, dlg); dlg->source = pdlg; *pdlg = dlg; dlg->user_data = user_data; dlg->title = NULL; dlg->default_width = 200; dlg->default_height = 300; if (gui_gtk3_enable_tabs) { dlg->type = GUI_DIALOG_TAB; } else { dlg->type = GUI_DIALOG_WINDOW; } if (!gui_action) { gui_action = gtk_size_group_new(GTK_SIZE_GROUP_VERTICAL); } dlg->gui_button = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); vbox = gtk_grid_new(); action_area = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(action_area), 4); gtk_grid_set_column_spacing(GTK_GRID(action_area), 4); if (gui_gtk3_enable_tabs && (check_top && notebook != GTK_NOTEBOOK(top_notebook)) && !gui_gtk3_small_display_layout) { /* We expect this to be short (as opposed to tall); maximise usable * height by putting buttons down the right hand side */ gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_VERTICAL); } else { /* We expect this to be reasonably tall; maximise usable width by * putting buttons along the bottom */ gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL); } gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(vbox), action_area); gtk_widget_show(action_area); gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); gtk_container_set_border_width(GTK_CONTAINER(action_area), 2); switch (dlg->type) { case GUI_DIALOG_WINDOW: { GtkWidget *window; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_name(window, "Freeciv"); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE); setup_dialog(window, toplevel); gtk_container_add(GTK_CONTAINER(window), vbox); dlg->v.window = window; g_signal_connect(window, "delete_event", G_CALLBACK(gui_dialog_delete_handler), dlg); } break; case GUI_DIALOG_TAB: { GtkWidget *hbox, *label, *image, *button, *event_box; gint w, h; gchar *buf; gtk_icon_size_lookup_for_settings( gtk_settings_get_for_screen(gtk_widget_get_screen(vbox)), GTK_ICON_SIZE_MENU, &w, &h); hbox = gtk_grid_new(); label = gtk_label_new(NULL); gtk_widget_set_halign(label, GTK_ALIGN_START); gtk_widget_set_valign(label, GTK_ALIGN_CENTER); gtk_widget_set_margin_left(label, 4); gtk_widget_set_margin_right(label, 4); gtk_widget_set_margin_top(label, 0); gtk_widget_set_margin_bottom(label, 0); gtk_container_add(GTK_CONTAINER(hbox), label); button = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); g_signal_connect_swapped(button, "clicked", G_CALLBACK(gui_dialog_delete_tab_handler), dlg); buf = g_strdup_printf(_("Close Tab:\n%s"), _("Ctrl+W")); gtk_widget_set_tooltip_text(button, buf); g_free(buf); image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_widget_set_margin_left(image, 0); gtk_widget_set_margin_right(image, 0); gtk_widget_set_margin_top(image, 0); gtk_widget_set_margin_bottom(image, 0); gtk_button_set_image(GTK_BUTTON(button), image); gtk_container_add(GTK_CONTAINER(hbox), button); gtk_widget_show_all(hbox); event_box = gtk_event_box_new(); gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE); gtk_container_add(GTK_CONTAINER(event_box), hbox); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, event_box); dlg->v.tab.handler_id = g_signal_connect(notebook, "switch-page", G_CALLBACK(gui_dialog_switch_page_handler), dlg); dlg->v.tab.child = vbox; dlg->v.tab.label = label; dlg->v.tab.notebook = GTK_WIDGET(notebook); gtk_widget_add_events(event_box, GDK_BUTTON2_MOTION_MASK); g_signal_connect(event_box, "button-press-event", G_CALLBACK(click_on_tab_callback), dlg); } break; } dlg->vbox = vbox; dlg->action_area = action_area; dlg->response_callback = gui_dialog_destroyed; dlg->id = dialog_id_counter; dialog_id_counter++; dlg->return_dialog_id = -1; g_signal_connect(vbox, "destroy", G_CALLBACK(gui_dialog_destroy_handler), dlg); g_signal_connect(vbox, "key_press_event", G_CALLBACK(gui_dialog_key_press_handler), dlg); g_object_set_data(G_OBJECT(vbox), "gui-dialog-data", dlg); }
int main (int argc, char **argv) { GnomeProgram *program; GConfClient *client; GladeXML *dialog; GtkWidget *dialog_win, *w; GOptionContext *context; gchar *start_page = NULL; GOptionEntry cap_options[] = { {"show-page", 'p', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &start_page, /* TRANSLATORS: don't translate the terms in brackets */ N_("Specify the name of the page to show (general|accessibility)"), N_("page") }, {NULL} }; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (_("- GNOME Mouse Preferences")); g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE); program = gnome_program_init ("gnome-mouse-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_GOPTION_CONTEXT, context, GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, NULL); capplet_init_stock_icons (); activate_settings_daemon (); client = gconf_client_get_default (); gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); dialog = create_dialog (); if (dialog) { setup_dialog (dialog, NULL); setup_accessibility (dialog, client); dialog_win = WID ("mouse_properties_dialog"); g_signal_connect (dialog_win, "response", G_CALLBACK (dialog_response_cb), NULL); if (start_page != NULL) { gchar *page_name; page_name = g_strconcat (start_page, "_vbox", NULL); g_free (start_page); w = WID (page_name); if (w != NULL) { GtkNotebook *nb; gint pindex; nb = GTK_NOTEBOOK (WID ("prefs_widget")); pindex = gtk_notebook_page_num (nb, w); if (pindex != -1) gtk_notebook_set_current_page (nb, pindex); } g_free (page_name); } capplet_set_icon (dialog_win, "gnome-dev-mouse-optical"); gtk_widget_show (dialog_win); gtk_main (); g_object_unref (dialog); } g_object_unref (client); g_object_unref (program); return 0; }