GtkWidget *create_hdhomerun_config(void) { GtkWidget *hdhomerun_config; GtkWidget *hbox1; GtkWidget *frame1; GtkWidget *vbox2; GtkWidget *scrolledwindow1; GtkWidget *DeviceListTree; GtkWidget *RescanBtn; GtkWidget *label1; GtkWidget *Tab; GtkWidget *vbox1; GtkWidget *frame2; GtkWidget *table2; GtkWidget *label11; GtkWidget *label12; GtkWidget *label13; GtkWidget *LaunchVlcBtn; GtkWidget *StopVlcBtn; GtkWidget *hbox2; GtkWidget *ChannelMapEdit; GtkObject *ChannelNumberSpin_adj; GtkWidget *ChannelNumberSpin; GtkWidget *ProgramList; GtkWidget *ScanDownBtn; GtkWidget *ScanUpBtn; GtkWidget *label15; GtkWidget *frame3; GtkWidget *table1; GtkWidget *label5; GtkWidget *label6; GtkWidget *label7; GtkWidget *label8; GtkWidget *SignalStrengthStatus; GtkWidget *SignalQualityStatus; GtkWidget *SymbolQualityStatus; GtkWidget *PhysicalChannelStatus; GtkWidget *label10; GtkWidget *NetworkRateStatus; GtkWidget *label4; GtkWidget *label2; GtkWidget *vbox3; GtkWidget *frame4; GtkWidget *table3; GtkWidget *FirmwareVersion; GtkWidget *UpgradeBtn; GtkWidget *hbox3; GtkWidget *UpgradeFilename; GtkWidget *UpgradeFilenameBtn; GtkWidget *label14; GtkWidget *label3; hdhomerun_config = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(hdhomerun_config), _("HDHomeRun Config")); gtk_window_set_resizable(GTK_WINDOW(hdhomerun_config), FALSE); hbox1 = gtk_hbox_new(FALSE, 6); gtk_widget_show(hbox1); gtk_container_add(GTK_CONTAINER(hdhomerun_config), hbox1); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 3); frame1 = gtk_frame_new(NULL); gtk_widget_show(frame1); gtk_box_pack_start(GTK_BOX(hbox1), frame1, TRUE, TRUE, 0); vbox2 = gtk_vbox_new(FALSE, 3); gtk_widget_show(vbox2); gtk_container_add(GTK_CONTAINER(frame1), vbox2); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 3); scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow1); gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindow1, TRUE, TRUE, 0); DeviceListTree = gtk_tree_view_new(); gtk_widget_show(DeviceListTree); gtk_container_add(GTK_CONTAINER(scrolledwindow1), DeviceListTree); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(DeviceListTree), FALSE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(DeviceListTree), FALSE); RescanBtn = gtk_button_new_with_mnemonic(_("_Rescan")); gtk_widget_show(RescanBtn); gtk_box_pack_start(GTK_BOX(vbox2), RescanBtn, FALSE, FALSE, 0); label1 = gtk_label_new(_("Device")); gtk_widget_show(label1); gtk_frame_set_label_widget(GTK_FRAME(frame1), label1); gtk_label_set_use_markup(GTK_LABEL(label1), TRUE); gtk_misc_set_padding(GTK_MISC(label1), 3, 0); Tab = gtk_notebook_new(); gtk_widget_show(Tab); gtk_box_pack_start(GTK_BOX(hbox1), Tab, TRUE, TRUE, 0); vbox1 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(Tab), vbox1); frame2 = gtk_frame_new(NULL); gtk_widget_show(frame2); gtk_box_pack_start(GTK_BOX(vbox1), frame2, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame2), 3); table2 = gtk_table_new(3, 4, TRUE); gtk_widget_show(table2); gtk_container_add(GTK_CONTAINER(frame2), table2); gtk_container_set_border_width(GTK_CONTAINER(table2), 6); gtk_table_set_row_spacings(GTK_TABLE(table2), 3); gtk_table_set_col_spacings(GTK_TABLE(table2), 3); label11 = gtk_label_new(_("Channel")); gtk_widget_show(label11); gtk_table_attach(GTK_TABLE(table2), label11, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label12 = gtk_label_new(_("Program")); gtk_widget_show(label12); gtk_table_attach(GTK_TABLE(table2), label12, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label13 = gtk_label_new(_("Scan")); gtk_widget_show(label13); gtk_table_attach(GTK_TABLE(table2), label13, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); LaunchVlcBtn = gtk_button_new_with_mnemonic(_("_View")); gtk_widget_show(LaunchVlcBtn); gtk_table_attach(GTK_TABLE(table2), LaunchVlcBtn, 3, 4, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); StopVlcBtn = gtk_button_new_with_mnemonic(_("_Stop")); gtk_widget_show(StopVlcBtn); gtk_table_attach(GTK_TABLE(table2), StopVlcBtn, 3, 4, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_widget_set_sensitive(StopVlcBtn, FALSE); hbox2 = gtk_hbox_new(FALSE, 3); gtk_widget_show(hbox2); gtk_table_attach(GTK_TABLE(table2), hbox2, 1, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); ChannelMapEdit = gtk_combo_box_new_text(); gtk_widget_show(ChannelMapEdit); gtk_box_pack_start(GTK_BOX(hbox2), ChannelMapEdit, TRUE, TRUE, 0); ChannelNumberSpin_adj = gtk_adjustment_new(0, 0, 300, 1, 10, 0); ChannelNumberSpin = gtk_spin_button_new(GTK_ADJUSTMENT(ChannelNumberSpin_adj), 1, 0); gtk_widget_show(ChannelNumberSpin); gtk_box_pack_start(GTK_BOX(hbox2), ChannelNumberSpin, FALSE, FALSE, 0); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ChannelNumberSpin), TRUE); gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(ChannelNumberSpin), TRUE); ProgramList = gtk_combo_box_new_text(); gtk_widget_show(ProgramList); gtk_table_attach(GTK_TABLE(table2), ProgramList, 1, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); ScanDownBtn = gtk_toggle_button_new_with_mnemonic("_<<-"); gtk_widget_show(ScanDownBtn); gtk_table_attach(GTK_TABLE(table2), ScanDownBtn, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); ScanUpBtn = gtk_toggle_button_new_with_mnemonic("->_>"); gtk_widget_show(ScanUpBtn); gtk_table_attach(GTK_TABLE(table2), ScanUpBtn, 2, 3, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label15 = gtk_label_new(_("Configuration")); gtk_widget_show(label15); gtk_frame_set_label_widget(GTK_FRAME(frame2), label15); gtk_label_set_use_markup(GTK_LABEL(label15), TRUE); gtk_misc_set_padding(GTK_MISC(label15), 3, 0); frame3 = gtk_frame_new(NULL); gtk_widget_show(frame3); gtk_box_pack_start(GTK_BOX(vbox1), frame3, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame3), 3); table1 = gtk_table_new(6, 2, FALSE); gtk_widget_show(table1); gtk_container_add(GTK_CONTAINER(frame3), table1); gtk_container_set_border_width(GTK_CONTAINER(table1), 6); gtk_table_set_row_spacings(GTK_TABLE(table1), 2); gtk_table_set_col_spacings(GTK_TABLE(table1), 2); label5 = gtk_label_new(_("Physical Channel")); gtk_widget_show(label5); gtk_table_attach(GTK_TABLE(table1), label5, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label6 = gtk_label_new(_("Signal Strength %")); gtk_widget_show(label6); gtk_table_attach(GTK_TABLE(table1), label6, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label7 = gtk_label_new(_("Signal Quality %")); gtk_widget_show(label7); gtk_table_attach(GTK_TABLE(table1), label7, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label8 = gtk_label_new(_("Symbol Quality %")); gtk_widget_show(label8); gtk_table_attach(GTK_TABLE(table1), label8, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); SignalStrengthStatus = gtk_progress_bar_new(); gtk_widget_show(SignalStrengthStatus); gtk_table_attach(GTK_TABLE(table1), SignalStrengthStatus, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); SignalQualityStatus = gtk_progress_bar_new(); gtk_widget_show(SignalQualityStatus); gtk_table_attach(GTK_TABLE(table1), SignalQualityStatus, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); SymbolQualityStatus = gtk_progress_bar_new(); gtk_widget_show(SymbolQualityStatus); gtk_table_attach(GTK_TABLE(table1), SymbolQualityStatus, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); PhysicalChannelStatus = gtk_entry_new(); gtk_widget_show(PhysicalChannelStatus); gtk_table_attach(GTK_TABLE(table1), PhysicalChannelStatus, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive(PhysicalChannelStatus, FALSE); GTK_WIDGET_UNSET_FLAGS(PhysicalChannelStatus, GTK_CAN_FOCUS); gtk_editable_set_editable(GTK_EDITABLE(PhysicalChannelStatus), FALSE); gtk_entry_set_text(GTK_ENTRY(PhysicalChannelStatus), _("none")); gtk_entry_set_invisible_char(GTK_ENTRY(PhysicalChannelStatus), 9679); label10 = gtk_label_new(_("Network Rate")); gtk_widget_show(label10); gtk_table_attach(GTK_TABLE(table1), label10, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); NetworkRateStatus = gtk_entry_new(); gtk_widget_show(NetworkRateStatus); gtk_table_attach(GTK_TABLE(table1), NetworkRateStatus, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive(NetworkRateStatus, FALSE); GTK_WIDGET_UNSET_FLAGS(NetworkRateStatus, GTK_CAN_FOCUS); gtk_editable_set_editable(GTK_EDITABLE(NetworkRateStatus), FALSE); gtk_entry_set_text(GTK_ENTRY(NetworkRateStatus), _("0.000 Mbps")); gtk_entry_set_invisible_char(GTK_ENTRY(NetworkRateStatus), 9679); label4 = gtk_label_new(_("Status")); gtk_widget_show(label4); gtk_frame_set_label_widget(GTK_FRAME(frame3), label4); gtk_label_set_use_markup(GTK_LABEL(label4), TRUE); gtk_misc_set_padding(GTK_MISC(label4), 3, 0); label2 = gtk_label_new(_("Tuner")); gtk_widget_show(label2); gtk_notebook_set_tab_label(GTK_NOTEBOOK(Tab), gtk_notebook_get_nth_page(GTK_NOTEBOOK(Tab), 0), label2); vbox3 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox3); gtk_container_add(GTK_CONTAINER(Tab), vbox3); frame4 = gtk_frame_new(NULL); gtk_widget_show(frame4); gtk_box_pack_start(GTK_BOX(vbox3), frame4, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame4), 3); table3 = gtk_table_new(2, 2, FALSE); gtk_widget_show(table3); gtk_container_add(GTK_CONTAINER(frame4), table3); gtk_container_set_border_width(GTK_CONTAINER(table3), 3); gtk_table_set_row_spacings(GTK_TABLE(table3), 3); gtk_table_set_col_spacings(GTK_TABLE(table3), 3); FirmwareVersion = gtk_label_new(""); gtk_widget_show(FirmwareVersion); gtk_table_attach(GTK_TABLE(table3), FirmwareVersion, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_misc_set_alignment(GTK_MISC(FirmwareVersion), 0, 0.5); UpgradeBtn = gtk_button_new_with_mnemonic(_("Upgrade")); gtk_widget_show(UpgradeBtn); gtk_table_attach(GTK_TABLE(table3), UpgradeBtn, 1, 2, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive(UpgradeBtn, FALSE); hbox3 = gtk_hbox_new(FALSE, 3); gtk_widget_show(hbox3); gtk_table_attach(GTK_TABLE(table3), hbox3, 0, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); UpgradeFilename = gtk_entry_new(); gtk_widget_show(UpgradeFilename); gtk_box_pack_start(GTK_BOX(hbox3), UpgradeFilename, TRUE, TRUE, 0); gtk_entry_set_invisible_char(GTK_ENTRY(UpgradeFilename), 9679); UpgradeFilenameBtn = gtk_button_new_with_mnemonic("..."); gtk_widget_show(UpgradeFilenameBtn); gtk_box_pack_start(GTK_BOX(hbox3), UpgradeFilenameBtn, FALSE, FALSE, 0); label14 = gtk_label_new(_("Upgrade")); gtk_widget_show(label14); gtk_frame_set_label_widget(GTK_FRAME(frame4), label14); gtk_misc_set_padding(GTK_MISC(label14), 3, 0); label3 = gtk_label_new(_("Upgrade")); gtk_widget_show(label3); gtk_notebook_set_tab_label(GTK_NOTEBOOK(Tab), gtk_notebook_get_nth_page(GTK_NOTEBOOK(Tab), 1), label3); g_signal_connect((gpointer) hdhomerun_config, "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect((gpointer) hdhomerun_config, "key_press_event", G_CALLBACK(on_hdhomerun_config_key_press_event), NULL); g_signal_connect((gpointer) RescanBtn, "clicked", G_CALLBACK(on_RescanBtn_clicked), NULL); g_signal_connect_after((gpointer) Tab, "switch_page", G_CALLBACK(on_Tab_switch_page), NULL); g_signal_connect((gpointer) LaunchVlcBtn, "clicked", G_CALLBACK(on_LaunchVlcBtn_clicked), NULL); g_signal_connect((gpointer) StopVlcBtn, "clicked", G_CALLBACK(on_StopVlcBtn_clicked), NULL); g_signal_connect((gpointer) ChannelMapEdit, "changed", G_CALLBACK(on_ChannelMapEdit_changed), NULL); g_signal_connect((gpointer) ChannelNumberSpin, "value_changed", G_CALLBACK(on_ChannelNumberSpin_value_changed), NULL); g_signal_connect_after((gpointer) ChannelNumberSpin, "activate", G_CALLBACK(on_ChannelNumberSpin_activate), NULL); g_signal_connect((gpointer) ProgramList, "changed", G_CALLBACK(on_ProgramList_changed), NULL); g_signal_connect((gpointer) ScanDownBtn, "clicked", G_CALLBACK(on_ScanDownBtn_clicked), NULL); g_signal_connect((gpointer) ScanUpBtn, "clicked", G_CALLBACK(on_ScanUpBtn_clicked), NULL); g_signal_connect((gpointer) UpgradeBtn, "clicked", G_CALLBACK(on_UpgradeBtn_clicked), NULL); g_signal_connect((gpointer) UpgradeFilename, "changed", G_CALLBACK(on_UpgradeFilename_changed), NULL); g_signal_connect((gpointer) UpgradeFilenameBtn, "clicked", G_CALLBACK(on_UpgradeFilenameBtn_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF(hdhomerun_config, hdhomerun_config, "hdhomerun_config"); GLADE_HOOKUP_OBJECT(hdhomerun_config, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, frame1, "frame1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, vbox2, "vbox2"); GLADE_HOOKUP_OBJECT(hdhomerun_config, scrolledwindow1, "scrolledwindow1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, DeviceListTree, "DeviceListTree"); GLADE_HOOKUP_OBJECT(hdhomerun_config, RescanBtn, "RescanBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label1, "label1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, Tab, "Tab"); GLADE_HOOKUP_OBJECT(hdhomerun_config, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, frame2, "frame2"); GLADE_HOOKUP_OBJECT(hdhomerun_config, table2, "table2"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label11, "label11"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label12, "label12"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label13, "label13"); GLADE_HOOKUP_OBJECT(hdhomerun_config, LaunchVlcBtn, "LaunchVlcBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, StopVlcBtn, "StopVlcBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT(hdhomerun_config, ChannelMapEdit, "ChannelMapEdit"); GLADE_HOOKUP_OBJECT(hdhomerun_config, ChannelNumberSpin, "ChannelNumberSpin"); GLADE_HOOKUP_OBJECT(hdhomerun_config, ProgramList, "ProgramList"); GLADE_HOOKUP_OBJECT(hdhomerun_config, ScanDownBtn, "ScanDownBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, ScanUpBtn, "ScanUpBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label15, "label15"); GLADE_HOOKUP_OBJECT(hdhomerun_config, frame3, "frame3"); GLADE_HOOKUP_OBJECT(hdhomerun_config, table1, "table1"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label5, "label5"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label6, "label6"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label7, "label7"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label8, "label8"); GLADE_HOOKUP_OBJECT(hdhomerun_config, SignalStrengthStatus, "SignalStrengthStatus"); GLADE_HOOKUP_OBJECT(hdhomerun_config, SignalQualityStatus, "SignalQualityStatus"); GLADE_HOOKUP_OBJECT(hdhomerun_config, SymbolQualityStatus, "SymbolQualityStatus"); GLADE_HOOKUP_OBJECT(hdhomerun_config, PhysicalChannelStatus, "PhysicalChannelStatus"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label10, "label10"); GLADE_HOOKUP_OBJECT(hdhomerun_config, NetworkRateStatus, "NetworkRateStatus"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label4, "label4"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label2, "label2"); GLADE_HOOKUP_OBJECT(hdhomerun_config, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT(hdhomerun_config, frame4, "frame4"); GLADE_HOOKUP_OBJECT(hdhomerun_config, table3, "table3"); GLADE_HOOKUP_OBJECT(hdhomerun_config, FirmwareVersion, "FirmwareVersion"); GLADE_HOOKUP_OBJECT(hdhomerun_config, UpgradeBtn, "UpgradeBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, hbox3, "hbox3"); GLADE_HOOKUP_OBJECT(hdhomerun_config, UpgradeFilename, "UpgradeFilename"); GLADE_HOOKUP_OBJECT(hdhomerun_config, UpgradeFilenameBtn, "UpgradeFilenameBtn"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label14, "label14"); GLADE_HOOKUP_OBJECT(hdhomerun_config, label3, "label3"); return hdhomerun_config; }
GtkWidget* create_window (void) { GtkWidget *window; GtkWidget *vboxMain; GtkWidget *statusBar; GtkWidget *hbox1; GtkWidget *imageUri; GtkWidget *btnOpen; GtkWidget *scrolledwindow; GtkWidget *imgViewport; GtkWidget *hbox2; GtkWidget *imageBox; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (window, "window"); gtk_container_set_border_width (GTK_CONTAINER (window), 2); gtk_window_set_title (GTK_WINDOW (window), _("BeautyOnline")); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 500, 400); gtk_window_set_icon_name (GTK_WINDOW (window), "stock_draw-sphere"); gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE); vboxMain = gtk_vbox_new (FALSE, 2); gtk_widget_set_name (vboxMain, "vboxMain"); gtk_widget_show (vboxMain); gtk_container_add (GTK_CONTAINER (window), vboxMain); gtk_container_set_border_width (GTK_CONTAINER (vboxMain), 1); statusBar = gtk_statusbar_new (); gtk_widget_set_name (statusBar, "statusBar"); gtk_widget_show (statusBar); gtk_box_pack_end (GTK_BOX (vboxMain), statusBar, FALSE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox1, "hbox1"); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vboxMain), hbox1, FALSE, TRUE, 0); imageUri = gtk_entry_new (); gtk_widget_set_name (imageUri, "imageUri"); gtk_widget_show (imageUri); gtk_box_pack_start (GTK_BOX (hbox1), imageUri, TRUE, TRUE, 0); gtk_entry_set_invisible_char (GTK_ENTRY (imageUri), 8226); btnOpen = gtk_button_new_with_mnemonic (_("Open")); gtk_widget_set_name (btnOpen, "btnOpen"); gtk_widget_show (btnOpen); gtk_box_pack_start (GTK_BOX (hbox1), btnOpen, FALSE, FALSE, 0); scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_name (scrolledwindow, "scrolledwindow"); gtk_widget_show (scrolledwindow); gtk_box_pack_end (GTK_BOX (vboxMain), scrolledwindow, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); imgViewport = gtk_viewport_new (NULL, NULL); gtk_widget_set_name (imgViewport, "imgViewport"); gtk_widget_show (imgViewport); gtk_container_add (GTK_CONTAINER (scrolledwindow), imgViewport); hbox2 = gtk_hbox_new (TRUE, 0); gtk_widget_set_name (hbox2, "hbox2"); gtk_widget_show (hbox2); gtk_container_add (GTK_CONTAINER (imgViewport), hbox2); imageBox = create_pixmap (window, NULL); gtk_widget_set_name (imageBox, "imageBox"); gtk_widget_show (imageBox); gtk_box_pack_start (GTK_BOX (hbox2), imageBox, TRUE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (imageBox), 0, 0); g_signal_connect_swapped ((gpointer) imageUri, "activate", G_CALLBACK (on_imageUri_activate), GTK_OBJECT (imageBox)); g_signal_connect_swapped ((gpointer) btnOpen, "clicked", G_CALLBACK (on_btnOpen_clicked), GTK_OBJECT (imageUri)); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (window, window, "window"); GLADE_HOOKUP_OBJECT (window, vboxMain, "vboxMain"); GLADE_HOOKUP_OBJECT (window, statusBar, "statusBar"); GLADE_HOOKUP_OBJECT (window, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (window, imageUri, "imageUri"); GLADE_HOOKUP_OBJECT (window, btnOpen, "btnOpen"); GLADE_HOOKUP_OBJECT (window, scrolledwindow, "scrolledwindow"); GLADE_HOOKUP_OBJECT (window, imgViewport, "imgViewport"); GLADE_HOOKUP_OBJECT (window, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT (window, imageBox, "imageBox"); return window; }
static void gimp_curves_tool_dialog (GimpImageMapTool *im_tool) { GimpCurvesTool *tool = GIMP_CURVES_TOOL (im_tool); GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (im_tool); GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config); GtkListStore *store; GtkWidget *main_vbox; GtkWidget *frame_vbox; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *hbox2; GtkWidget *label; GtkWidget *main_frame; GtkWidget *frame; GtkWidget *table; GtkWidget *button; GtkWidget *bar; GtkWidget *combo; g_signal_connect (im_tool->settings_box, "file-dialog-setup", G_CALLBACK (gimp_curves_tool_export_setup), im_tool); main_vbox = gimp_image_map_tool_dialog_get_vbox (im_tool); /* The combo box for selecting channels */ main_frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (main_vbox), main_frame, TRUE, TRUE, 0); gtk_widget_show (main_frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_frame_set_label_widget (GTK_FRAME (main_frame), hbox); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Cha_nnel:")); gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD, -1); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL, GIMP_HISTOGRAM_VALUE, GIMP_HISTOGRAM_ALPHA); tool->channel_menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store)); g_object_unref (store); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu), config->channel); gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu), "gimp-channel"); gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0); gtk_widget_show (tool->channel_menu); g_signal_connect (tool->channel_menu, "changed", G_CALLBACK (curves_channel_callback), tool); gtk_label_set_mnemonic_widget (GTK_LABEL (label), tool->channel_menu); button = gtk_button_new_with_mnemonic (_("R_eset Channel")); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (curves_channel_reset_callback), tool); /* The histogram scale radio buttons */ hbox2 = gimp_prop_enum_icon_box_new (G_OBJECT (tool_options), "histogram-scale", "gimp-histogram", 0, 0); gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0); gtk_widget_show (hbox2); frame_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_container_add (GTK_CONTAINER (main_frame), frame_vbox); gtk_widget_show (frame_vbox); /* The table for the color bars and the graph */ table = gtk_table_new (2, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 2); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_box_pack_start (GTK_BOX (frame_vbox), table, TRUE, TRUE, 0); /* The left color bar */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_table_attach (GTK_TABLE (table), vbox, 0, 1, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (vbox); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, RADIUS); gtk_widget_show (frame); tool->yrange = gimp_color_bar_new (GTK_ORIENTATION_VERTICAL); gtk_widget_set_size_request (tool->yrange, BAR_SIZE, -1); gtk_container_add (GTK_CONTAINER (frame), tool->yrange); gtk_widget_show (tool->yrange); /* The curves graph */ frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_table_attach (GTK_TABLE (table), frame, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (frame); tool->graph = gimp_curve_view_new (); gimp_curve_view_set_range_x (GIMP_CURVE_VIEW (tool->graph), 0, 255); gimp_curve_view_set_range_y (GIMP_CURVE_VIEW (tool->graph), 0, 255); gtk_widget_set_size_request (tool->graph, GRAPH_SIZE + RADIUS * 2, GRAPH_SIZE + RADIUS * 2); g_object_set (tool->graph, "border-width", RADIUS, "subdivisions", 1, NULL); gtk_container_add (GTK_CONTAINER (frame), tool->graph); gtk_widget_show (tool->graph); gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options), GIMP_HISTOGRAM_VIEW (tool->graph)); /* The bottom color bar */ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_table_attach (GTK_TABLE (table), hbox2, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox2); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (hbox2), frame, TRUE, TRUE, RADIUS); gtk_widget_show (frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); tool->xrange = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_size_request (tool->xrange, -1, BAR_SIZE / 2); gtk_box_pack_start (GTK_BOX (vbox), tool->xrange, TRUE, TRUE, 0); gtk_widget_show (tool->xrange); bar = gimp_color_bar_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (GTK_BOX (vbox), bar, TRUE, TRUE, 0); gtk_widget_show (bar); gtk_widget_show (table); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_end (GTK_BOX (frame_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new_with_mnemonic (_("Curve _type:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); tool->curve_type = combo = gimp_enum_combo_box_new (GIMP_TYPE_CURVE_TYPE); gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo), "gimp-curve"); gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), 0, G_CALLBACK (curves_curve_type_callback), tool); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); gimp_curves_tool_update_channel (tool); }
static void rc_plugin_tag_ui_init() { GtkWidget *path_label, *title_label, *artist_label, *album_label; GtkWidget *genre_label, *comment_label, *track_label, *year_label; GtkWidget *format_label, *channel_label, *bd_label, *sr_label; GtkWidget *bitrate_label, *length_label, *rg_label; GtkWidget *tag_frame, *media_frame; GtkWidget *tag_table, *media_table; GtkWidget *info_vbox, *media_vbox, *path_hbox, *art_hbox; GtkWidget *button_hbox; GtkWidget *info_scr_window; GtkActionEntry menu_action_entry, popup_action_entry; path_label = gtk_label_new(_("Path")); title_label = gtk_label_new(_("Title")); artist_label = gtk_label_new(_("Artist")); album_label = gtk_label_new(_("Album")); genre_label = gtk_label_new(_("Genre")); comment_label = gtk_label_new(_("Comment")); track_label = gtk_label_new(_("Track")); year_label = gtk_label_new(_("Year")); format_label = gtk_label_new(_("Format")); channel_label = gtk_label_new(_("Channel")); bd_label = gtk_label_new(_("Bit Depth")); sr_label = gtk_label_new(_("Sample Rate")); bitrate_label = gtk_label_new(_("Bitrate")); length_label = gtk_label_new(_("Length")); rg_label = gtk_label_new(_("Replay Gain")); tag_frame = gtk_frame_new(_("Tag")); media_frame = gtk_frame_new(_("Media Information")); tag_table = gtk_table_new(5, 4, FALSE); media_table = gtk_table_new(7, 2, FALSE); info_vbox = gtk_vbox_new(FALSE, 1); media_vbox = gtk_vbox_new(FALSE, 1); path_hbox = gtk_hbox_new(FALSE, 4); art_hbox = gtk_hbox_new(FALSE, 4); button_hbox = gtk_hbutton_box_new(); info_scr_window = gtk_scrolled_window_new(NULL, NULL); tag_ui.tag_main_vbox = gtk_vbox_new(FALSE, 0); tag_ui.path_entry = gtk_entry_new(); tag_ui.title_entry = gtk_entry_new(); tag_ui.artist_entry = gtk_entry_new(); tag_ui.album_entry = gtk_entry_new(); tag_ui.genre_entry = gtk_entry_new(); tag_ui.comment_entry = gtk_entry_new(); tag_ui.track_entry = gtk_entry_new(); tag_ui.year_entry = gtk_entry_new(); tag_ui.format_entry = gtk_label_new(NULL); tag_ui.channel_entry = gtk_label_new(NULL); tag_ui.bd_entry = gtk_label_new(NULL); tag_ui.sr_entry = gtk_label_new(NULL); tag_ui.bitrate_entry = gtk_label_new(NULL); tag_ui.length_entry = gtk_label_new(NULL); tag_ui.rg_entry = gtk_entry_new(); tag_ui.reload_button = gtk_button_new_with_mnemonic(_("Re_load")); tag_ui.save_button = gtk_button_new_with_mnemonic(_("_Save")); gtk_editable_set_editable(GTK_EDITABLE(tag_ui.path_entry), FALSE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(info_scr_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_table_attach(GTK_TABLE(tag_table), title_label, 0, 1, 0, 1, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.title_entry, 1, 4, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), artist_label, 0, 1, 1, 2, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.artist_entry, 1, 4, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), album_label, 0, 1, 2, 3, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.album_entry, 1, 2, 2, 3, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), track_label, 2, 3, 2, 3, 0, GTK_FILL, 4, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.track_entry, 3, 4, 2, 3, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), genre_label, 0, 1, 3, 4, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.genre_entry, 1, 2, 3, 4, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), year_label, 2, 3, 3, 4, 0, GTK_FILL, 4, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.year_entry, 3, 4, 3, 4, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), comment_label, 0, 1, 4, 5, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(tag_table), tag_ui.comment_entry, 1, 4, 4, 5, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_table_attach(GTK_TABLE(media_table), format_label, 0, 1, 0, 1, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.format_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), channel_label, 0, 1, 1, 2, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.channel_entry, 1, 2, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), bd_label, 0, 1, 2, 3, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.bd_entry, 1, 2, 2, 3, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), sr_label, 0, 1, 3, 4, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.sr_entry, 1, 2, 3, 4, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), bitrate_label, 0, 1, 4, 5, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.bitrate_entry, 1, 2, 4, 5, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), length_label, 0, 1, 5, 6, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.length_entry, 1, 2, 5, 6, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), rg_label, 0, 1, 6, 7, 0, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(media_table), tag_ui.rg_entry, 1, 2, 6, 7, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_container_add(GTK_CONTAINER(tag_frame), tag_table); gtk_container_add(GTK_CONTAINER(media_frame), media_table); gtk_box_pack_start(GTK_BOX(media_vbox), tag_frame, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(media_vbox), media_frame, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(path_hbox), path_label, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(path_hbox), tag_ui.path_entry, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(info_vbox), path_hbox, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(info_vbox), media_vbox, FALSE, FALSE, 1); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(info_scr_window), info_vbox); gtk_button_box_set_layout(GTK_BUTTON_BOX(button_hbox), GTK_BUTTONBOX_END); gtk_box_pack_start(GTK_BOX(button_hbox), tag_ui.reload_button, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(button_hbox), tag_ui.save_button, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(tag_ui.tag_main_vbox), info_scr_window, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(tag_ui.tag_main_vbox), button_hbox, FALSE, FALSE, 8); g_signal_connect(G_OBJECT(tag_ui.track_entry), "insert-text", G_CALLBACK(rc_plugin_tag_entry_insert_text_cb), NULL); g_signal_connect(G_OBJECT(tag_ui.year_entry), "insert-text", G_CALLBACK(rc_plugin_tag_entry_insert_text_cb), NULL); g_signal_connect(G_OBJECT(tag_ui.rg_entry), "insert-text", G_CALLBACK(rc_plugin_tag_rg_entry_insert_text_cb), NULL); g_signal_connect(G_OBJECT(tag_ui.reload_button), "clicked", G_CALLBACK(rc_plugin_tag_reload_data_cb), NULL); g_signal_connect(G_OBJECT(tag_ui.save_button), "clicked", G_CALLBACK(rc_plugin_tag_data_save_cb), NULL); menu_id = gtk_ui_manager_new_merge_id(rc_gui_get_ui_manager()); menu_action_entry.name = "EditTagEditor"; menu_action_entry.label = _("Tag Editor"); menu_action_entry.accelerator = NULL; menu_action_entry.stock_id = NULL; menu_action_entry.tooltip = _("Edit the tag of the selected music"); menu_action_entry.callback = G_CALLBACK(rc_plugin_tag_edit_menu_cb); gtk_ui_manager_add_ui(rc_gui_get_ui_manager(), menu_id, "/RCMenuBar/EditMenu/EditSep2", "EditTagEditor", "EditTagEditor", GTK_UI_MANAGER_MENUITEM, TRUE); gtk_action_group_add_actions(rc_gui_get_action_group(), &menu_action_entry, 1, NULL); popup_id = gtk_ui_manager_new_merge_id(rc_gui_get_ui_manager()); popup_action_entry.name = "List2TagEditor"; popup_action_entry.label = _("Tag Editor"); popup_action_entry.accelerator = NULL; popup_action_entry.stock_id = NULL; popup_action_entry.tooltip = _("Edit the tag of the selected music"); popup_action_entry.callback = G_CALLBACK(rc_plugin_tag_edit_menu_cb); gtk_ui_manager_add_ui(rc_gui_get_ui_manager(), popup_id, "/List2PopupMenu/List2Sep2", "List2TagEditor", "List2TagEditor", GTK_UI_MANAGER_MENUITEM, FALSE); gtk_action_group_add_actions(rc_gui_get_action_group(), &popup_action_entry, 1, NULL); }
/* used by editor and assistant - same code */ GtkWidget * org_gnome_activesync_server_url(EPlugin *epl, EConfigHookItemFactoryData *data) { EMConfigTargetAccount *target_account; const gchar *source_url; gchar *server_url = NULL, *username, *key; const char *address; GtkWidget *url_entry, *username_entry; CamelURL *url; gint row; GtkWidget *hbox, *label, *button; GConfClient *client = gconf_client_get_default(); EasEmailHandler* handler; GError *error = NULL; target_account = (EMConfigTargetAccount *)data->config->target; source_url = e_account_get_string (target_account->MODIFIED_ACCT, E_ACCOUNT_SOURCE_URL); if (source_url && source_url[0] != '\0') url = camel_url_new(source_url, NULL); else url = NULL; if (url == NULL || strcmp(url->protocol, "eas") != 0) { if (url) camel_url_free(url); if (data->old && (label = g_object_get_data((GObject *)data->old, "authenticate-label"))) gtk_widget_destroy(label); /* TODO: we could remove 'owa-url' from the url, but that will lose it if we come back. Maybe a commit callback could do it */ return NULL; } if (data->old) { camel_url_free(url); return data->old; } address = e_account_get_string (target_account->MODIFIED_ACCT, E_ACCOUNT_ID_ADDRESS); key = g_strdup_printf ("/apps/activesyncd/accounts/%s/username", address); username = gconf_client_get_string (client, key, NULL); if (!username || !*username) { gconf_client_set_string (client, key, address, NULL); username = g_strdup (address); } g_free (key); key = g_strdup_printf ("/apps/activesyncd/accounts/%s/serverUri", address); server_url = gconf_client_get_string (client, key, NULL); g_object_unref (client); g_free (key); g_object_get (data->parent, "n-rows", &row, NULL); label = gtk_label_new_with_mnemonic (_("User_name:")); gtk_widget_show (label); username_entry = gtk_entry_new (); gtk_widget_show (username_entry); if (username) gtk_entry_set_text (GTK_ENTRY (username_entry), username); gtk_label_set_mnemonic_widget (GTK_LABEL (label), username_entry); g_signal_connect (username_entry, "changed", G_CALLBACK (username_entry_changed), data->config); gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0); gtk_table_attach (GTK_TABLE (data->parent), username_entry, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); row++; hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new_with_mnemonic(_("_Server URL:")); gtk_widget_show(label); url_entry = gtk_entry_new(); camel_url_free (url); gtk_label_set_mnemonic_widget((GtkLabel *)label, url_entry); button = gtk_button_new_with_mnemonic (_("_Auto Detect")); gtk_box_pack_start (GTK_BOX (hbox), url_entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show_all(hbox); gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0); gtk_table_attach (GTK_TABLE (data->parent), hbox, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); g_signal_connect (url_entry, "changed", G_CALLBACK(url_entry_changed), data->config); if (server_url) gtk_entry_set_text(GTK_ENTRY (url_entry), server_url); g_object_set_data ((GObject *)button, "url-entry", (gpointer) url_entry); g_signal_connect (button, "clicked", G_CALLBACK(discover_server_url), data->config); /* if the host is null, then user+other info is dropped silently, force it to be kept */ if (!server_url|| !*server_url) { gchar *uri; uri = g_strdup_printf (EVOLUTION_ACCOUNT_URL_FORMAT, address, address, ""); e_account_set_string(target_account->MODIFIED_ACCT, E_ACCOUNT_SOURCE_URL, uri); g_free(uri); } g_free (server_url); g_free (username); return hbox; }
static void create_adapter(adapter_data *adapter) { GHashTable *hash = NULL; GValue *value; DBusGProxy *default_proxy; const gchar *name; gboolean powered, discoverable; guint timeout; GtkWidget *mainbox; GtkWidget *vbox; GtkWidget *alignment; GtkWidget *table; GtkWidget *label; GtkWidget *image; GtkWidget *button; GtkWidget *entry; GtkWidget *buttonbox; int page_num; dbus_g_proxy_call(adapter->proxy, "GetProperties", NULL, G_TYPE_INVALID, dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &hash, G_TYPE_INVALID); if (hash != NULL) { value = g_hash_table_lookup(hash, "Name"); name = value ? g_value_get_string(value) : NULL; value = g_hash_table_lookup(hash, "Powered"); powered = value ? g_value_get_boolean(value) : FALSE; value = g_hash_table_lookup(hash, "Discoverable"); discoverable = value ? g_value_get_boolean(value) : FALSE; value = g_hash_table_lookup(hash, "DiscoverableTimeout"); timeout = value ? g_value_get_uint(value) : 0; } else { name = NULL; powered = FALSE; discoverable = FALSE; timeout = 0; } adapter->powered = powered; adapter->discoverable = discoverable; adapter->timeout_value = timeout; default_proxy = bluetooth_client_get_default_adapter (client); if (default_proxy != NULL) { adapter->is_default = g_str_equal (dbus_g_proxy_get_path (default_proxy), dbus_g_proxy_get_path (adapter->proxy)); g_object_unref (default_proxy); } mainbox = gtk_vbox_new(FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(mainbox), 12); page_num = gtk_notebook_prepend_page(GTK_NOTEBOOK(adapter->notebook), mainbox, NULL); adapter->child = mainbox; vbox = gtk_vbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, TRUE, 0); /* The discoverable checkbox */ button = gtk_check_button_new_with_mnemonic (_("Make computer _visible")); if (powered == FALSE) discoverable = FALSE; if (discoverable != FALSE && timeout == 0) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); else if (discoverable == FALSE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE); else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE); } gtk_widget_set_sensitive (button, adapter->powered); adapter->button_discoverable = button; adapter->signal_discoverable = g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(discoverable_changed_cb), adapter); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); /* The friendly name */ vbox = gtk_vbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); label = create_label(_("Friendly name")); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment); gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), 248); gtk_widget_set_size_request(entry, 240, -1); gtk_container_add (GTK_CONTAINER (alignment), entry); if (name != NULL) gtk_entry_set_text(GTK_ENTRY(entry), name); adapter->entry = entry; adapter->name_vbox = vbox; g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(name_callback), adapter); g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(focus_callback), adapter); gtk_widget_set_sensitive (adapter->name_vbox, adapter->powered); /* The known devices */ table = gtk_table_new(2, 2, FALSE); gtk_box_pack_start(GTK_BOX(mainbox), table, TRUE, TRUE, 0); label = create_label(_("Devices")); gtk_table_attach(GTK_TABLE(table), label, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 6); /* Note that this will only ever show the devices on the default * adapter, this is on purpose */ adapter->chooser = bluetooth_chooser_new (NULL); g_object_set (adapter->chooser, "show-searching", FALSE, "show-device-type", FALSE, "show-device-category", FALSE, "show-pairing", TRUE, "show-connected", TRUE, "device-category-filter", BLUETOOTH_CATEGORY_PAIRED_OR_TRUSTED, NULL); g_signal_connect (adapter->chooser, "notify::device-selected", G_CALLBACK(device_selected_cb), adapter); gtk_table_attach(GTK_TABLE(table), adapter->chooser, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); adapter->devices_table = table; buttonbox = gtk_vbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_START); gtk_box_set_spacing(GTK_BOX(buttonbox), 6); gtk_box_set_homogeneous(GTK_BOX(buttonbox), FALSE); gtk_table_attach(GTK_TABLE(table), buttonbox, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 6, 6); button = gtk_button_new_with_mnemonic(_("Set up _new device...")); image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON); gtk_button_set_image(GTK_BUTTON(button), image); gtk_box_pack_start(GTK_BOX(buttonbox), button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(wizard_callback), adapter); button = gtk_button_new_with_label(_("Disconnect")); image = gtk_image_new_from_stock(GTK_STOCK_DISCONNECT, GTK_ICON_SIZE_BUTTON); gtk_button_set_image(GTK_BUTTON(button), image); gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0); gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox), button, TRUE); gtk_widget_set_sensitive(button, FALSE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(disconnect_callback), adapter); adapter->button_disconnect = button; button = gtk_button_new_with_mnemonic(_("_Remove")); image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON); gtk_button_set_image(GTK_BUTTON(button), image); gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0); gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox), button, TRUE); gtk_widget_set_sensitive(button, FALSE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(remove_callback), adapter); adapter->button_delete = button; gtk_widget_set_sensitive (adapter->devices_table, adapter->powered); g_object_set_data(G_OBJECT(mainbox), "adapter", adapter); gtk_widget_show_all(mainbox); if (adapter->is_default != FALSE) gtk_notebook_set_current_page (GTK_NOTEBOOK (adapter->notebook), page_num); }
void effect_show_dialog(void) { gint i; /* echo widgets */ GtkWidget *frame_echo; GtkWidget *chk_echo; GtkWidget *hs_echo_delay, *hs_echo_feedback, *hs_echo_wet; /* stereo enhance widgets */ GtkWidget *frame_stereo; GtkWidget *chk_stereo; GtkWidget *hs_stereo_level; /* voice removal widgets */ GtkWidget *frame_voice; GtkWidget *chk_voice; /* normalizer widgets */ GtkWidget *frame_normal; GtkWidget *chk_normal; GtkWidget *sp_normal_buckets; GtkWidget *hs_normal_target, *hs_normal_gainmax, *hs_normal_gainsmooth; /* equalizer widgets */ GtkWidget *frame_eq; GtkWidget *chk_eq; GtkWidget *chk_auto; GtkWidget *btn_eq_flat, *btn_eq_rock, *btn_eq_pop, *btn_eq_laptop, *btn_eq_classic; GtkWidget *vs_eq[10]; /* stock button widgets */ GtkWidget *cancelbutton; GtkWidget *applybutton; GtkWidget *okbutton; GtkWidget *dialog_vbox1; GtkWidget *dialog_action_area1; GtkObject *sp_normal_buckets_adj; GtkWidget *hseparator1, *hseparator2, *hseparator3, *hseparator4; GtkWidget *hbox1, *hbox2, *hbox3, *hbox4, *hbox5, *hbox6, *hbox7, *hbox8, *hbox9, *hbox10; GtkWidget *hbox11, *hbox12, *hbox13; GtkWidget *vbox1, *vbox2, *vbox3, *vbox5, *vbox6, *vbox7, *vbox8, *vbox18, *vbox19; GtkWidget *label4, *label5, *label6, *label7, *label8, *label9, *label10, *label11, *label12; GtkWidget *label13, *label14, *label15, *label16, *label17, *label18, *label19, *label20; GtkWidget *label21, *label22, *label23, *label24, *label25, *label26; GtkWidget *hbox_eq1, *hbox_eq2; if (effect_dialog != NULL) return; effect_dialog = gtk_dialog_new(); gtk_container_set_border_width(GTK_CONTAINER(effect_dialog), 2); gtk_window_set_title(GTK_WINDOW(effect_dialog), _("Effect")); gtk_window_set_position(GTK_WINDOW(effect_dialog), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(effect_dialog), 500, -1); dialog_vbox1 = GTK_DIALOG(effect_dialog)->vbox; gtk_widget_show(dialog_vbox1); hbox1 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox1); gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox1, TRUE, TRUE, 2); vbox6 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox6); gtk_box_pack_start(GTK_BOX(hbox1), vbox6, TRUE, TRUE, 0); hbox10 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox10); gtk_box_pack_start(GTK_BOX(vbox6), hbox10, FALSE, TRUE, 0); frame_echo = gtk_frame_new(NULL); gtk_widget_show(frame_echo); gtk_box_pack_start(GTK_BOX(hbox10), frame_echo, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame_echo), 2); vbox1 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(frame_echo), vbox1); gtk_container_set_border_width(GTK_CONTAINER(vbox1), 4); chk_echo = gtk_check_button_new_with_mnemonic(_("Enable Echo")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_echo), effect.echo.on); gtk_widget_show(chk_echo); gtk_box_pack_start(GTK_BOX(vbox1), chk_echo, FALSE, FALSE, 0); hseparator3 = gtk_hseparator_new(); gtk_widget_show(hseparator3); gtk_box_pack_start(GTK_BOX(vbox1), hseparator3, FALSE, FALSE, 1); hbox2 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox2); gtk_box_pack_start(GTK_BOX(vbox1), hbox2, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox2), 1); label4 = gtk_label_new(_("Deley(ms)")); gtk_widget_show(label4); gtk_box_pack_start(GTK_BOX(hbox2), label4, FALSE, FALSE, 2); gtk_label_set_justify(GTK_LABEL(label4), GTK_JUSTIFY_LEFT); hs_echo_delay = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.echo.delay, 0, MAX_DELAY, 1, 0, 0))); gtk_widget_show(hs_echo_delay); gtk_box_pack_start(GTK_BOX(vbox1), hs_echo_delay, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_echo_delay), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_echo_delay), 0); hbox3 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox3); gtk_box_pack_start(GTK_BOX(vbox1), hbox3, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox3), 1); label5 = gtk_label_new(_("Feedback(%)")); gtk_widget_show(label5); gtk_box_pack_start(GTK_BOX(hbox3), label5, FALSE, FALSE, 2); gtk_label_set_justify(GTK_LABEL(label5), GTK_JUSTIFY_LEFT); hs_echo_feedback = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.echo.feedback, 0, 100, 1, 0, 0))); gtk_widget_show(hs_echo_feedback); gtk_box_pack_start(GTK_BOX(vbox1), hs_echo_feedback, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_echo_feedback), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_echo_feedback), 0); hbox4 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox4); gtk_box_pack_start(GTK_BOX(vbox1), hbox4, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox4), 1); label6 = gtk_label_new(_("Wet(%)")); gtk_widget_show(label6); gtk_box_pack_start(GTK_BOX(hbox4), label6, FALSE, TRUE, 2); gtk_label_set_justify(GTK_LABEL(label6), GTK_JUSTIFY_LEFT); hs_echo_wet = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.echo.wet, 0, 100, 1, 0, 0))); gtk_widget_show(hs_echo_wet); gtk_box_pack_start(GTK_BOX(vbox1), hs_echo_wet, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_echo_wet), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_echo_wet), 0); label8 = gtk_label_new(_("Echo")); gtk_widget_show(label8); gtk_frame_set_label_widget(GTK_FRAME(frame_echo), label8); gtk_label_set_justify(GTK_LABEL(label8), GTK_JUSTIFY_LEFT); vbox7 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox7); gtk_box_pack_start(GTK_BOX(hbox10), vbox7, TRUE, TRUE, 0); frame_stereo = gtk_frame_new(NULL); gtk_widget_show(frame_stereo); gtk_box_pack_start(GTK_BOX(vbox7), frame_stereo, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame_stereo), 2); vbox2 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox2); gtk_container_add(GTK_CONTAINER(frame_stereo), vbox2); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 4); chk_stereo = gtk_check_button_new_with_mnemonic(_("Enable Stereo Enhance")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_stereo), effect.stereo.on); gtk_widget_show(chk_stereo); gtk_box_pack_start(GTK_BOX(vbox2), chk_stereo, FALSE, FALSE, 0); hseparator2 = gtk_hseparator_new(); gtk_widget_show(hseparator2); gtk_box_pack_start(GTK_BOX(vbox2), hseparator2, FALSE, FALSE, 1); hbox5 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox5); gtk_box_pack_start(GTK_BOX(vbox2), hbox5, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox5), 1); label7 = gtk_label_new(_("Effect Level")); gtk_widget_show(label7); gtk_box_pack_start(GTK_BOX(hbox5), label7, FALSE, FALSE, 2); gtk_label_set_justify(GTK_LABEL(label7), GTK_JUSTIFY_LEFT); hs_stereo_level = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.stereo.level, 0, 8, 0.1, 0, 0))); gtk_widget_show(hs_stereo_level); gtk_box_pack_start(GTK_BOX(vbox2), hs_stereo_level, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_stereo_level), GTK_POS_RIGHT); label9 = gtk_label_new(_("Stereo Enhance")); gtk_widget_show(label9); gtk_frame_set_label_widget(GTK_FRAME(frame_stereo), label9); gtk_label_set_justify(GTK_LABEL(label9), GTK_JUSTIFY_LEFT); frame_voice = gtk_frame_new(NULL); gtk_widget_show(frame_voice); gtk_box_pack_start(GTK_BOX(vbox7), frame_voice, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame_voice), 2); vbox3 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox3); gtk_container_add(GTK_CONTAINER(frame_voice), vbox3); gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4); chk_voice = gtk_check_button_new_with_mnemonic(_("Enable Voice Removal")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_voice), effect.voice.on); gtk_widget_show(chk_voice); gtk_box_pack_start(GTK_BOX(vbox3), chk_voice, FALSE, FALSE, 0); hseparator1 = gtk_hseparator_new(); gtk_widget_show(hseparator1); gtk_box_pack_start(GTK_BOX(vbox3), hseparator1, FALSE, FALSE, 1); label10 = gtk_label_new(_("Voice Removal")); gtk_widget_show(label10); gtk_frame_set_label_widget(GTK_FRAME(frame_voice), label10); gtk_label_set_justify(GTK_LABEL(label10), GTK_JUSTIFY_LEFT); frame_normal = gtk_frame_new(NULL); gtk_widget_show(frame_normal); gtk_box_pack_start(GTK_BOX(hbox10), frame_normal, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame_normal), 2); vbox5 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox5); gtk_container_add(GTK_CONTAINER(frame_normal), vbox5); gtk_container_set_border_width(GTK_CONTAINER(vbox5), 4); chk_normal = gtk_check_button_new_with_mnemonic(_("Enable Normalizer")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_normal), effect.normal.on); gtk_widget_show(chk_normal); gtk_box_pack_start(GTK_BOX(vbox5), chk_normal, FALSE, FALSE, 0); hseparator4 = gtk_hseparator_new(); gtk_widget_show(hseparator4); gtk_box_pack_start(GTK_BOX(vbox5), hseparator4, TRUE, TRUE, 1); hbox9 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox9); gtk_box_pack_start(GTK_BOX(vbox5), hbox9, TRUE, TRUE, 0); label15 = gtk_label_new(_("Window Size")); gtk_widget_show(label15); gtk_box_pack_start(GTK_BOX(hbox9), label15, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label15), GTK_JUSTIFY_LEFT); sp_normal_buckets_adj = gtk_adjustment_new(effect.normal.buckets, 0, 1024, 1, 10, 10); sp_normal_buckets = gtk_spin_button_new(GTK_ADJUSTMENT(sp_normal_buckets_adj), 1, 0); gtk_widget_show(sp_normal_buckets); gtk_box_pack_start(GTK_BOX(hbox9), sp_normal_buckets, TRUE, TRUE, 0); hbox6 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox6); gtk_box_pack_start(GTK_BOX(vbox5), hbox6, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox6), 1); label12 = gtk_label_new(_("Target Audio Level")); gtk_widget_show(label12); gtk_box_pack_start(GTK_BOX(hbox6), label12, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label12), GTK_JUSTIFY_LEFT); hs_normal_target = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.normal.target, 0, 99999, 1, 0, 0))); gtk_widget_show(hs_normal_target); gtk_box_pack_start(GTK_BOX(vbox5), hs_normal_target, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_normal_target), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_normal_target), 0); hbox7 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox7); gtk_box_pack_start(GTK_BOX(vbox5), hbox7, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox7), 1); label13 = gtk_label_new(_("Maximum Gain")); gtk_widget_show(label13); gtk_box_pack_start(GTK_BOX(hbox7), label13, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label13), GTK_JUSTIFY_LEFT); hs_normal_gainmax = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.normal.gainmax, 0, 9999, 1, 0, 0))); gtk_widget_show(hs_normal_gainmax); gtk_box_pack_start(GTK_BOX(vbox5), hs_normal_gainmax, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_normal_gainmax), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_normal_gainmax), 0); hbox8 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox8); gtk_box_pack_start(GTK_BOX(vbox5), hbox8, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox8), 1); label14 = gtk_label_new(_("Gain Smooth")); gtk_widget_show(label14); gtk_box_pack_start(GTK_BOX(hbox8), label14, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label14), GTK_JUSTIFY_LEFT); hs_normal_gainsmooth = gtk_hscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.normal.gainsmooth, 0, 10, 1, 0, 0))); gtk_widget_show(hs_normal_gainsmooth); gtk_box_pack_start(GTK_BOX(vbox5), hs_normal_gainsmooth, FALSE, TRUE, 0); gtk_scale_set_value_pos(GTK_SCALE(hs_normal_gainsmooth), GTK_POS_RIGHT); gtk_scale_set_digits(GTK_SCALE(hs_normal_gainsmooth), 0); label11 = gtk_label_new(_("Normalizer")); gtk_widget_show(label11); gtk_frame_set_label_widget(GTK_FRAME(frame_normal), label11); gtk_label_set_justify(GTK_LABEL(label11), GTK_JUSTIFY_LEFT); frame_eq = gtk_frame_new(NULL); gtk_widget_show(frame_eq); gtk_box_pack_start(GTK_BOX(vbox6), frame_eq, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(frame_eq), 2); hbox11 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox11); gtk_container_add(GTK_CONTAINER(frame_eq), hbox11); gtk_container_set_border_width(GTK_CONTAINER(hbox11), 4); hbox13 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox13); gtk_box_pack_start(GTK_BOX(hbox11), hbox13, TRUE, TRUE, 0); vbox19 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox19); gtk_box_pack_start(GTK_BOX(hbox13), vbox19, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox19), 4); chk_eq = gtk_check_button_new_with_mnemonic(_("Enable Equalizer")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_eq), effect.eq.on); gtk_widget_show(chk_eq); gtk_box_pack_start(GTK_BOX(vbox19), chk_eq, FALSE, FALSE, 0); chk_auto = gtk_check_button_new_with_mnemonic(_("Auto")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_auto), effect.eq.on_auto); gtk_widget_show(chk_auto); gtk_box_pack_start(GTK_BOX(vbox19), chk_auto, FALSE, FALSE, 0); vbox18 = gtk_vbox_new(TRUE, 0); gtk_widget_show(vbox18); gtk_box_pack_start(GTK_BOX(hbox13), vbox18, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox18), 4); btn_eq_flat = gtk_button_new_with_mnemonic(_("Flat")); gtk_widget_show(btn_eq_flat); gtk_box_pack_start(GTK_BOX(vbox18), btn_eq_flat, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(btn_eq_flat), 2); btn_eq_rock = gtk_button_new_with_mnemonic(_("Rock")); gtk_widget_show(btn_eq_rock); gtk_box_pack_start(GTK_BOX(vbox18), btn_eq_rock, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(btn_eq_rock), 2); btn_eq_pop = gtk_button_new_with_mnemonic(_("Pop")); gtk_widget_show(btn_eq_pop); gtk_box_pack_start(GTK_BOX(vbox18), btn_eq_pop, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(btn_eq_pop), 2); btn_eq_laptop = gtk_button_new_with_mnemonic(_("Laptop Speaker")); gtk_widget_show(btn_eq_laptop); gtk_box_pack_start(GTK_BOX(vbox18), btn_eq_laptop, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(btn_eq_laptop), 2); btn_eq_classic = gtk_button_new_with_mnemonic(_("Classic")); gtk_widget_show(btn_eq_classic); gtk_box_pack_start(GTK_BOX(vbox18), btn_eq_classic, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(btn_eq_classic), 2); hbox12 = gtk_hbox_new(FALSE, 0); gtk_widget_show(hbox12); gtk_box_pack_start(GTK_BOX(hbox11), hbox12, TRUE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox12), 4); vbox8 = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox8); gtk_box_pack_start(GTK_BOX(hbox12), vbox8, TRUE, TRUE, 0); hbox_eq1 = gtk_hbox_new(TRUE, 0); gtk_widget_show(hbox_eq1); gtk_box_pack_start(GTK_BOX(vbox8), hbox_eq1, TRUE, TRUE, 0); hbox_eq2 = gtk_hbox_new(TRUE, 0); gtk_widget_show(hbox_eq2); gtk_box_pack_start(GTK_BOX(vbox8), hbox_eq2, FALSE, TRUE, 0); for (i = 0; i < 10; i++) { vs_eq[i] = gtk_vscale_new(GTK_ADJUSTMENT (gtk_adjustment_new (effect.eq.eq[i], -10.0, 10.0, 0.1, 0.5, 0))); gtk_widget_show(vs_eq[i]); gtk_box_pack_start(GTK_BOX(hbox_eq1), vs_eq[i], TRUE, TRUE, 0); gtk_scale_set_draw_value(GTK_SCALE(vs_eq[i]), FALSE); gtk_scale_set_digits(GTK_SCALE(vs_eq[i]), 2); gtk_range_set_inverted(GTK_RANGE(vs_eq[i]), TRUE); gtk_range_set_update_policy(GTK_RANGE(vs_eq[i]), GTK_UPDATE_DISCONTINUOUS); } label17 = gtk_label_new(_("30")); gtk_widget_show(label17); gtk_box_pack_start(GTK_BOX(hbox_eq2), label17, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label17), GTK_JUSTIFY_LEFT); label18 = gtk_label_new(_("62")); gtk_widget_show(label18); gtk_box_pack_start(GTK_BOX(hbox_eq2), label18, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label18), GTK_JUSTIFY_LEFT); label19 = gtk_label_new(_("125")); gtk_widget_show(label19); gtk_box_pack_start(GTK_BOX(hbox_eq2), label19, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label19), GTK_JUSTIFY_LEFT); label20 = gtk_label_new(_("250")); gtk_widget_show(label20); gtk_box_pack_start(GTK_BOX(hbox_eq2), label20, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label20), GTK_JUSTIFY_LEFT); label21 = gtk_label_new(_("500")); gtk_widget_show(label21); gtk_box_pack_start(GTK_BOX(hbox_eq2), label21, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label21), GTK_JUSTIFY_LEFT); label22 = gtk_label_new(_("1K")); gtk_widget_show(label22); gtk_box_pack_start(GTK_BOX(hbox_eq2), label22, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label22), GTK_JUSTIFY_LEFT); label23 = gtk_label_new(_("2K")); gtk_widget_show(label23); gtk_box_pack_start(GTK_BOX(hbox_eq2), label23, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label23), GTK_JUSTIFY_LEFT); label24 = gtk_label_new(_("4K")); gtk_widget_show(label24); gtk_box_pack_start(GTK_BOX(hbox_eq2), label24, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label24), GTK_JUSTIFY_LEFT); label25 = gtk_label_new(_("6K")); gtk_widget_show(label25); gtk_box_pack_start(GTK_BOX(hbox_eq2), label25, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label25), GTK_JUSTIFY_LEFT); label26 = gtk_label_new(_("16K")); gtk_widget_show(label26); gtk_box_pack_start(GTK_BOX(hbox_eq2), label26, FALSE, FALSE, 0); gtk_label_set_justify(GTK_LABEL(label26), GTK_JUSTIFY_LEFT); label16 = gtk_label_new(_("Equalizer")); gtk_widget_show(label16); gtk_frame_set_label_widget(GTK_FRAME(frame_eq), label16); gtk_label_set_justify(GTK_LABEL(label16), GTK_JUSTIFY_LEFT); dialog_action_area1 = GTK_DIALOG(effect_dialog)->action_area; gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); cancelbutton = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton); gtk_dialog_add_action_widget(GTK_DIALOG(effect_dialog), cancelbutton, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT); applybutton = gtk_button_new_from_stock("gtk-apply"); gtk_widget_show(applybutton); gtk_dialog_add_action_widget(GTK_DIALOG(effect_dialog), applybutton, GTK_RESPONSE_APPLY); GTK_WIDGET_SET_FLAGS(applybutton, GTK_CAN_DEFAULT); okbutton = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton); gtk_dialog_add_action_widget(GTK_DIALOG(effect_dialog), okbutton, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS(okbutton, GTK_CAN_DEFAULT); g_signal_connect((gpointer) effect_dialog, "delete_event", G_CALLBACK(on_effect_delete_event), NULL); g_signal_connect((gpointer) btn_eq_flat, "clicked", G_CALLBACK(on_btn_eq_flat_clicked), NULL); g_signal_connect((gpointer) btn_eq_rock, "clicked", G_CALLBACK(on_btn_eq_rock_clicked), NULL); g_signal_connect((gpointer) btn_eq_pop, "clicked", G_CALLBACK(on_btn_eq_pop_clicked), NULL); g_signal_connect((gpointer) btn_eq_laptop, "clicked", G_CALLBACK(on_btn_eq_laptop_clicked), NULL); g_signal_connect((gpointer) btn_eq_classic, "clicked", G_CALLBACK(on_btn_eq_classic_clicked), NULL); for (i = 0; i < 10; i++) { g_signal_connect((gpointer) vs_eq[i], "value_changed", G_CALLBACK(on_vs_eq_value_changed), GINT_TO_POINTER(i)); g_signal_connect(GTK_WIDGET(vs_eq[i]), "button-press-event", G_CALLBACK(on_vs_eq_double_clicked), GINT_TO_POINTER(i)); } g_signal_connect((gpointer) cancelbutton, "clicked", G_CALLBACK(on_cancelbutton_clicked), NULL); g_signal_connect((gpointer) applybutton, "clicked", G_CALLBACK(on_applybutton_clicked), NULL); g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), NULL); /* echo widgets */ effect.echo.chk = chk_echo; effect.echo.hs_echo_delay = hs_echo_delay; effect.echo.hs_echo_feedback = hs_echo_feedback; effect.echo.hs_echo_wet = hs_echo_wet; /* stereo enhance widgets */ effect.stereo.chk = chk_stereo; effect.stereo.hs_stereo_level = hs_stereo_level; /* voice removal widgets */ effect.voice.chk = chk_voice; /* normalizer widgets */ effect.normal.chk = chk_normal; effect.normal.sp_normal_buckets = sp_normal_buckets; effect.normal.hs_normal_target = hs_normal_target; effect.normal.hs_normal_gainmax = hs_normal_gainmax; effect.normal.hs_normal_gainsmooth = hs_normal_gainsmooth; /* equalizer widgets */ effect.eq.chk = chk_eq; effect.eq.chk_auto = chk_auto; for (i = 0; i < 10; i++) { effect.eq.vs_eq[i] = vs_eq[i]; } gtk_widget_show(effect_dialog); }
GtkWidget * org_gnome_activesync_server_url(EPlugin *epl, EConfigHookItemFactoryData *data) { EMConfigTargetSettings *target_account; const gchar *source_url; gchar *server_url = NULL, *username, *key; const char *address; GtkWidget *url_entry, *username_entry; gint row; GtkWidget *hbox, *label, *button; GConfClient *client = gconf_client_get_default(); EasEmailHandler* handler; GError *error = NULL; CamelSettings *settings; CamelEasSettings *eas_settings; CamelNetworkSettings *network_settings; target_account = (EMConfigTargetSettings *)data->config->target; settings = target_account->storage_settings; if (!CAMEL_IS_EAS_SETTINGS (settings)) { if (data->old && (label = g_object_get_data((GObject *)data->old, "authenticate-label"))) gtk_widget_destroy(label); return NULL; } if (data->old) { return data->old; } eas_settings = CAMEL_EAS_SETTINGS (settings); network_settings = CAMEL_NETWORK_SETTINGS (settings); address = target_account->email_address; key = g_strdup_printf ("/apps/activesyncd/accounts/%s/username", address); username = gconf_client_get_string (client, key, NULL); if (!username || !*username) { gconf_client_set_string (client, key, address, NULL); username = g_strdup (address); } g_free (key); key = g_strdup_printf ("/apps/activesyncd/accounts/%s/serverUri", address); server_url = gconf_client_get_string (client, key, NULL); g_object_unref (client); g_free (key); g_object_get (data->parent, "n-rows", &row, NULL); label = gtk_label_new_with_mnemonic (_("User_name:")); gtk_widget_show (label); username_entry = gtk_entry_new (); gtk_widget_show (username_entry); if (username) gtk_entry_set_text (GTK_ENTRY (username_entry), username); gtk_label_set_mnemonic_widget (GTK_LABEL (label), username_entry); g_signal_connect (username_entry, "changed", G_CALLBACK (username_entry_changed), data->config); gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0); gtk_table_attach (GTK_TABLE (data->parent), username_entry, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); row++; hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new_with_mnemonic(_("_Server URL:")); gtk_widget_show(label); url_entry = gtk_entry_new(); gtk_label_set_mnemonic_widget((GtkLabel *)label, url_entry); button = gtk_button_new_with_mnemonic (_("_Auto Detect")); gtk_box_pack_start (GTK_BOX (hbox), url_entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show_all(hbox); gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0); gtk_table_attach (GTK_TABLE (data->parent), hbox, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); g_signal_connect (url_entry, "changed", G_CALLBACK(url_entry_changed), data->config); if (server_url) gtk_entry_set_text(GTK_ENTRY (url_entry), server_url); g_object_set_data ((GObject *)button, "url-entry", (gpointer) url_entry); g_signal_connect (button, "clicked", G_CALLBACK(discover_server_url), data->config); g_free (server_url); g_free (username); return hbox; }
GtkWidget* create_dialog1 (void) { GtkWidget *dialog1; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *frame1; GtkWidget *table1; GtkWidget *buttonSelect; GtkWidget *labelVobsub; GtkWidget *label4; GtkWidget *optionmenu1; GtkWidget *label2; GtkWidget *frame2; GtkWidget *table2; GtkWidget *label6; GtkObject *spinbutton1_adj; GtkWidget *spinbutton1; GtkWidget *label7; GtkWidget *entryShift; GtkWidget *label5; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; dialog1 = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("VobSub Settings")); dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; gtk_widget_show (dialog_vbox1); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); frame1 = gtk_frame_new (NULL); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0); table1 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (frame1), table1); buttonSelect = gtk_button_new_with_mnemonic (QT_TR_NOOP("Select .idx")); gtk_widget_show (buttonSelect); gtk_table_attach (GTK_TABLE (table1), buttonSelect, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); labelVobsub = gtk_label_new (QT_TR_NOOP("None")); gtk_widget_show (labelVobsub); gtk_table_attach (GTK_TABLE (table1), labelVobsub, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (labelVobsub), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (labelVobsub), 0, 0.5); label4 = gtk_label_new (QT_TR_NOOP("Select Language :")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); optionmenu1 = gtk_option_menu_new (); gtk_widget_show (optionmenu1); gtk_table_attach (GTK_TABLE (table1), optionmenu1, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); label2 = gtk_label_new (QT_TR_NOOP("Select Sub")); gtk_widget_show (label2); gtk_frame_set_label_widget (GTK_FRAME (frame1), label2); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); frame2 = gtk_frame_new (NULL); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0); table2 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame2), table2); label6 = gtk_label_new (QT_TR_NOOP("Extra Shrink Factor :")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); spinbutton1_adj = gtk_adjustment_new (1, 1, 2, 0.1, 0.2, 0.2); spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0); gtk_widget_show (spinbutton1); gtk_table_attach (GTK_TABLE (table2), spinbutton1, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label7 = gtk_label_new (QT_TR_NOOP("Shift (ms) :")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); entryShift = gtk_entry_new (); gtk_widget_show (entryShift); gtk_table_attach (GTK_TABLE (table2), entryShift, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); label5 = gtk_label_new (QT_TR_NOOP("Extra Settings")); gtk_widget_show (label5); gtk_frame_set_label_widget (GTK_FRAME (frame2), label5); gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); okbutton1 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (dialog1, frame1, "frame1"); GLADE_HOOKUP_OBJECT (dialog1, table1, "table1"); GLADE_HOOKUP_OBJECT (dialog1, buttonSelect, "buttonSelect"); GLADE_HOOKUP_OBJECT (dialog1, labelVobsub, "labelVobsub"); GLADE_HOOKUP_OBJECT (dialog1, label4, "label4"); GLADE_HOOKUP_OBJECT (dialog1, optionmenu1, "optionmenu1"); GLADE_HOOKUP_OBJECT (dialog1, label2, "label2"); GLADE_HOOKUP_OBJECT (dialog1, frame2, "frame2"); GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1"); GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); GLADE_HOOKUP_OBJECT (dialog1, entryShift, "entryShift"); GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); return dialog1; }
/* create the "add" dialog. */ void add_folder_cb (GtkWidget *widget, void *callback_data) { GtkWidget *file_sel; DialogData *data; GtkWidget *main_box; GtkWidget *vbox; GtkWidget *table; GtkWidget *align; data = g_new0 (DialogData, 1); data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD); data->window = callback_data; data->dialog = file_sel = gtk_file_chooser_dialog_new (_("Add a Folder"), GTK_WINDOW (data->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, FR_STOCK_ADD_FOLDER, GTK_RESPONSE_OK, GTK_STOCK_HELP, GTK_RESPONSE_HELP, NULL); gtk_window_set_default_size (GTK_WINDOW (data->dialog), 530, 510); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (file_sel), FALSE); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_sel), FALSE); gtk_dialog_set_default_response (GTK_DIALOG (file_sel), GTK_RESPONSE_OK); data->add_if_newer_checkbutton = gtk_check_button_new_with_mnemonic (_("Add only if _newer")); data->include_subfold_checkbutton = gtk_check_button_new_with_mnemonic (_("_Include subfolders")); data->exclude_symlinks = gtk_check_button_new_with_mnemonic (_("Exclude folders that are symbolic lin_ks")); data->include_files_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (data->include_files_entry, _("example: *.o; *.bak")); data->include_files_label = gtk_label_new_with_mnemonic (_("Include _files:")); gtk_misc_set_alignment (GTK_MISC (data->include_files_label), 0.0, 0.5); gtk_label_set_mnemonic_widget (GTK_LABEL (data->include_files_label), data->include_files_entry); data->exclude_files_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (data->exclude_files_entry, _("example: *.o; *.bak")); data->exclude_files_label = gtk_label_new_with_mnemonic (_("E_xclude files:")); gtk_misc_set_alignment (GTK_MISC (data->exclude_files_label), 0.0, 0.5); gtk_label_set_mnemonic_widget (GTK_LABEL (data->exclude_files_label), data->exclude_files_entry); data->exclude_folders_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (data->exclude_folders_entry, _("example: *.o; *.bak")); data->exclude_folders_label = gtk_label_new_with_mnemonic (_("_Exclude folders:")); gtk_misc_set_alignment (GTK_MISC (data->exclude_folders_label), 0.0, 0.5); gtk_label_set_mnemonic_widget (GTK_LABEL (data->exclude_folders_label), data->exclude_folders_entry); data->load_button = gtk_button_new_with_mnemonic (_("_Load Options")); data->save_button = gtk_button_new_with_mnemonic (_("Sa_ve Options")); data->clear_button = gtk_button_new_with_mnemonic (_("_Reset Options")); main_box = gtk_hbox_new (FALSE, 20); gtk_container_set_border_width (GTK_CONTAINER (main_box), 0); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (file_sel), main_box); vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); gtk_box_pack_start (GTK_BOX (main_box), vbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), data->include_subfold_checkbutton, TRUE, TRUE, 0); align = gtk_alignment_new (0, 0, 0, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0); gtk_container_add (GTK_CONTAINER (align), data->exclude_symlinks); gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), data->add_if_newer_checkbutton, TRUE, TRUE, 0); table = gtk_table_new (2, 4, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_table_attach (GTK_TABLE (table), data->include_files_label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), data->include_files_entry, 1, 4, 0, 1, GTK_FILL|GTK_EXPAND, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), data->exclude_files_label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), data->exclude_files_entry, 1, 2, 1, 2, GTK_FILL|GTK_EXPAND, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), data->exclude_folders_label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), data->exclude_folders_entry, 3, 4, 1, 2, GTK_FILL|GTK_EXPAND, 0, 0, 0); /**/ vbox = gtk_vbox_new (FALSE, 5); gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), data->load_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), data->save_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), data->clear_button, FALSE, FALSE, 0); gtk_widget_show_all (main_box); /* set data */ dlg_add_folder_load_last_options (data); /* signals */ g_signal_connect (G_OBJECT (file_sel), "destroy", G_CALLBACK (open_file_destroy_cb), data); g_signal_connect (G_OBJECT (file_sel), "response", G_CALLBACK (file_sel_response_cb), data); g_signal_connect (G_OBJECT (data->include_subfold_checkbutton), "toggled", G_CALLBACK (include_subfold_toggled_cb), data); g_signal_connect (G_OBJECT (data->load_button), "clicked", G_CALLBACK (load_options_cb), data); g_signal_connect (G_OBJECT (data->save_button), "clicked", G_CALLBACK (save_options_cb), data); g_signal_connect (G_OBJECT (data->clear_button), "clicked", G_CALLBACK (clear_options_cb), data); gtk_window_set_modal (GTK_WINDOW (file_sel),TRUE); gtk_widget_show (file_sel); }
/** * thunar_dialogs_show_job_ask: * @parent : the parent #GtkWindow or %NULL. * @question : the question text. * @choices : possible responses. * * Utility function to display a question dialog for the ThunarJob::ask * signal. * * Return value: the #ThunarJobResponse. **/ ThunarJobResponse thunar_dialogs_show_job_ask (GtkWindow *parent, const gchar *question, ThunarJobResponse choices) { const gchar *separator; const gchar *mnemonic; GtkWidget *message; GtkWidget *button; GString *secondary = g_string_sized_new (256); GString *primary = g_string_sized_new (256); gint response; gint n; gboolean has_cancel = FALSE; _thunar_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), THUNAR_JOB_RESPONSE_CANCEL); _thunar_return_val_if_fail (g_utf8_validate (question, -1, NULL), THUNAR_JOB_RESPONSE_CANCEL); /* try to separate the question into primary and secondary parts */ separator = strstr (question, ": "); if (G_LIKELY (separator != NULL)) { /* primary is everything before the colon, plus a dot */ g_string_append_len (primary, question, separator - question); g_string_append_c (primary, '.'); /* secondary is everything after the colon (skipping whitespace) */ do ++separator; while (g_ascii_isspace (*separator)); g_string_append (secondary, separator); } else { /* otherwise separate based on the \n\n */ separator = strstr (question, "\n\n"); if (G_LIKELY (separator != NULL)) { /* primary is everything before the newlines */ g_string_append_len (primary, question, separator - question); /* secondary is everything after the newlines (skipping whitespace) */ while (g_ascii_isspace (*separator)) ++separator; g_string_append (secondary, separator); } else { /* everything is primary */ g_string_append (primary, question); } } /* allocate the question message dialog */ message = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", primary->str); if (G_LIKELY (*secondary->str != '\0')) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", secondary->str); /* add the buttons based on the possible choices */ for (n = 6; n >= 0; --n) { /* check if the response is set */ response = choices & (1 << n); if (response == 0) continue; switch (response) { case THUNAR_JOB_RESPONSE_YES: mnemonic = _("_Yes"); break; case THUNAR_JOB_RESPONSE_YES_ALL: mnemonic = _("Yes to _all"); break; case THUNAR_JOB_RESPONSE_NO: mnemonic = _("_No"); break; case THUNAR_JOB_RESPONSE_NO_ALL: mnemonic = _("N_o to all"); break; case THUNAR_JOB_RESPONSE_RETRY: mnemonic = _("_Retry"); break; case THUNAR_JOB_RESPONSE_FORCE: mnemonic = _("Copy _Anyway"); break; case THUNAR_JOB_RESPONSE_CANCEL: /* cancel is always the last option */ has_cancel = TRUE; continue; default: g_assert_not_reached (); break; } button = gtk_button_new_with_mnemonic (mnemonic); gtk_widget_set_can_default (button, TRUE); gtk_dialog_add_action_widget (GTK_DIALOG (message), button, response); gtk_widget_show (button); gtk_dialog_set_default_response (GTK_DIALOG (message), response); } if (has_cancel) { button = gtk_button_new_with_mnemonic (_("_Cancel")); gtk_widget_set_can_default (button, TRUE); gtk_dialog_add_action_widget (GTK_DIALOG (message), button, GTK_RESPONSE_CANCEL); gtk_widget_show (button); gtk_dialog_set_default_response (GTK_DIALOG (message), GTK_RESPONSE_CANCEL); } /* run the question dialog */ response = gtk_dialog_run (GTK_DIALOG (message)); gtk_widget_destroy (message); /* transform the result as required */ if (G_UNLIKELY (response <= 0)) response = THUNAR_JOB_RESPONSE_CANCEL; /* cleanup */ g_string_free (secondary, TRUE); g_string_free (primary, TRUE); return response; }
GtkWidget* sheet_style_dialog_new(ForceQuitDialog* main_dialog, Window parent_xid, long parent_pid) { auto* self = GTK_WIDGET(g_object_new(sheet_style_dialog_get_type(), nullptr)); gtk_orientable_set_orientation(GTK_ORIENTABLE(self), GTK_ORIENTATION_VERTICAL); glib::Object<GtkCssProvider> style(gtk_css_provider_new()); auto const& deco_style = decoration::Style::Get(); auto const& radius = deco_style->CornerRadius(); auto const& offset = deco_style->ShadowOffset(); auto const& color = deco_style->ActiveShadowColor(); auto const& backcolor = deco_style->InactiveShadowColor(); int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom}); gtk_css_provider_load_from_data(style, (R"( SheetStyleDialog { background-color: #f7f6f5; color: #4a4a4a; border-radius: )"+std::to_string(decoration_radius)+R"(px; box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+ std::to_string(deco_style->ActiveShadowRadius())+"px "+ "rgba("+std::to_string(int(color.red * 255.0))+", "+ std::to_string(int(color.green * 255.0))+", "+ std::to_string(int(color.blue * 255.0))+", "+ std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(; } SheetStyleDialog:backdrop { background-color: shade(#f7f6f5, 1.2); color: shade(#4a4a4a, 1.5); border-radius: )"+std::to_string(decoration_radius)+R"(px; box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+ std::to_string(deco_style->InactiveShadowRadius())+"px "+ "rgba("+std::to_string(int(backcolor.red * 255.0))+", "+ std::to_string(int(backcolor.green * 255.0))+", "+ std::to_string(int(backcolor.blue * 255.0))+", "+ std::to_string(int(backcolor.alpha))+'.'+std::to_string(int(backcolor.alpha*10000.0))+')'+R"(; })").c_str(), -1, nullptr); auto* style_ctx = gtk_widget_get_style_context(self); gtk_style_context_add_provider(style_ctx, glib::object_cast<GtkStyleProvider>(style), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); gtk_style_context_add_class(style_ctx, "unity-force-quit"); auto* main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_set_border_width(GTK_CONTAINER(main_box), 4); auto *close_button = close_button_new(); g_signal_connect(close_button, "clicked", G_CALLBACK(on_wait_clicked), main_dialog); gtk_box_pack_start(GTK_BOX(main_box), close_button, TRUE, TRUE, 0); auto* content_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_set_border_width(GTK_CONTAINER(content_box), 10); #if GTK_CHECK_VERSION(3, 11, 0) gtk_widget_set_margin_start(content_box, 20); gtk_widget_set_margin_end(content_box, 20); #else gtk_widget_set_margin_left(content_box, 20); gtk_widget_set_margin_right(content_box, 20); #endif gtk_container_add(GTK_CONTAINER(main_box), content_box); auto* title = gtk_label_new(_("This window is not responding")); auto* font_desc = pango_font_description_from_string("Ubuntu 17"); gtk_widget_override_font(title, font_desc); pango_font_description_free(font_desc); gtk_widget_set_halign(title, GTK_ALIGN_START); gtk_box_pack_start(GTK_BOX(content_box), title, FALSE, FALSE, 0); auto* subtitle = gtk_label_new(_("Do you want to force the application to exit, or wait for it to respond?")); gtk_widget_set_halign(title, GTK_ALIGN_START); gtk_box_pack_start(GTK_BOX(content_box), subtitle, FALSE, FALSE, 0); auto* buttons_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_set_spacing(GTK_BOX(buttons_box), 15); gtk_container_set_border_width(GTK_CONTAINER(buttons_box), 5); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons_box), GTK_BUTTONBOX_END); auto* wait_button = gtk_button_new_with_mnemonic(_("_Wait")); gtk_container_add(GTK_CONTAINER(buttons_box), wait_button); g_signal_connect(wait_button, "clicked", G_CALLBACK(on_wait_clicked), main_dialog); auto *kill_data = g_new(gint64, 2); kill_data[0] = parent_xid; kill_data[1] = parent_pid; auto* quit_button = gtk_button_new_with_mnemonic(_("_Force Quit")); gtk_container_add(GTK_CONTAINER(buttons_box), quit_button); g_signal_connect_data(quit_button, "clicked", G_CALLBACK(on_force_quit_clicked), kill_data, [] (gpointer data, GClosure*) { g_free(data); }, static_cast<GConnectFlags>(0)); // FIXME Look at moving to non deprecated functions G_GNUC_BEGIN_IGNORE_DEPRECATIONS auto* buttons_aligment = gtk_alignment_new(1, 1, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(buttons_aligment), 20, 0, 0, 0); gtk_container_add(GTK_CONTAINER(buttons_aligment), buttons_box); gtk_container_add(GTK_CONTAINER(content_box), buttons_aligment); G_GNUC_END_IGNORE_DEPRECATIONS gtk_container_add(GTK_CONTAINER(self), main_box); return self; }
GtkWidget * do_dialog (GtkWidget *do_widget) { GtkWidget *frame; GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *hbox; GtkWidget *button; GtkWidget *table; GtkWidget *label; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Dialogs"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_container_set_border_width (GTK_CONTAINER (window), 8); frame = gtk_frame_new ("Dialogs"); gtk_container_add (GTK_CONTAINER (window), frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_container_add (GTK_CONTAINER (frame), vbox); /* Standard message dialog */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_mnemonic ("_Message Dialog"); g_signal_connect (button, "clicked", G_CALLBACK (message_dialog_clicked), NULL); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0); /* Interactive dialog*/ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); button = gtk_button_new_with_mnemonic ("_Interactive Dialog"); g_signal_connect (button, "clicked", G_CALLBACK (interactive_dialog_clicked), NULL); gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); table = gtk_table_new (2, 2, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_set_col_spacings (GTK_TABLE (table), 4); gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic ("_Entry 1"); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); entry1 = gtk_entry_new (); gtk_table_attach_defaults (GTK_TABLE (table), entry1, 1, 2, 0, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry1); label = gtk_label_new_with_mnemonic ("E_ntry 2"); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); entry2 = gtk_entry_new (); gtk_table_attach_defaults (GTK_TABLE (table), entry2, 1, 2, 1, 2); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry2); } if (!gtk_widget_get_visible (window)) { gtk_widget_show_all (window); } else { gtk_widget_destroy (window); window = NULL; } return window; }
GtkWidget* create_shellexec_conf_dialog (void) { GtkWidget *shellexec_conf_dialog; GtkWidget *dialog_vbox; GtkWidget *hbox1; GtkWidget *add_button; GtkWidget *remove_button; GtkWidget *edit_button; GtkWidget *scrolledwindow; GtkWidget *command_treeview; GtkWidget *dialog_action_area; GtkWidget *save_button; shellexec_conf_dialog = gtk_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (shellexec_conf_dialog), 12); gtk_window_set_title (GTK_WINDOW (shellexec_conf_dialog), _("Custom Shell Commands")); gtk_window_set_type_hint (GTK_WINDOW (shellexec_conf_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (shellexec_conf_dialog), FALSE); dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (shellexec_conf_dialog)); gtk_widget_show (dialog_vbox); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox1, FALSE, TRUE, 0); add_button = gtk_button_new_with_mnemonic (_("Add")); gtk_widget_show (add_button); gtk_box_pack_start (GTK_BOX (hbox1), add_button, TRUE, TRUE, 0); remove_button = gtk_button_new_with_mnemonic (_("Remove")); gtk_widget_show (remove_button); gtk_box_pack_start (GTK_BOX (hbox1), remove_button, TRUE, TRUE, 0); edit_button = gtk_button_new_with_mnemonic (_("Edit")); gtk_widget_show (edit_button); gtk_box_pack_start (GTK_BOX (hbox1), edit_button, TRUE, TRUE, 0); scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow); gtk_box_pack_end (GTK_BOX (dialog_vbox), scrolledwindow, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN); command_treeview = gtk_tree_view_new (); gtk_widget_show (command_treeview); gtk_container_add (GTK_CONTAINER (scrolledwindow), command_treeview); dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (shellexec_conf_dialog)); gtk_widget_show (dialog_action_area); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area), GTK_BUTTONBOX_END); save_button = gtk_button_new_with_mnemonic (_("Close")); gtk_widget_show (save_button); gtk_dialog_add_action_widget (GTK_DIALOG (shellexec_conf_dialog), save_button, 0); gtk_widget_set_can_default(save_button, TRUE); g_signal_connect ((gpointer) add_button, "clicked", G_CALLBACK (on_add_button_clicked), NULL); g_signal_connect ((gpointer) remove_button, "clicked", G_CALLBACK (on_remove_button_clicked), NULL); g_signal_connect ((gpointer) edit_button, "clicked", G_CALLBACK (on_edit_button_clicked), NULL); g_signal_connect ((gpointer) save_button, "clicked", G_CALLBACK (on_save_button_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, shellexec_conf_dialog, "shellexec_conf_dialog"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, dialog_vbox, "dialog_vbox"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, add_button, "add_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, remove_button, "remove_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, edit_button, "edit_button"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, scrolledwindow, "scrolledwindow"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, command_treeview, "command_treeview"); GLADE_HOOKUP_OBJECT_NO_REF (shellexec_conf_dialog, dialog_action_area, "dialog_action_area"); GLADE_HOOKUP_OBJECT (shellexec_conf_dialog, save_button, "save_button"); return shellexec_conf_dialog; }
GtkWidget * offset_dialog_new (GimpDrawable *drawable, GimpContext *context, GtkWidget *parent) { GimpItem *item; OffsetDialog *dialog; GtkWidget *main_vbox; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *spinbutton; GtkWidget *frame; GtkWidget *radio_button; GtkAdjustment *adjustment; gdouble xres; gdouble yres; const gchar *title = NULL; g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); dialog = g_slice_new0 (OffsetDialog); dialog->context = context; dialog->fill_type = gimp_drawable_has_alpha (drawable) | WRAP_AROUND; item = GIMP_ITEM (drawable); dialog->image = gimp_item_get_image (item); gimp_image_get_resolution (dialog->image, &xres, &yres); if (GIMP_IS_LAYER (drawable)) title = _("Offset Layer"); else if (GIMP_IS_LAYER_MASK (drawable)) title = _("Offset Layer Mask"); else if (GIMP_IS_CHANNEL (drawable)) title = _("Offset Channel"); else g_warning ("%s: unexpected drawable type", G_STRFUNC); dialog->dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), context, _("Offset"), "gimp-drawable-offset", GIMP_STOCK_TOOL_MOVE, title, parent, gimp_standard_help_func, GIMP_HELP_LAYER_OFFSET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, /* offset, used as a verb */ _("_Offset"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog->dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE); g_object_weak_ref (G_OBJECT (dialog->dialog), (GWeakNotify) offset_dialog_free, dialog); g_signal_connect (dialog->dialog, "response", G_CALLBACK (offset_response), dialog); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); /* The offset frame */ frame = gimp_frame_new (_("Offset")); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); adjustment = (GtkAdjustment *) gtk_adjustment_new (1, 1, 1, 1, 10, 0); spinbutton = gtk_spin_button_new (adjustment, 1.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10); dialog->off_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a", TRUE, TRUE, FALSE, 10, GIMP_SIZE_ENTRY_UPDATE_SIZE); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 1, 4); gtk_table_set_row_spacing (GTK_TABLE (dialog->off_se), 0, 2); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (dialog->off_se), GTK_SPIN_BUTTON (spinbutton), NULL); gtk_table_attach_defaults (GTK_TABLE (dialog->off_se), spinbutton, 1, 2, 0, 1); gtk_widget_show (spinbutton); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se), _("_X:"), 0, 0, 0.0); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se), _("_Y:"), 1, 0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), dialog->off_se, FALSE, FALSE, 0); gtk_widget_show (dialog->off_se); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (dialog->off_se), GIMP_UNIT_PIXEL); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 0, xres, FALSE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 1, yres, FALSE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 0, - gimp_item_get_width (item), gimp_item_get_width (item)); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 1, - gimp_item_get_height (item), gimp_item_get_height (item)); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 0, 0, gimp_item_get_width (item)); gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 1, 0, gimp_item_get_height (item)); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 0, 0); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 1, 0); button = gtk_button_new_with_mnemonic (_("By width/_2, height/2")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_xy_callback), dialog); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); button = gtk_button_new_with_mnemonic ("By _width/2"); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_x_callback), dialog); button = gtk_button_new_with_mnemonic ("By _height/2"); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); g_signal_connect (button, "clicked", G_CALLBACK (offset_half_y_callback), dialog); /* The edge behavior frame */ frame = gimp_int_radio_group_new (TRUE, _("Edge Behavior"), G_CALLBACK (gimp_radio_button_update), &dialog->fill_type, dialog->fill_type, _("W_rap around"), WRAP_AROUND, NULL, _("Fill with _background color"), GIMP_OFFSET_BACKGROUND, NULL, _("Make _transparent"), GIMP_OFFSET_TRANSPARENT, &radio_button, NULL); if (! gimp_drawable_has_alpha (drawable)) gtk_widget_set_sensitive (radio_button, FALSE); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); return dialog->dialog; }