int start_main_update(GtkWidget *button, gpointer single_or_all) { extern sem_t *update_semaphore, *update_all_semaphore; gtk_widget_set_sensitive(begin_button, FALSE); /* gtk_widget_set_sensitive(close_button, FALSE);*/ gtk_window_set_modal(GTK_WINDOW(upload_window), TRUE); gtk_widget_hide(close_button); gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (upload_window), "Stop!", GNOME_STOCK_PIXMAP_STOP); kill_button = g_list_last (GNOME_DIALOG (upload_window)->buttons)->data; gtk_signal_connect (GTK_OBJECT(kill_button), "clicked", GTK_SIGNAL_FUNC(abort_site_update), NULL); gtk_widget_show(kill_button); if (strcmp((gchar *)single_or_all, "single") == 0) { printf("updating single site.\n"); sem_post(update_semaphore); } else if (strcmp((gchar *)single_or_all, "all") == 0) { printf("Updating ALL sites that need it.\n"); sem_post(update_all_semaphore); } else { g_assert_not_reached(); } return 1; }
void capture_filter() { GtkWidget *dialog; GtkWidget *_hbox, *filter_label, *filter_entry, *filter_button; dialog = gnome_dialog_new(_("FilterString"),_("OK"),NULL,NULL); _hbox = gtk_hbox_new(FALSE,0); gtk_container_set_border_width(GTK_CONTAINER(_hbox), 5); filter_label = gtk_label_new("Filter String: "); filter_entry = gtk_entry_new(); filter_button = gtk_button_new_with_label("Save"); gtk_box_pack_start(GTK_BOX(_hbox),filter_label,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(_hbox),filter_entry,TRUE,TRUE,6); gtk_box_pack_start(GTK_BOX(_hbox),filter_button,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),_hbox,TRUE,TRUE,0); g_signal_connect(GTK_OBJECT(filter_button),"clicked",GTK_SIGNAL_FUNC(get_filter_str),filter_entry); gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); gtk_widget_show(filter_label); gtk_widget_show(filter_entry); gtk_widget_show(filter_button); gtk_widget_show(_hbox); gtk_widget_show(dialog); gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app)); }
void ifselect(GtkWidget *widget,gpointer data) { gint i = 0; GtkWidget *dialog; GtkWidget *_hbox; GtkWidget *label; GList *glist=NULL; GtkWidget *ifCombo; dialog = gnome_dialog_new(_("Choose a interface to capture"),_("OK"),NULL,NULL); _hbox = gtk_hbox_new(FALSE,0); label = gtk_label_new("Choose an interface: "); ifCombo = gtk_combo_new(); for (i = 0; i < ifnum; i++) { glist = g_list_append(glist, ifitem[i].ifname); } gtk_combo_set_popdown_strings( GTK_COMBO(ifCombo), glist); gtk_box_pack_start(GTK_BOX(_hbox),label,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(_hbox),ifCombo,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),_hbox,TRUE,TRUE,0); gtk_signal_connect(GTK_OBJECT(GTK_COMBO(ifCombo)->entry), "activate", GTK_SIGNAL_FUNC (get_ifcard_str),NULL); gtk_widget_show(ifCombo); gtk_widget_show(label); gtk_widget_show(_hbox); gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); gtk_widget_show(dialog); gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app)); }
void about() { GtkWidget *dialog; GtkWidget *contentlabel,*versionlabel,*authorlabel,*copyrightlabel; dialog = gnome_dialog_new(_("About the program"),_("OK"),NULL,NULL); contentlabel = gtk_label_new(_("Linux sniffer")); copyrightlabel = gtk_label_new(_("Copyright 2011-10-06")); authorlabel = gtk_label_new(_("付乔宾")); versionlabel = gtk_label_new(_("Version:1.0")); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),contentlabel,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),versionlabel,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),copyrightlabel,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),authorlabel,TRUE,TRUE,0); gtk_widget_show(contentlabel); gtk_widget_show(versionlabel); gtk_widget_show(copyrightlabel); gtk_widget_show(authorlabel); gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); gtk_widget_show(dialog); gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app)); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_message_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GtkWidget *pixmap, *label; gchar *label_text; gint type_index; get_message_box_widgets (widget, &pixmap, &label); g_return_if_fail (pixmap != NULL); g_return_if_fail (label != NULL); type_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), MessageBoxType)); gb_widget_output_choice (data, MessageBoxType, type_index, GbMessageBoxTypeSymbols[type_index]); gtk_label_get (GTK_LABEL (label), &label_text); gb_widget_output_translatable_text (data, Message, label_text); gb_window_get_standard_properties (widget, data, Title, NULL, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass); gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes); gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide); }
GnomeDialog * gnocam_camera_selector_new (void) { GnoCamCameraSelector *selector; const gchar *buttons[] = {GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL}; GtkWidget *hbox, *pixmap, *vbox, *widget, *label; Bonobo_PropertyBag pb; CORBA_Environment ev; selector = gtk_type_new (GNOCAM_TYPE_CAMERA_SELECTOR); gnome_dialog_constructv (GNOME_DIALOG (selector), _("Select a Camera"), buttons); gnome_dialog_set_default (GNOME_DIALOG (selector), 0); gtk_window_set_policy (GTK_WINDOW (selector), TRUE, TRUE, TRUE); gtk_widget_set_usize (GTK_WIDGET (selector), 400, 300); hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (hbox); gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (selector)->vbox), hbox); vbox = gtk_vbox_new (FALSE, 10); gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); /* The camera picture */ pixmap = gnome_pixmap_new_from_file (IMAGEDIR "/gnocam.png"); gtk_widget_show (pixmap); gtk_box_pack_start (GTK_BOX (vbox), pixmap, FALSE, FALSE, 0); /* The "Autodetect" check button */ CORBA_exception_init (&ev); pb = bonobo_get_object ("config:/apps/" PACKAGE, "Bonobo/PropertyBag", &ev); if (BONOBO_EX (&ev)) { g_warning ("Could not get property bag: %s", bonobo_exception_get_text (&ev)); } else { GtkObject *ed; ed = bonobo_peditor_new (pb, "autodetect", TC_boolean, NULL); bonobo_object_release_unref (pb, NULL); widget = bonobo_peditor_get_widget (BONOBO_PEDITOR (ed)); gtk_widget_show (widget); gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0); label = gtk_label_new (_("Autodetect")); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (widget), label); } CORBA_exception_free (&ev); /* The camera list */ selector->priv->table = gnocam_capplet_table_scrolled_new (NULL); gtk_widget_show (selector->priv->table); gtk_box_pack_start (GTK_BOX (hbox), selector->priv->table, TRUE, TRUE, 0); return (GNOME_DIALOG (selector)); }
GtkWidget* ghack_init_menu_window (void) { GtkWidget *menuWin = NULL; GtkWidget *parent = ghack_get_main_window (); menuWin = gnome_dialog_new("GnomeHack", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); gnome_dialog_set_default( GNOME_DIALOG(menuWin), 0); gtk_signal_connect(GTK_OBJECT(menuWin), "destroy", GTK_SIGNAL_FUNC(ghack_menu_destroy), NULL); gtk_signal_connect (GTK_OBJECT (menuWin), "delete_event", GTK_SIGNAL_FUNC (ghack_menu_hide), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_clear", GTK_SIGNAL_FUNC(ghack_menu_window_clear), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_display", GTK_SIGNAL_FUNC(ghack_menu_window_display), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_start_menu", GTK_SIGNAL_FUNC(ghack_menu_window_start_menu), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_add_menu", GTK_SIGNAL_FUNC(ghack_menu_window_add_menu), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_end_menu", GTK_SIGNAL_FUNC(ghack_menu_window_end_menu), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_select_menu", GTK_SIGNAL_FUNC(ghack_menu_window_select_menu), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_putstr", GTK_SIGNAL_FUNC(ghack_menu_window_put_string), NULL); gtk_signal_connect(GTK_OBJECT(menuWin), "key_press_event", GTK_SIGNAL_FUNC(ghack_menu_window_key), NULL); /* Center the dialog over parent */ g_assert (parent != NULL); g_assert (menuWin != NULL); g_assert (GTK_IS_WINDOW (parent)); g_assert (GNOME_IS_DIALOG (menuWin)); gnome_dialog_set_parent (GNOME_DIALOG (menuWin), GTK_WINDOW (parent)); return menuWin; }
static void game_preferences_callback (GtkWidget *widget, void *data) { GtkWidget *menu, *omenu, *l, *hb, *cb, *f, *fv; GtkWidget *button; if (pref_dialog) return; pref_dialog = gnome_dialog_new (_("Preferences"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); gnome_dialog_set_parent (GNOME_DIALOG (pref_dialog), GTK_WINDOW (app)); gtk_signal_connect (GTK_OBJECT(pref_dialog), "delete_event", GTK_SIGNAL_FUNC (cancel), NULL); omenu = gtk_option_menu_new (); menu = gtk_menu_new (); fill_menu (menu); gtk_widget_show (omenu); gtk_option_menu_set_menu (GTK_OPTION_MENU(omenu), menu); f = gtk_frame_new (_ ("Scenario")); gtk_container_border_width (GTK_CONTAINER (f), 5); hb = gtk_hbox_new (FALSE, FALSE); gtk_widget_show (hb); l = gtk_label_new (_("Select scenario:")); gtk_widget_show (l); gtk_box_pack_start_defaults (GTK_BOX(hb), l); gtk_box_pack_start_defaults (GTK_BOX(hb), omenu); cb = gtk_check_button_new_with_label ( _("Make it the default scenario") ); gtk_signal_connect (GTK_OBJECT(cb), "clicked", (GtkSignalFunc)set_selection_def, NULL); gtk_widget_show (cb); fv = gtk_vbox_new (0, 5); gtk_container_border_width (GTK_CONTAINER (fv), 5); gtk_widget_show (fv); gtk_box_pack_start_defaults (GTK_BOX(fv), hb); gtk_box_pack_start_defaults (GTK_BOX(fv), cb); gtk_box_pack_start_defaults (GTK_BOX(GNOME_DIALOG(pref_dialog)->vbox), f); gtk_container_add (GTK_CONTAINER (f), fv); gtk_widget_show (f); gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 0, GTK_SIGNAL_FUNC (load_scenario_callback), NULL); gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 1, GTK_SIGNAL_FUNC (cancel), (gpointer)1); gtk_widget_show (pref_dialog); }
static gboolean gui_ask_password (Account *account) { GtkWidget *table; GtkWidget *label; GtkWidget *vbox; char *buf; password_go = FALSE; password_gbool = TRUE; password_window = gnome_dialog_new (_("Incorrect Password"), GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); vbox = GNOME_DIALOG (password_window)->vbox; buf = g_strdup_printf (_("The password of the account %s is wrong"), account->acc_name); label = gtk_label_new (buf); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); c2_free (buf); table = gtk_table_new (2, 2, FALSE); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_widget_show (table); label = gtk_label_new (_("Username:"******"Password:"******"Y"); gnome_dialog_button_connect (GNOME_DIALOG (password_window), 1, GTK_SIGNAL_FUNC (password_cb), (gpointer) "N"); gdk_threads_leave (); while (!password_go) usleep (500); if (!password_gbool) return FALSE; buf = gtk_entry_get_text (GTK_ENTRY (password_entry)); gdk_threads_enter (); if (!buf) return FALSE; c2_free (account->protocol.pop.pass); account->protocol.pop.pass = g_strdup (buf); gtk_widget_destroy (password_window); return TRUE; }
static GtkWidget * gb_gnome_dialog_get_child (GtkWidget * widget, const gchar * child_name) { if (!strcmp (child_name, GladeChildDialogVBox)) return GNOME_DIALOG (widget)->vbox; else if (!strcmp (child_name, GladeChildDialogActionArea)) return GNOME_DIALOG (widget)->action_area; else return NULL; }
static GtkWidget * request_dialog (const gchar * request, const gchar * default_text, const guint16 max_length, GnomeStringCallback callback, gpointer data, gboolean password, GtkWindow * parent) { GtkWidget * mbox; callback_info * info; GtkWidget * entry; mbox = gnome_message_box_new ( request, GNOME_MESSAGE_BOX_QUESTION, GNOME_STOCK_BUTTON_CANCEL, GNOME_STOCK_BUTTON_OK, NULL ); gnome_dialog_set_default ( GNOME_DIALOG(mbox), 1 ); /* set up text entry widget */ entry = gtk_entry_new(); if (password) gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE); if ((default_text != NULL) && (*default_text)) gtk_entry_set_text(GTK_ENTRY(entry), default_text); if (max_length > 0) gtk_entry_set_max_length(GTK_ENTRY(entry), max_length); gtk_box_pack_end ( GTK_BOX(GNOME_DIALOG(mbox)->vbox), entry, FALSE, FALSE, GNOME_PAD_SMALL ); /* If Return is pressed in the text entry, propagate to the buttons */ gnome_dialog_editable_enters(GNOME_DIALOG(mbox), GTK_EDITABLE(entry)); info = g_new(callback_info, 1); info->function = callback; info->data = data; info->entry = GTK_ENTRY(entry); g_signal_connect_data (mbox, "clicked", G_CALLBACK (dialog_string_callback), info, (GClosureNotify) g_free, 0); if (parent != NULL) { gnome_dialog_set_parent(GNOME_DIALOG(mbox),parent); } gtk_widget_grab_focus (entry); gtk_widget_show (entry); gtk_widget_show (mbox); return mbox; }
void ghack_menu_window_display(GtkWidget *menuWin, gboolean blocking, gpointer data) { //if(blocking) { gnome_dialog_close_hides (GNOME_DIALOG (menuWin), TRUE); gnome_dialog_set_close (GNOME_DIALOG (menuWin), TRUE); gnome_dialog_run_and_close(GNOME_DIALOG (menuWin)); //} //else { //gtk_widget_show(menuWin); //} }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_dialog_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_window_get_standard_properties (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, IconName, FocusOnMap, Resizable, DestroyWithParent, Icon, Role, TypeHint, SkipTaskbar, SkipPager, Decorated, Gravity, Urgency); gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes); gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide); }
/* This tries to find the pixmap and label in the message box. */ static void get_message_box_widgets (GtkWidget *dialog, GtkWidget **pixmap, GtkWidget **label) { GtkWidget *vbox, *hbox; GtkBoxChild *child; GList *elem; *pixmap = NULL; *label = NULL; vbox = GNOME_DIALOG (dialog)->vbox; if (!vbox || !GTK_IS_VBOX (vbox)) return; elem = GTK_BOX (vbox)->children; child = (GtkBoxChild*)elem->data; if (!child || !GTK_IS_HBOX (child->widget)) return; hbox = child->widget; elem = GTK_BOX (hbox)->children; while (elem) { child = (GtkBoxChild*)elem->data; if (GTK_IS_LABEL (child->widget)) *label = child->widget; if (GNOME_IS_PIXMAP (child->widget)) *pixmap = child->widget; elem = elem->next; } }
void calendar_config_check_timezone_set (void) { ETimezoneDialog *timezone_dialog; GtkWidget *dialog; GList *elem; char *zone; zone = calendar_config_get_timezone (); if (zone && zone[0]) return; /* Show timezone dialog. */ timezone_dialog = e_timezone_dialog_new (); dialog = e_timezone_dialog_get_toplevel (timezone_dialog); /* Hide the cancel button, which is the 2nd button. */ elem = g_list_nth (GNOME_DIALOG (dialog)->buttons, 1); gtk_widget_hide (elem->data); g_signal_connect (dialog, "clicked", G_CALLBACK (on_timezone_set), timezone_dialog); g_signal_connect (dialog, "delete-event", G_CALLBACK (on_timezone_dialog_delete_event), timezone_dialog); gtk_widget_show (dialog); }
GtkWidget * c2_dialog_new (C2Application *application, const gchar *title, const gchar *type, const gchar *icon, ...) { C2Dialog *dialog; va_list args; dialog = gtk_type_new (c2_dialog_get_type ()); va_start (args, icon); gnome_dialog_construct (GNOME_DIALOG (dialog), title, args); va_end (args); dialog->application = application; gtk_object_set_data (GTK_OBJECT (dialog), "type", g_strdup (type)); if (icon) { gtk_object_set_data (GTK_OBJECT (dialog), "icon", g_strdup (icon)); #ifdef USE_GNOME_WINDOW_ICON gnome_window_icon_set_from_file (GTK_WINDOW (dialog), icon); #endif } c2_application_window_add (application, GTK_WINDOW (dialog)); return GTK_WIDGET (dialog); }
void set_properties(ChartInstance *ci) { struct buysell_data *data=(struct buysell_data *)ci->instance_data; GnomePropertyBox *pbox; GladeXML *xxml; xxml=glade_xml_new(BUYSELLGLADE_FILE,"BuySellPropertyBox"); glade_xml_signal_autoconnect(xxml); pbox=(GnomePropertyBox *)glade_xml_get_widget(xxml,"BuySellPropertyBox"); bs_cpick=(GnomeColorPicker *)glade_xml_get_widget(xxml,"BuySellColor"); bs_pricespin=(GtkSpinButton *)glade_xml_get_widget(xxml,"BuySellPrice"); bs_numstocks=(GtkSpinButton *)glade_xml_get_widget(xxml,"NumStocks"); bs_date=(GnomeDateEdit *)glade_xml_get_widget(xxml,"Date"); bs_buybotton=(GtkWidget *)glade_xml_get_widget(xxml,"BuyButton"); bs_sellbutton=(GtkWidget *)glade_xml_get_widget(xxml,"SellButton"); //Hack away the "apply" button gtk_widget_hide(GNOME_PROPERTY_BOX(pbox)->apply_button); gnome_property_box_changed(pbox); //Necessary, or the callback won't be called gnome_color_picker_set_i8(bs_cpick,data->r,data->g,data->b,data->a); gtk_spin_button_set_value(bs_pricespin,data->price); gtk_spin_button_set_value(bs_numstocks,data->amount); gnome_date_edit_set_time(bs_date,data->time); if (data->buy) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_buybotton),TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_sellbutton),TRUE); bs_global_ci=ci; gnome_dialog_run(GNOME_DIALOG(pbox)); }
void ghack_save_game_cb(GtkWidget *widget, gpointer data) { GtkWidget *box; box = gnome_message_box_new(_("Quit and save the current game?"), GNOME_MESSAGE_BOX_QUESTION, GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); gnome_dialog_set_default( GNOME_DIALOG(box), 1); gnome_dialog_set_parent (GNOME_DIALOG (box), GTK_WINDOW (ghack_get_main_window ()) ); gnome_dialog_set_accelerator (GNOME_DIALOG(box), 1, 'n', 0); gnome_dialog_set_accelerator (GNOME_DIALOG(box), 0, 'y', 0); gtk_window_set_modal( GTK_WINDOW(box), TRUE); gtk_signal_connect( GTK_OBJECT(box), "clicked", (GtkSignalFunc)ghack_save_game, NULL); gtk_widget_show(box); }
/* * Creates a new GtkWidget of class GnomeMessageBox, performing any specialized * initialization needed for the widget to work correctly in this environment. * If a dialog box is used to initialize the widget, return NULL from this * function, and call data->callback with your new widget when it is done. * If the widget needs a special destroy handler, add a signal here. */ static GtkWidget* gb_gnome_message_box_new (GbWidgetNewData *data) { GtkWidget *new_widget; GList *elem; if (data->action == GB_CREATING) { /* When creating a new dialog, we add a few standard buttons, which the user can change/delete easily. */ new_widget = gnome_message_box_new ("", GNOME_MESSAGE_BOX_INFO, GNOME_STOCK_BUTTON_OK, NULL); /* Now turn the buttons into GbWidgets so the user can edit them. */ elem = GNOME_DIALOG (new_widget)->buttons; gb_widget_create_from (GTK_WIDGET (elem->data), "button"); gtk_object_set_data (GTK_OBJECT (elem->data), "GtkButton::stock_button", GINT_TO_POINTER (GladeStockButtonOK)); } else { /* FIXME: We create it with an OK button, and then remove the button, to work around a bug in gnome_message_box_new() - it tries to set the keyboard focus to the last button, which may not exist. It also ensures that gnome_dialog_init_action_area() has been called. */ new_widget = gnome_message_box_new ("", GNOME_MESSAGE_BOX_INFO, GNOME_STOCK_BUTTON_OK, NULL); gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (new_widget)->action_area), GNOME_DIALOG (new_widget)->buttons->data); GNOME_DIALOG (new_widget)->buttons = NULL; } gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox, data->action == GB_CREATING ? "dialog-vbox" : NULL); gb_widget_set_child_name (GNOME_DIALOG (new_widget)->vbox, DialogVBox); gb_widget_create_from (GNOME_DIALOG (new_widget)->action_area, data->action == GB_CREATING ? "dialog-action_area" : NULL); gb_widget_set_child_name (GNOME_DIALOG (new_widget)->action_area, DialogActionArea); /* We connect a close signal handler which always returns TRUE so that the built-in close functionality is skipped. */ gtk_signal_connect (GTK_OBJECT (new_widget), "close", GTK_SIGNAL_FUNC (gtk_true), NULL); /* Now we connect our normal delete_event handler. */ gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event", GTK_SIGNAL_FUNC (editor_close_window), NULL); return new_widget; }
static int game_quit_callback (GtkWidget *widget, void *data) { GtkWidget *box; box = gnome_message_box_new (_("Do you really want to quit?"), GNOME_MESSAGE_BOX_QUESTION, GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); gnome_dialog_set_parent (GNOME_DIALOG(box), GTK_WINDOW(app)); gnome_dialog_set_default (GNOME_DIALOG (box), 0); gtk_window_set_modal (GTK_WINDOW (box), TRUE); gtk_signal_connect (GTK_OBJECT (box), "clicked", (GtkSignalFunc)game_maybe_quit, NULL); gtk_widget_show (box); return TRUE; }
int error_dialog (char *message) { GtkWidget *dialog; int test; dialog = gnome_message_box_new (message, GNOME_MESSAGE_BOX_ERROR, GNOME_STOCK_BUTTON_CLOSE, NULL); test = gnome_dialog_run (GNOME_DIALOG (dialog)); return test; }
GtkWidget * c2_transfer_list_new (C2Application *application) { C2TransferList *tl; GtkWidget *button, *vbox; const gchar *buttons[] = { N_("Stop all"), GNOME_STOCK_BUTTON_CLOSE, NULL }; tl = gtk_type_new (c2_transfer_list_get_type ()); GTK_BOX (GNOME_DIALOG (tl)->vbox)->spacing = 0; vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (tl)->vbox), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); tl->vbox = vbox; button = gtk_check_button_new_with_label (_("Close when finished.")); gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, TRUE, 0); gtk_widget_show (button); tl->close = button; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), c2_preferences_get_widget_transfer_list_autoclose ()); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (on_close_button_toggled), NULL); c2_dialog_construct (C2_DIALOG (tl), application, _("Send & Receive"), C2_WIDGET_TRANSFER_LIST_TYPE, PKGDATADIR "/pixmaps/send-receive.png", buttons); gnome_dialog_button_connect (GNOME_DIALOG (tl), 0, on_button0_clicked, tl); gnome_dialog_button_connect (GNOME_DIALOG (tl), 1, on_button1_clicked, tl); gtk_signal_connect (GTK_OBJECT (tl), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); return GTK_WIDGET (tl); }
gint main ( gint argc, gchar* argv[] ) { GtkWidget * dialog; GtkWidget * T; ColorGroup *cg; gnome_program_init ("tester", "1.0", LIBGNOMEUI_MODULE, argc, argv, NULL); dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); cg = color_group_fetch ("fore_color_group", dialog); T = color_palette_new ("Color Palette", NULL, cg); gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), T, TRUE, TRUE, 5); gtk_widget_show_all (T); cg = color_group_fetch ("fore_color_group", dialog); T = color_combo_new ( gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), _("Automatic"), &e_black, cg); gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), T, TRUE, TRUE, 5); gtk_widget_show_all (T); cg = color_group_fetch ("back_color_group", dialog); T = color_combo_new ( gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), _("Automatic"), &e_black, cg); gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), T, TRUE, TRUE, 5); gtk_widget_show_all (T); gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) ); return 0; }
void find_compile_regex(GnomeFindDialog *find_dialog) { int cflags; int regex_result; char errbuf[ERRBUF_SIZE]; char messagebuf[MSGBUF_SIZE]; GtkWidget *message_dialog; if(find_params.regex == TRUE) { /* compile the regular expression */ cflags = REG_EXTENDED; if(find_params.case_sensitive == FALSE) { cflags = cflags | REG_ICASE; } preg = (regex_t *) g_malloc(sizeof(regex_t)); regex_result = regcomp(preg, find_params.find_text, cflags); if(regex_result != 0) { regerror(regex_result, preg, errbuf, ERRBUF_SIZE); g_snprintf(messagebuf, MSGBUF_SIZE, "Error compiling regular expression: %s", errbuf); message_dialog = gnome_message_box_new(messagebuf, GNOME_MESSAGE_BOX_ERROR, GNOME_STOCK_BUTTON_OK, NULL); if (find_dialog != NULL ) { gnome_dialog_set_parent(GNOME_DIALOG(message_dialog), GTK_WINDOW(find_dialog)); } else { gnome_dialog_set_parent(GNOME_DIALOG(message_dialog), GTK_WINDOW(R_gtk_main_window)); } gnome_dialog_run_and_close(GNOME_DIALOG(message_dialog)); return; } } }
int ghack_ask_string_dialog(const char *szMessageStr, const char *szDefaultStr, const char *szTitleStr, char *buffer) { int i; GtkWidget* dialog; gchar *user_text = NULL; dialog = gnome_request_dialog(FALSE, szMessageStr, szDefaultStr, 0, ghack_ask_string_callback, &user_text, NULL); g_assert(dialog != NULL); gtk_window_set_title(GTK_WINDOW(dialog), szTitleStr); gnome_dialog_set_default( GNOME_DIALOG(dialog), 0); gtk_window_set_modal( GTK_WINDOW(dialog), TRUE); gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (ghack_get_main_window ()) ); i = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); /* Quit */ if ( i != 0 || user_text == NULL ) { if (user_text) g_free(user_text); return -1; } if ( *user_text == 0 ) { g_free(user_text); return -1; } g_assert(strlen(user_text) > 0); strcpy (buffer, user_text); g_free(user_text); return 0; }
/* * Sets the properties of the widget. This is used for both applying the * properties changed in the property editor, and also for loading. */ static void gb_gnome_message_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data) { GtkWidget *pixmap, *label; gchar *message, *type_name; gboolean auto_close, hide_on_close; get_message_box_widgets (widget, &pixmap, &label); g_return_if_fail (pixmap != NULL); g_return_if_fail (label != NULL); type_name = gb_widget_input_choice (data, MessageBoxType); if (data->apply) { set_message_box_type (widget, pixmap, type_name); } message = gb_widget_input_text (data, Message); if (data->apply) { gtk_label_set_text (GTK_LABEL (label), message); } if (data->action == GB_APPLYING) g_free (message); gb_window_set_standard_properties (widget, data, Title, NULL, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass); auto_close = gb_widget_input_bool (data, AutoClose); if (data->apply) gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close); hide_on_close = gb_widget_input_bool (data, HideOnClose); if (data->apply) gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close); }
/* * Sets the properties of the widget. This is used for both applying the * properties changed in the property editor, and also for loading. */ static void gb_gnome_dialog_set_properties (GtkWidget * widget, GbWidgetSetArgData * data) { gboolean auto_close, hide_on_close; gb_window_set_standard_properties (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, IconName, FocusOnMap, Resizable, DestroyWithParent, Icon, Role, TypeHint, SkipTaskbar, SkipPager, Decorated, Gravity, Urgency); auto_close = gb_widget_input_bool (data, AutoClose); if (data->apply) gnome_dialog_set_close (GNOME_DIALOG (widget), auto_close); hide_on_close = gb_widget_input_bool (data, HideOnClose); if (data->apply) gnome_dialog_close_hides (GNOME_DIALOG (widget), hide_on_close); }
GtkWidget * plugin_fortune_configure (C2DynamicModule *module) { GtkWidget *hbox; GtkWidget *label; window = gnome_dialog_new ("Configuration", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); hbox = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); label = gtk_label_new ("Command:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); gtk_widget_show (entry); gtk_entry_set_text (GTK_ENTRY (entry), cmnd); label = gtk_label_new ("You can use the commands just like in the terminal.\n" "\n" "i.e. signature; cat $HOME/.signature"); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), label, TRUE, TRUE, 0); gtk_widget_show (label); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (on_plugin_fortune_configure_ok_btn_clicked), NULL); gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (on_plugin_fortune_configure_cancel_btn_clicked), NULL); gtk_widget_show (window); return window; }
void ghack_menu_window_start_menu (GtkWidget *menuWin, gpointer data) { GtkWidget *frame1, *swin, *clist; MenuWinType isMenu; g_assert (menuWin != NULL); g_assert (data == NULL); /* destroy existing menu data, if any */ frame1 = gtk_object_get_data (GTK_OBJECT (menuWin), "frame1"); if (frame1) gtk_widget_destroy (frame1); isMenu = MenuMenu; gtk_object_set_data (GTK_OBJECT (menuWin), "isMenu", GINT_TO_POINTER (isMenu)); gtk_widget_set_usize (GTK_WIDGET (menuWin), 500, 400); gtk_window_set_policy (GTK_WINDOW (menuWin), TRUE, TRUE, FALSE); frame1 = gtk_frame_new ("Make your selection"); g_assert (frame1 != NULL); gtk_object_set_data (GTK_OBJECT(menuWin), "frame1", frame1); gtk_widget_show (GTK_WIDGET (frame1)); gtk_container_set_border_width (GTK_CONTAINER (frame1), 5); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG(menuWin)->vbox), frame1, TRUE, TRUE, 0); swin = gtk_scrolled_window_new (NULL, NULL); g_assert (swin != NULL); gtk_object_set_data (GTK_OBJECT(menuWin), "swin", swin); gtk_widget_show (GTK_WIDGET (swin)); gtk_container_add (GTK_CONTAINER (frame1), swin); clist = gtk_clist_new (4); g_assert (clist != NULL); gtk_object_set_data (GTK_OBJECT(menuWin), "clist", clist); gtk_widget_show (GTK_WIDGET (clist)); gtk_container_add (GTK_CONTAINER (swin), clist); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_signal_connect (GTK_OBJECT (clist), "select_row", GTK_SIGNAL_FUNC (ghack_menu_row_selected), NULL); gtk_object_set_data (GTK_OBJECT (clist), "numItems", GINT_TO_POINTER (-1)); }
static GtkWidget * show_ok_box(const gchar * message, const gchar * type, GtkWindow * parent) { GtkWidget * mbox; mbox = gnome_message_box_new (message, type, GNOME_STOCK_BUTTON_OK, NULL); if (parent != NULL) { gnome_dialog_set_parent(GNOME_DIALOG(mbox),parent); } gtk_widget_show (mbox); return mbox; }