GtkWidget * gimp_buffer_view_new (GimpViewType view_type, GimpContainer *container, GimpContext *context, gint view_size, gint view_border_width, GimpMenuFactory *menu_factory) { GimpBufferView *buffer_view; GimpContainerEditor *editor; GtkWidget *frame; GtkWidget *hbox; buffer_view = g_object_new (GIMP_TYPE_BUFFER_VIEW, NULL); if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view), view_type, container, context, view_size, view_border_width, menu_factory, "<Buffers>", "/buffers-popup")) { g_object_unref (buffer_view); return NULL; } editor = GIMP_CONTAINER_EDITOR (buffer_view); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (editor), frame, 0); gtk_widget_show (frame); hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); buffer_view->global_view = gimp_view_new_full_by_types (NULL, GIMP_TYPE_VIEW, GIMP_TYPE_BUFFER, view_size, view_size, view_border_width, FALSE, FALSE, TRUE); gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_view, FALSE, FALSE, 0); gtk_widget_show (buffer_view->global_view); g_signal_connect_object (editor->view, "notify::view-size", G_CALLBACK (gimp_buffer_view_view_notify), buffer_view, 0); g_signal_connect_object (editor->view, "notify::view-border-width", G_CALLBACK (gimp_buffer_view_view_notify), buffer_view, 0); buffer_view->global_label = gtk_label_new (_("(None)")); gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_label, FALSE, FALSE, 0); gtk_widget_show (buffer_view->global_label); g_signal_connect_object (context->gimp, "buffer-changed", G_CALLBACK (gimp_buffer_view_buffer_changed), G_OBJECT (buffer_view), 0); gimp_buffer_view_buffer_changed (context->gimp, buffer_view); buffer_view->paste_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste", NULL); buffer_view->paste_into_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste-into", NULL); buffer_view->paste_as_new_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-paste-as-new", NULL); buffer_view->delete_button = gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers", "buffers-delete", NULL); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_into_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->paste_as_new_button), GIMP_TYPE_BUFFER); gimp_container_view_enable_dnd (editor->view, GTK_BUTTON (buffer_view->delete_button), GIMP_TYPE_BUFFER); gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)), editor); return GTK_WIDGET (buffer_view); }
static void editor_window_new(const gchar *src_path, const gchar *desktop_name) { EditorWindow *ew; GtkWidget *win_vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *ct_button; GtkWidget *button_hbox; GtkWidget *scrolled; GtkWidget *text_view; gchar *text; gsize size; ew = g_new0(EditorWindow, 1); ew->window = window_new(GTK_WINDOW_TOPLEVEL, "Desktop", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Desktop file")); gtk_window_set_type_hint(GTK_WINDOW(ew->window), GDK_WINDOW_TYPE_HINT_DIALOG); g_signal_connect(G_OBJECT(ew->window), "delete_event", G_CALLBACK(editor_window_delete_cb), ew); gtk_window_set_default_size(GTK_WINDOW(ew->window), CONFIG_WINDOW_DEF_WIDTH, CONFIG_WINDOW_DEF_HEIGHT); gtk_window_set_resizable(GTK_WINDOW(ew->window), TRUE); gtk_container_set_border_width(GTK_CONTAINER(ew->window), PREF_PAD_BORDER); win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); gtk_container_add(GTK_CONTAINER(ew->window), win_vbox); gtk_widget_show(win_vbox); hbox = gtk_hbox_new(FALSE, PREF_PAD_SPACE); gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); ew->entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), ew->entry, TRUE, TRUE, 0); ew->desktop_name = NULL; if (desktop_name) { gtk_entry_set_text(GTK_ENTRY(ew->entry), desktop_name); ew->desktop_name = g_strdup(desktop_name); } gtk_widget_show(ew->entry); g_signal_connect(G_OBJECT(ew->entry), "changed", G_CALLBACK(editor_window_entry_changed_cb), ew); button_hbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(button_hbox), GTK_BUTTONBOX_END); gtk_box_set_spacing(GTK_BOX(button_hbox), PREF_PAD_BUTTON_GAP); gtk_box_pack_end(GTK_BOX(hbox), button_hbox, FALSE, FALSE, 0); gtk_widget_show(button_hbox); ew->save_button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE, G_CALLBACK(editor_window_save_cb), ew); gtk_container_add(GTK_CONTAINER(button_hbox), ew->save_button); GTK_WIDGET_SET_FLAGS(ew->save_button, GTK_CAN_DEFAULT); gtk_widget_set_sensitive(ew->save_button, FALSE); gtk_widget_show(ew->save_button); ct_button = ew->save_button; button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE, G_CALLBACK(editor_window_close_cb), ew); gtk_container_add(GTK_CONTAINER(button_hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show(button); if (!generic_dialog_get_alternative_button_order(ew->window)) { gtk_box_reorder_child(GTK_BOX(button_hbox), ct_button, -1); } scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(win_vbox), scrolled, TRUE, TRUE, 5); gtk_widget_show(scrolled); text_view = gtk_text_view_new(); gtk_container_add(GTK_CONTAINER(scrolled), text_view); gtk_widget_show(text_view); ew->buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view)); if (g_file_get_contents(src_path, &text, &size, NULL)) { gtk_text_buffer_set_text(ew->buffer, text, size); } gtk_text_buffer_set_modified(ew->buffer, FALSE); g_signal_connect(G_OBJECT(ew->buffer), "modified-changed", G_CALLBACK(editor_window_text_modified_cb), ew); gtk_widget_show(ew->window); }
static void lcrt_serial_show(struct lcrt_qconnect *lqconnect) { GtkWidget *vbox; GtkWidget *vbox_spec; GtkWidget *hbox1; GtkWidget *label_port; GtkWidget *combobox_port; GtkWidget *label_baud_rate; GtkWidget *combobox_baud_rate; GtkWidget *label_data_bits; GtkWidget *combobox_data_bits; GtkWidget *label_parity; GtkWidget *combobox_parity; GtkWidget *label_stop_bits; GtkWidget *combobox_stop_bits; GtkWidget *frame; GtkWidget *alignment; GtkWidget *hbox_frame; GtkWidget *checkbutton_software; GtkWidget *checkbutton_hardware; GtkWidget *label_flow_control; int i; const char *sport[LCRT_SERIAL_PORT_NUMBER] = {LCRT_SERIAL_PORT}; const struct lcrt_serial_map sbaud_rate[LCRT_SERIAL_BAUD_RATE_NUMBER] = {LCRT_SERIAL_BAUD_RATE_TABLE}; const struct lcrt_serial_map sdata_bits[LCRT_SERIAL_DATA_BITS_NUMBER] = {LCRT_SERIAL_DATA_BITS_TABLE}; const struct lcrt_serial_map sparity[LCRT_SERIAL_PARITY_NUMBER] = {LCRT_SERIAL_PARITY_TABLE}; const struct lcrt_serial_map sstop_bits[LCRT_SERIAL_STOP_BITS_NUMBER] = {LCRT_SERIAL_STOP_BITS_TABLE}; const struct lcrt_serial_map flow_control[LCRT_SEROAL_FLOW_CONTROL_NUMBER] = {LCRT_SEROAL_FLOW_CONTROL_TABLE}; static struct lcrt_serial_if slserial, *lserial = &slserial; struct lcrtc_user *user = NULL; char s_port[USERNAME_LEN]; boolean f_option = FALSE; int s_baud_rate,s_databit,s_parity,s_stopbit,s_software,s_hardware; if (lqconnect->flag == LCRT_QCONNECT_SESSION_OPTION && (user = lcrt_user_find_by_name(&lqconnect->parent->u_config, lqconnect->uname)) != NULL) { sscanf(user->password, "%s %d %d %d %d %d %d", s_port, &s_baud_rate, &s_databit, &s_parity, &s_stopbit, &s_software, &s_hardware); debug_print("SERIAL PORT: %s %d %d %d %d %d %d\n", s_port, s_baud_rate, s_databit, s_parity, s_stopbit, s_software, s_hardware); f_option = TRUE; } memset(lserial, 0, sizeof(struct lcrt_serial_if)); lqconnect->private_data = lserial; vbox = GTK_DIALOG (lqconnect->q_connect)->vbox; debug_where(); vbox_spec = gtk_vbox_new (FALSE, 0); lqconnect->q_vbox_spec = vbox_spec; gtk_widget_show (vbox_spec); gtk_box_pack_start (GTK_BOX (vbox), vbox_spec, TRUE, TRUE, 0); gtk_box_reorder_child (GTK_BOX (vbox), vbox_spec, 1); gtk_widget_set_size_request (vbox_spec, -1, 210); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_spec), hbox1, TRUE, TRUE, 0); gtk_widget_set_size_request (hbox1, -1, 25); label_port = gtk_label_new (lqconnect->config.value[LCRT_Q_SPORT]); gtk_widget_show (label_port); gtk_box_pack_start (GTK_BOX (hbox1), label_port, FALSE, FALSE, 0); gtk_widget_set_size_request (label_port, 90, 25); gtk_misc_set_alignment (GTK_MISC (label_port), 0, 0.5); combobox_port = gtk_combo_box_entry_new_text (); lserial->port = combobox_port; gtk_widget_show (combobox_port); gtk_box_pack_start (GTK_BOX (hbox1), combobox_port, FALSE, TRUE, 0); gtk_widget_set_size_request (combobox_port, SERIAL_COMBOBOX_WIDTH, 25); for (i = 0; i < LCRT_SERIAL_PORT_NUMBER; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox_port), sport[i]); if (f_option && strcmp(s_port, sport[i]) == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_port), i); } debug_where(); //gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(combobox_port)->child), FALSE); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_spec), hbox1, TRUE, TRUE, 0); gtk_widget_set_size_request (hbox1, -1, 25); label_baud_rate = gtk_label_new (lqconnect->config.value[LCRT_Q_SBAUD_RATE]); gtk_widget_show (label_baud_rate); gtk_box_pack_start (GTK_BOX (hbox1), label_baud_rate, FALSE, FALSE, 0); gtk_widget_set_size_request (label_baud_rate, 90, 25); gtk_misc_set_alignment (GTK_MISC (label_baud_rate), 0, 0.5); combobox_baud_rate = gtk_combo_box_entry_new_text (); lserial->baud_rate = combobox_baud_rate; gtk_widget_show (combobox_baud_rate); gtk_box_pack_start (GTK_BOX (hbox1), combobox_baud_rate, FALSE, TRUE, 0); gtk_widget_set_size_request (combobox_baud_rate, SERIAL_COMBOBOX_WIDTH, 25); for (i = 0; i < LCRT_SERIAL_BAUD_RATE_NUMBER; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox_baud_rate), sbaud_rate[i].name); if (f_option && s_baud_rate == sbaud_rate[i].data) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_baud_rate), i); } debug_where(); gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(combobox_baud_rate)->child), FALSE); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_spec), hbox1, TRUE, TRUE, 0); gtk_widget_set_size_request (hbox1, -1, 25); label_data_bits = gtk_label_new (lqconnect->config.value[LCRT_Q_SDATA_BITS]); gtk_widget_show (label_data_bits); gtk_box_pack_start (GTK_BOX (hbox1), label_data_bits, FALSE, FALSE, 0); gtk_widget_set_size_request (label_data_bits, 90, 25); gtk_misc_set_alignment (GTK_MISC (label_data_bits), 0, 0.5); combobox_data_bits = gtk_combo_box_entry_new_text (); lserial->data_bits = combobox_data_bits; gtk_widget_show (combobox_data_bits); gtk_box_pack_start (GTK_BOX (hbox1), combobox_data_bits, FALSE, TRUE, 0); gtk_widget_set_size_request (combobox_data_bits, SERIAL_COMBOBOX_WIDTH, 25); for (i = 0; i < LCRT_SERIAL_DATA_BITS_NUMBER; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox_data_bits), sdata_bits[i].name); if (f_option && s_databit == sdata_bits[i].data) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_data_bits), i); } debug_where(); gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(combobox_data_bits)->child), FALSE); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_spec), hbox1, TRUE, TRUE, 0); gtk_widget_set_size_request (hbox1, -1, 25); label_parity = gtk_label_new (lqconnect->config.value[LCRT_Q_SPARITY]); gtk_widget_show (label_parity); gtk_box_pack_start (GTK_BOX (hbox1), label_parity, FALSE, FALSE, 0); gtk_widget_set_size_request (label_parity, 90, 25); gtk_misc_set_alignment (GTK_MISC (label_parity), 0, 0.5); combobox_parity = gtk_combo_box_entry_new_text (); lserial->parity = combobox_parity; gtk_widget_show (combobox_parity); gtk_box_pack_start (GTK_BOX (hbox1), combobox_parity, FALSE, TRUE, 0); gtk_widget_set_size_request (combobox_parity, SERIAL_COMBOBOX_WIDTH, 25); for (i = 0; i < LCRT_SERIAL_PARITY_NUMBER; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox_parity), sparity[i].name); } if (f_option) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_parity), s_parity); debug_where(); gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(combobox_parity)->child), FALSE); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_spec), hbox1, TRUE, TRUE, 0); gtk_widget_set_size_request (hbox1, -1, 25); label_stop_bits = gtk_label_new (lqconnect->config.value[LCRT_Q_SSTOP_BITS]); gtk_widget_show (label_stop_bits); gtk_box_pack_start (GTK_BOX (hbox1), label_stop_bits, FALSE, FALSE, 0); gtk_widget_set_size_request (label_stop_bits, 90, 25); gtk_misc_set_alignment (GTK_MISC (label_stop_bits), 0, 0.5); combobox_stop_bits = gtk_combo_box_entry_new_text (); lserial->stop_bits = combobox_stop_bits; gtk_widget_show (combobox_stop_bits); gtk_box_pack_start (GTK_BOX (hbox1), combobox_stop_bits, FALSE, TRUE, 0); gtk_widget_set_size_request (combobox_stop_bits, SERIAL_COMBOBOX_WIDTH, 25); for (i = 0; i < LCRT_SERIAL_STOP_BITS_NUMBER; i++) { gtk_combo_box_append_text (GTK_COMBO_BOX (combobox_stop_bits), sstop_bits[i].name); } if (f_option) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_stop_bits), s_stopbit); debug_where(); gtk_entry_set_editable(GTK_ENTRY(GTK_BIN(combobox_stop_bits)->child), FALSE); frame = gtk_frame_new (NULL); gtk_widget_show (frame); gtk_widget_set_size_request (frame, -1, 40); gtk_box_pack_start (GTK_BOX (vbox_spec), frame, TRUE, TRUE, 0); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment); gtk_container_add (GTK_CONTAINER (frame), alignment); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0); hbox_frame = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox_frame); gtk_container_add (GTK_CONTAINER (alignment), hbox_frame); checkbutton_software = gtk_check_button_new_with_mnemonic (flow_control[0].name); lserial->software = checkbutton_software; gtk_widget_show (checkbutton_software); gtk_box_pack_start (GTK_BOX (hbox_frame), checkbutton_software, FALSE, FALSE, 0); gtk_widget_set_size_request (checkbutton_software, 150, -1); if (f_option) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_software), s_software); checkbutton_hardware = gtk_check_button_new_with_mnemonic (flow_control[1].name); lserial->hardware = checkbutton_hardware; gtk_widget_show (checkbutton_hardware); gtk_box_pack_start (GTK_BOX (hbox_frame), checkbutton_hardware, FALSE, FALSE, 0); gtk_widget_set_size_request (checkbutton_hardware, 150, -1); if (f_option) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_hardware), s_hardware); label_flow_control = gtk_label_new (lqconnect->config.value[LCRT_Q_SFLOW_CONTROL]); gtk_widget_show (label_flow_control); gtk_frame_set_label_widget (GTK_FRAME (frame), label_flow_control); gtk_label_set_use_markup (GTK_LABEL (label_flow_control), TRUE); if (!f_option) { gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_port), 1); //ttyS0 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_baud_rate), 10); //115200 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_data_bits), 3); //8 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_parity), 0); //None gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_stop_bits), 0); //1 debug_print("active = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(combobox_baud_rate))); } gtk_widget_set_sensitive(lqconnect->q_bt_connect, TRUE); }
GtkWidget * gimp_transform_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *hbox; GtkWidget *label; GtkWidget *frame; GtkWidget *table; GtkWidget *combo; GtkWidget *button; const gchar *constrain = NULL; hbox = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); label = gtk_label_new (_("Transform:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (hbox), label, 0); gtk_widget_show (label); frame = gimp_prop_enum_radio_frame_new (config, "direction", _("Direction"), 0, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the interpolation menu */ frame = gimp_frame_new (_("Interpolation:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "interpolation", 0, 0); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* the clipping menu */ hbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); frame = gimp_frame_new (_("Clipping:")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); combo = gimp_prop_enum_combo_box_new (config, "clip", 0, 0); gtk_container_add (GTK_CONTAINER (frame), combo); gtk_widget_show (combo); /* the preview frame */ frame = gimp_frame_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); /* the preview type menu */ hbox = gtk_hbox_new (FALSE, 2); gtk_frame_set_label_widget (GTK_FRAME (frame), hbox); gtk_widget_show (hbox); label = gtk_label_new (_("Preview:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); combo = gimp_prop_enum_combo_box_new (config, "preview-type", 0, 0); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); /* the grid type menu */ button = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (frame), button); gtk_widget_show (button); combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0); gtk_box_pack_start (GTK_BOX (button), combo, FALSE, FALSE, 0); gtk_widget_show (combo); /* the grid density scale */ table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2); gtk_box_pack_start (GTK_BOX (button), table, FALSE, FALSE, 0); gtk_widget_show (table); gtk_widget_set_sensitive (button, options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_GRID || options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID); g_signal_connect (config, "notify::preview-type", G_CALLBACK (gimp_transform_options_preview_notify), button); gimp_prop_scale_entry_new (config, "grid-size", GTK_TABLE (table), 0, 0, NULL, 1.0, 8.0, 0, FALSE, 0.0, 0.0); if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL) { constrain = (_("15 degrees (%s)")); } else if (tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL) { constrain = (_("Keep aspect (%s)")); } if (constrain) { gchar *label = g_strdup_printf (constrain, gimp_get_mod_string (GDK_CONTROL_MASK)); button = gimp_prop_check_button_new (config, "constrain", label); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); g_free (label); } return vbox; }
static void gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool) { GimpGeglTool *tool = GIMP_GEGL_TOOL (image_map_tool); GimpOperationTool *o_tool = GIMP_OPERATION_TOOL (image_map_tool); GtkListStore *store; GtkCellRenderer *cell; GtkWidget *main_vbox; GtkWidget *hbox; GtkWidget *combo; GList *opclasses; GList *iter; GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->dialog (image_map_tool); main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool); /* The operation combo box */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (main_vbox), hbox, 0); gtk_widget_show (hbox); store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); opclasses = gimp_get_geglopclasses (); for (iter = opclasses; iter; iter = iter->next) { GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data); const gchar *stock_id; const gchar *label; if (g_str_has_prefix (opclass->name, "gegl:")) { label = opclass->name + strlen ("gegl:"); stock_id = GIMP_STOCK_GEGL; } else { label = opclass->name; stock_id = NULL; } gtk_list_store_insert_with_values (store, NULL, -1, COLUMN_NAME, opclass->name, COLUMN_LABEL, label, COLUMN_STOCK_ID, stock_id, -1); } g_list_free (opclasses); combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (store); gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0); gtk_widget_show (combo); cell = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, "stock-id", COLUMN_STOCK_ID); cell = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, "text", COLUMN_LABEL); g_signal_connect (combo, "changed", G_CALLBACK (gimp_gegl_tool_operation_changed), tool); tool->operation_combo = combo; tool->description_label = gtk_label_new (""); gtk_label_set_line_wrap (GTK_LABEL (tool->description_label), TRUE); gtk_misc_set_alignment (GTK_MISC (tool->description_label), 0.0, 0.0); gtk_box_pack_start (GTK_BOX (main_vbox), tool->description_label, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (main_vbox), tool->description_label, 1); /* The options vbox */ o_tool->options_table = gtk_label_new (_("Select an operation from the list above")); gimp_label_set_attributes (GTK_LABEL (o_tool->options_table), PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, -1); gtk_misc_set_padding (GTK_MISC (o_tool->options_table), 0, 4); gtk_container_add (GTK_CONTAINER (o_tool->options_box), o_tool->options_table); gtk_widget_show (o_tool->options_table); }
gint yad_print_run (void) { GtkWidget *dlg; GtkWidget *box, *img, *lbl; gchar *uri, *job_name = NULL; GtkPrintCapabilities pcap; GtkPrintOperationAction act = GTK_PRINT_OPERATION_ACTION_PRINT; gint resp, ret = 0; GError *err = NULL; /* check if file is exists */ if (options.common_data.uri && options.common_data.uri[0]) { if (!g_file_test (options.common_data.uri, G_FILE_TEST_EXISTS)) { g_printerr (_("File %s not found.\n"), options.common_data.uri); return 1; } } else { g_printerr (_("Filename is not specified.\n")); return 1; } /* create print dialog */ dlg = gtk_print_unix_dialog_new (options.data.dialog_title, NULL); gtk_window_set_type_hint (GTK_WINDOW (dlg), GDK_WINDOW_TYPE_HINT_NORMAL); gtk_print_unix_dialog_set_embed_page_setup (GTK_PRINT_UNIX_DIALOG (dlg), TRUE); pcap = GTK_PRINT_CAPABILITY_PAGE_SET | GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE | GTK_PRINT_CAPABILITY_REVERSE | GTK_PRINT_CAPABILITY_NUMBER_UP | GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT; if (options.common_data.preview && options.print_data.type != YAD_PRINT_RAW) pcap |= GTK_PRINT_CAPABILITY_PREVIEW; gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dlg), pcap); if (!settings.print_settings) settings.print_settings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG (dlg)); uri = g_build_filename (g_get_current_dir (), "yad.pdf", NULL); gtk_print_settings_set (settings.print_settings, "output-uri", g_filename_to_uri (uri, NULL, NULL)); g_free (uri); gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (dlg), settings.print_settings); if (settings.page_setup) gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (dlg), settings.page_setup); /* set window behavior */ gtk_widget_set_name (dlg, "yad-dialog-window"); if (options.data.sticky) gtk_window_stick (GTK_WINDOW (dlg)); gtk_window_set_resizable (GTK_WINDOW (dlg), !options.data.fixed); gtk_window_set_keep_above (GTK_WINDOW (dlg), options.data.ontop); gtk_window_set_decorated (GTK_WINDOW (dlg), !options.data.undecorated); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), options.data.skip_taskbar); gtk_window_set_skip_pager_hint (GTK_WINDOW (dlg), options.data.skip_taskbar); /* set window size and position */ if (!options.data.geometry) { gtk_window_set_default_size (GTK_WINDOW (dlg), options.data.width, options.data.height); if (options.data.center) gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER); else if (options.data.mouse) gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE); } else { /* parse geometry, if given. must be after showing widget */ gtk_widget_realize (dlg); gtk_window_parse_geometry (GTK_WINDOW (dlg), options.data.geometry); } /* create yad's top box */ if (options.data.dialog_text || options.data.dialog_image) { #if !GTK_CHECK_VERSION(3,0,0) box = gtk_hbox_new (FALSE, 0); #else box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); #endif if (options.data.dialog_image) { GdkPixbuf *pb = NULL; pb = get_pixbuf (options.data.dialog_image, YAD_BIG_ICON); img = gtk_image_new_from_pixbuf (pb); if (pb) g_object_unref (pb); gtk_widget_set_name (img, "yad-dialog-image"); gtk_box_pack_start (GTK_BOX (box), img, FALSE, FALSE, 2); } if (options.data.dialog_text) { gchar *buf = g_strcompress (options.data.dialog_text); lbl = gtk_label_new (NULL); if (!options.data.no_markup) gtk_label_set_markup (GTK_LABEL (lbl), buf); else gtk_label_set_text (GTK_LABEL (lbl), buf); gtk_widget_set_name (lbl, "yad-dialog-label"); gtk_label_set_selectable (GTK_LABEL (lbl), options.data.selectable_labels); gtk_misc_set_alignment (GTK_MISC (lbl), options.data.text_align, 0.5); if (options.data.geometry || options.data.width != -1) gtk_label_set_line_wrap (GTK_LABEL (lbl), TRUE); gtk_box_pack_start (GTK_BOX (box), lbl, TRUE, TRUE, 2); g_signal_connect (G_OBJECT (lbl), "size-allocate", G_CALLBACK (size_allocate_cb), NULL); g_free (buf); } /* add tob box to dialog */ gtk_widget_show_all (box); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), box, TRUE, TRUE, 5); gtk_box_reorder_child (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), box, 0); } do { resp = gtk_dialog_run (GTK_DIALOG (dlg)); switch (resp) { case GTK_RESPONSE_APPLY: /* ask for preview */ act = GTK_PRINT_OPERATION_ACTION_PREVIEW; case GTK_RESPONSE_OK: /* run print */ settings.print_settings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG (dlg)); settings.page_setup = gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (dlg)); job_name = g_strdup_printf ("yad-%s-%d", g_path_get_basename (options.common_data.uri), getpid ()); if (options.print_data.type != YAD_PRINT_RAW) { /* print text or image */ GtkPrintOperation *op = gtk_print_operation_new (); gtk_print_operation_set_unit (op, GTK_UNIT_POINTS); gtk_print_operation_set_print_settings (op, settings.print_settings); gtk_print_operation_set_default_page_setup (op, settings.page_setup); gtk_print_operation_set_job_name (op, job_name); switch (options.print_data.type) { case YAD_PRINT_TEXT: g_signal_connect (G_OBJECT (op), "begin-print", G_CALLBACK (begin_print_text), NULL); g_signal_connect (G_OBJECT (op), "draw-page", G_CALLBACK (draw_page_text), NULL); break; case YAD_PRINT_IMAGE: gtk_print_operation_set_n_pages (op, 1); g_signal_connect (G_OBJECT (op), "draw-page", G_CALLBACK (draw_page_image), NULL); break; default:; } if (gtk_print_operation_run (op, act, NULL, &err) == GTK_PRINT_OPERATION_RESULT_ERROR) { g_printerr (_("Printing failed: %s\n"), err->message); ret = 1; } } else { /* print raw ps or pdf data */ GtkPrinter *prnt; GtkPrintJob *job; prnt = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dlg)); if (g_str_has_suffix (options.common_data.uri, ".ps")) { if (!gtk_printer_accepts_ps (prnt)) { g_printerr (_("Printer doesn't support ps format.\n")); ret = 1; } } else if (g_str_has_suffix (options.common_data.uri, ".pdf")) { if (!gtk_printer_accepts_pdf (prnt)) { g_printerr (_("Printer doesn't support pdf format.\n")); ret = 1; } } else { g_printerr (_("This file type is not supported for raw printing.\n")); ret = 1; } if (ret == 1) break; job = gtk_print_job_new (job_name, prnt, settings.print_settings, settings.page_setup); if (gtk_print_job_set_source_file (job, options.common_data.uri, &err)) { gtk_print_job_send (job, (GtkPrintJobCompleteFunc) raw_print_done, &ret, NULL); gtk_main (); } else { g_printerr (_("Load source file failed: %s\n"), err->message); ret = 1; } } break; default: ret = 1; break; } } while (resp == GTK_RESPONSE_APPLY); gtk_widget_destroy (dlg); write_settings (); return ret; }
static void config_window_create(void) { GtkWidget *win_vbox; GtkWidget *hbox; GtkWidget *notebook; GtkWidget *frame; GtkWidget *label; GtkWidget *vbox; GtkWidget *group; GtkWidget *subgroup; GtkWidget *button; GtkWidget *tabcomp; GtkWidget *ct_button; GtkWidget *table; GtkWidget *spin; GtkWidget *scrolled; GtkWidget *viewport; GtkWidget *filter_view; GtkCellRenderer *renderer; GtkTreeSelection *selection; GtkTreeViewColumn *column; gint i; configwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(configwindow), GDK_WINDOW_TYPE_HINT_DIALOG); g_signal_connect(G_OBJECT (configwindow), "delete_event", G_CALLBACK(config_window_delete), NULL); gtk_window_set_resizable(GTK_WINDOW(configwindow), FALSE); gtk_window_set_title(GTK_WINDOW(configwindow), _("GQview Preferences")); gtk_window_set_wmclass(GTK_WINDOW(configwindow), "config", "GQview"); gtk_container_set_border_width(GTK_CONTAINER(configwindow), PREF_PAD_BORDER); window_set_icon(configwindow, PIXBUF_INLINE_ICON_CONFIG, NULL); win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); gtk_container_add(GTK_CONTAINER(configwindow), win_vbox); gtk_widget_show(win_vbox); hbox = gtk_hbutton_box_new(); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP); gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE, G_CALLBACK(config_window_ok_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_grab_default(button); gtk_widget_show(button); ct_button = button; button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE, G_CALLBACK(config_window_apply_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE, G_CALLBACK(config_window_close_cb), NULL); gtk_container_add(GTK_CONTAINER(hbox), button); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_show(button); if (!generic_dialog_get_alternative_button_order(configwindow)) { gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1); } notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); gtk_box_pack_start(GTK_BOX(win_vbox), notebook, TRUE, TRUE, 0); /* general options tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("General")); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("Startup"), GTK_ORIENTATION_VERTICAL); button = pref_checkbox_new_int(group, _("Change to folder:"), startup_path_enable, &startup_path_enable_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(button, hbox); tabcomp = tab_completion_new(&startup_path_entry, startup_path, NULL, NULL); tab_completion_add_select_button(startup_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); button = pref_button_new(hbox, NULL, _("Use current"), FALSE, G_CALLBACK(startup_path_set_current), NULL); group = pref_group_new(vbox, FALSE, _("Thumbnails"), GTK_ORIENTATION_VERTICAL); table = pref_table_new(group, 2, 2, FALSE, FALSE); add_thumb_size_menu(table, 0, 0, _("Size:")); add_quality_menu(table, 0, 1, _("Quality:"), thumbnail_quality, &thumbnail_quality_c); ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"), enable_thumb_caching, &enable_thumb_caching_c); subgroup = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity(ct_button, subgroup); button = pref_checkbox_new_int(subgroup, _("Use shared thumbnail cache"), thumbnail_spec_standard, &thumbnail_spec_standard_c); subgroup = pref_box_new(subgroup, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_link_sensitivity_swap(button, subgroup); pref_checkbox_new_int(subgroup, _("Cache thumbnails into .thumbnails"), enable_thumb_dirs, &enable_thumb_dirs_c); #if 0 pref_checkbox_new_int(subgroup, _("Use xvpics thumbnails when found (read only)"), use_xvpics_thumbnails, &use_xvpics_thumbnails_c); #endif pref_checkbox_new_int(group, _("Faster jpeg thumbnailing (may reduce quality)"), thumbnail_fast, &thumbnail_fast_c); group = pref_group_new(vbox, FALSE, _("Slide show"), GTK_ORIENTATION_VERTICAL); slideshow_delay_c = slideshow_delay; spin = pref_spin_new(group, _("Delay between image change:"), _("seconds"), SLIDESHOW_MIN_SECONDS, SLIDESHOW_MAX_SECONDS, 1.0, 1, slideshow_delay ? (double)slideshow_delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0, G_CALLBACK(slideshow_delay_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); pref_checkbox_new_int(group, _("Random"), slideshow_random, &slideshow_random_c); pref_checkbox_new_int(group, _("Repeat"), slideshow_repeat, &slideshow_repeat_c); /* image tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Image")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("Zoom"), GTK_ORIENTATION_VERTICAL); #if 0 add_dither_menu(dither_quality, &dither_quality_c, _("Dithering method:"), group); #endif table = pref_table_new(group, 2, 1, FALSE, FALSE); add_quality_menu(table, 0, 0, _("Quality:"), zoom_quality, &zoom_quality_c); pref_checkbox_new_int(group, _("Two pass zooming"), two_pass_zoom, &two_pass_zoom_c); pref_checkbox_new_int(group, _("Allow enlargement of image for zoom to fit"), zoom_to_fit_expands, &zoom_to_fit_expands_c); zoom_increment_c = zoom_increment; spin = pref_spin_new(group, _("Zoom increment:"), NULL, 0.1, 4.0, 1.0, 1, (double)zoom_increment / 10.0, G_CALLBACK(zoom_increment_cb), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS); group = pref_group_new(vbox, FALSE, _("When new image is selected:"), GTK_ORIENTATION_VERTICAL); zoom_mode_c = zoom_mode; button = pref_radiobutton_new(group, NULL, _("Zoom to original size"), (zoom_mode == ZOOM_RESET_ORIGINAL), G_CALLBACK(zoom_mode_original_cb), NULL); button = pref_radiobutton_new(group, button, _("Fit image to window"), (zoom_mode == ZOOM_RESET_FIT_WINDOW), G_CALLBACK(zoom_mode_fit_cb), NULL); button = pref_radiobutton_new(group, button, _("Leave Zoom at previous setting"), (zoom_mode == ZOOM_RESET_NONE), G_CALLBACK(zoom_mode_none_cb), NULL); group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Black background"), black_window_background, &black_window_background_c); group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Refresh on file change"), update_on_time_change, &update_on_time_change_c); pref_checkbox_new_int(group, _("Preload next image"), enable_read_ahead, &enable_read_ahead_c); pref_checkbox_new_int(group, _("Auto rotate image using Exif information"), exif_rotate_enable, &exif_rotate_enable_c); /* window tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Windows")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Remember window positions"), save_window_positions, &save_window_positions_c); pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"), restore_tool, &restore_tool_c); group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Fit window to image when tools are hidden/floating"), fit_window, &fit_window_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); ct_button = pref_checkbox_new_int(hbox, _("Limit size when auto-sizing window (%):"), limit_window_size, &limit_window_size_c); spin = pref_spin_new_int(hbox, NULL, NULL, 10, 150, 1, max_window_size, &max_window_size_c); pref_checkbox_link_sensitivity(ct_button, spin); group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); layout_widget = layout_config_new(); layout_config_set(layout_widget, layout_style, layout_order); gtk_box_pack_start(GTK_BOX(group), layout_widget, FALSE, FALSE, 0); gtk_widget_show(layout_widget); /* filtering tab */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER (vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Filtering")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); group = pref_box_new(vbox, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); pref_checkbox_new_int(group, _("Show entries that begin with a dot"), show_dot_files, &show_dot_files_c); pref_checkbox_new_int(group, _("Case sensitive sort"), file_sort_case_sensitive, &file_sort_case_sensitive_c); ct_button = pref_checkbox_new_int(group, _("Disable File Filtering"), file_filter_disable, &file_filter_disable_c); group = pref_group_new(vbox, TRUE, _("File types"), GTK_ORIENTATION_VERTICAL); frame = pref_group_parent(group); g_signal_connect(G_OBJECT(ct_button), "toggled", G_CALLBACK(filter_disable_cb), frame); gtk_widget_set_sensitive(frame, !file_filter_disable); scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_box_pack_start(GTK_BOX(group), scrolled, TRUE, TRUE, 0); gtk_widget_show(scrolled); filter_store = gtk_list_store_new(1, G_TYPE_POINTER); filter_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(filter_store)); g_object_unref(filter_store); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(filter_view)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_SINGLE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(filter_view), FALSE); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("Filter")); gtk_tree_view_column_set_resizable(column, TRUE); renderer = gtk_cell_renderer_toggle_new(); g_signal_connect(G_OBJECT(renderer), "toggled", G_CALLBACK(filter_store_enable_cb), filter_store); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_ENABLE), NULL); renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(filter_store_ext_edit_cb), filter_store); gtk_tree_view_column_pack_start(column, renderer, TRUE); g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE, NULL); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_EXTENSION), NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(filter_view), column); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("Description")); gtk_tree_view_column_set_resizable(column, TRUE); renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(filter_store_desc_edit_cb), filter_store); g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE, NULL); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func(column, renderer, filter_set_func, GINT_TO_POINTER(FE_DESCRIPTION), NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(filter_view), column); filter_store_populate(); gtk_container_add(GTK_CONTAINER(scrolled), filter_view); gtk_widget_show(filter_view); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); button = pref_button_new(NULL, NULL, _("Defaults"), FALSE, G_CALLBACK(filter_default_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_REMOVE, NULL, FALSE, G_CALLBACK(filter_remove_cb), filter_view); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_ADD, NULL, FALSE, G_CALLBACK(filter_add_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); /* editor entry tab */ vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); gtk_container_set_border_width(GTK_CONTAINER(vbox), PREF_PAD_BORDER); gtk_widget_show(vbox); label = gtk_label_new(_("Editors")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); table = pref_table_new(vbox, 3, 9, FALSE, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP); label = pref_table_label(table, 0, 0, _("#"), 1.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 1, 0, _("Menu name"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 2, 0, _("Command Line"), 0.0); pref_label_bold(label, TRUE, FALSE); for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++) { gchar *buf; buf = g_strdup_printf("%d", i+1); pref_table_label(table, 0, i+1, buf, 1.0); g_free(buf); editor_name_entry[i] = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH); gtk_widget_set_size_request(editor_name_entry[i],80,-1); if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]); gtk_table_attach(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(editor_name_entry[i]); editor_command_entry[i] = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(editor_command_entry[i]), EDITOR_COMMAND_MAX_LENGTH); gtk_widget_set_size_request(editor_command_entry[i],160,-1); tab_completion_add_to_entry(editor_command_entry[i], NULL, NULL); if (editor_command[i]) gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), editor_command[i]); gtk_table_attach(GTK_TABLE (table),editor_command_entry[i],2,3,i+1,i+2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(editor_command_entry[i]); } hbox = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); button = pref_button_new(NULL, NULL, _("Defaults"), FALSE, G_CALLBACK(editor_default_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE, G_CALLBACK(editor_help_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); /* advanced entry tab */ scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); label = gtk_label_new(_("Advanced")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled, label); gtk_widget_show(scrolled); viewport = gtk_viewport_new(NULL, NULL); gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); gtk_container_add(GTK_CONTAINER(scrolled), viewport); gtk_widget_show(viewport); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(viewport), vbox); gtk_widget_show(vbox); group = pref_group_new(vbox, FALSE, _("Full screen"), GTK_ORIENTATION_VERTICAL); fullscreen_screen_c = fullscreen_screen; fullscreen_above_c = fullscreen_above; hbox = fullscreen_prefs_selection_new(_("Location:"), &fullscreen_screen_c, &fullscreen_above_c); gtk_box_pack_start(GTK_BOX(group), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); pref_checkbox_new_int(group, _("Smooth image flip"), fullscreen_clean_flip, &fullscreen_clean_flip_c); pref_checkbox_new_int(group, _("Disable screen saver"), fullscreen_disable_saver, &fullscreen_disable_saver_c); group = pref_group_new(vbox, FALSE, _("Delete"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Confirm file delete"), confirm_delete, &confirm_delete_c); pref_checkbox_new_int(group, _("Enable Delete key"), enable_delete_key, &enable_delete_key_c); ct_button = pref_checkbox_new_int(group, _("Safe delete"), safe_delete_enable, &safe_delete_enable_c); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); pref_checkbox_link_sensitivity(ct_button, hbox); pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_SPACE); pref_label_new(hbox, _("Folder:")); tabcomp = tab_completion_new(&safe_delete_path_entry, safe_delete_path, NULL, NULL); tab_completion_add_select_button(safe_delete_path_entry, NULL, TRUE); gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); gtk_widget_show(tabcomp); hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); pref_checkbox_link_sensitivity(ct_button, hbox); pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP); pref_spin_new_int(hbox, _("Maximum size:"), _("MB"), 1, 500, 1, safe_delete_size, &safe_delete_size_c); button = pref_button_new(NULL, NULL, _("View"), FALSE, G_CALLBACK(safe_delete_view_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); button = pref_button_new(NULL, GTK_STOCK_CLEAR, NULL, FALSE, G_CALLBACK(safe_delete_clear_cb), NULL); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show(button); group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Rectangular selection in icon view"), collection_rectangular_selection, &collection_rectangular_selection_c); pref_checkbox_new_int(group, _("Descend folders in tree view"), tree_descend_subdirs, &tree_descend_subdirs_c); pref_checkbox_new_int(group, _("In place renaming"), enable_in_place_rename, &enable_in_place_rename_c); group = pref_group_new(vbox, FALSE, _("Navigation"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Progressive keyboard scrolling"), progressive_key_scrolling, &progressive_key_scrolling_c); pref_checkbox_new_int(group, _("Mouse wheel scrolls image"), mousewheel_scrolls, &mousewheel_scrolls_c); group = pref_group_new(vbox, FALSE, _("Miscellaneous"), GTK_ORIENTATION_VERTICAL); pref_checkbox_new_int(group, _("Store keywords and comments local to source images"), enable_metadata_dirs, &enable_metadata_dirs_c); pref_spin_new_int(group, _("Custom similarity threshold:"), NULL, 0, 100, 1, dupe_custom_threshold, &dupe_custom_threshold_c); pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL, 0, 128, 1, tile_cache_max, &tile_cache_max_c); group = pref_group_new(vbox, FALSE, _("Color profiles"), GTK_ORIENTATION_VERTICAL); #ifndef HAVE_LCMS gtk_widget_set_sensitive(pref_group_parent(group), FALSE); #endif table = pref_table_new(group, 3, COLOR_PROFILE_INPUTS + 2, FALSE, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP); label = pref_table_label(table, 0, 0, _("Type"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 1, 0, _("Menu name"), 0.0); pref_label_bold(label, TRUE, FALSE); label = pref_table_label(table, 2, 0, _("File"), 0.0); pref_label_bold(label, TRUE, FALSE); for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { GtkWidget *entry; gchar *buf; buf = g_strdup_printf("Input %d:", i + 1); pref_table_label(table, 0, i + 1, buf, 1.0); g_free(buf); entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH); gtk_widget_set_size_request(editor_name_entry[i], 30, -1); if (color_profile_input_name[i]) gtk_entry_set_text(GTK_ENTRY(entry), color_profile_input_name[i]); gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i + 1, i + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(entry); color_profile_input_name_entry[i] = entry; tabcomp = tab_completion_new(&entry, color_profile_input_file[i], NULL, NULL); tab_completion_add_select_button(entry, _("Select color profile"), FALSE); gtk_widget_set_size_request(entry, 160, -1); gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, i + 1, i + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(tabcomp); color_profile_input_file_entry[i] = entry; } pref_table_label(table, 0, COLOR_PROFILE_INPUTS + 1, _("Screen:"), 1.0); tabcomp = tab_completion_new(&color_profile_screen_file_entry, color_profile_screen_file, NULL, NULL); tab_completion_add_select_button(color_profile_screen_file_entry, _("Select color profile"), FALSE); gtk_widget_set_size_request(color_profile_screen_file_entry, 160, -1); gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, COLOR_PROFILE_INPUTS + 1, COLOR_PROFILE_INPUTS + 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); gtk_widget_show(tabcomp); gtk_widget_show(notebook); gtk_widget_show(configwindow); }
static GtkWidget* uisettings(JamWin *jw) { SettingsWidget *sw; GtkWidget *vbox, *hbox, *button; char *fontname = NULL; GtkWidget *post, *entry, *misc; vbox = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); post = groupedbox_new_with_text(_("Posting")); gtk_box_pack_start(GTK_BOX(vbox), post, FALSE, FALSE, 0); groupedbox_pack(GROUPEDBOX(post), sw_make("ui_revertusejournal"), FALSE); sw = sw_lookup("ui_defaultsecurity"); sw->widget = secmgr_new(FALSE); secmgr_security_set(SECMGR(sw->widget), (LJSecurity*)sw->conf); g_signal_connect(G_OBJECT(sw->widget), "changed", G_CALLBACK(sec_changed_cb), sw); groupedbox_pack(GROUPEDBOX(post), sw_make("ui_defaultsecurity"), FALSE); #ifdef USE_DOCK groupedbox_pack(GROUPEDBOX(post), sw_make("ui_close_when_send"), FALSE); #endif /* USE_DOCK */ entry = groupedbox_new_with_text(_("Entries")); gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); groupedbox_pack(GROUPEDBOX(entry), sw_make("ui_autosave"), FALSE); groupedbox_pack(GROUPEDBOX(entry), sw_make("ui_keepsaveddrafts"), FALSE); #ifdef HAVE_GTKSPELL { GtkWidget *toggle = sw_make("ui_spellcheck"); GtkWidget *label, *box; hbox = sw_make("ui_spell_language"); label = gtk_label_new(" "); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_box_reorder_child(GTK_BOX(hbox), label, 0); sw = sw_lookup("ui_spell_language"); gtk_entry_set_width_chars(GTK_ENTRY(sw->widget), 5); box = gtk_vbox_new(FALSE, 3); gtk_box_pack_start(GTK_BOX(box), toggle, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); groupedbox_pack(GROUPEDBOX(entry), box, FALSE); toggle_tie_enable(toggle, hbox); } #endif groupedbox_pack(GROUPEDBOX(entry), sw_make("ui_showloginhistory"), TRUE); groupedbox_pack(GROUPEDBOX(entry), sw_make("ui_smartquotes"), FALSE); sw = sw_lookup("ui_font"); if (conf.uifont == NULL) { fontname = pango_font_description_to_string( pango_context_get_font_description( gtk_widget_get_pango_context(jw->view))); sw->widget = gtk_label_new(fontname ? fontname : _("[gtk default]")); if (fontname) jam_widget_set_font(sw->widget, fontname); g_free(fontname); } else { sw->widget = gtk_label_new(conf.uifont); jam_widget_set_font(sw->widget, conf.uifont); } button = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); sw->data = jw->view; hbox = labelled_box_new_expand(_(sw->caption), button, FALSE); gtk_box_pack_start(GTK_BOX(hbox), sw->widget, TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(hbox), sw->widget, 1); groupedbox_pack(GROUPEDBOX(entry), hbox, FALSE); g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(run_fontsel_settings_dlg), sw); misc = groupedbox_new_with_text(_("Behavior")); gtk_box_pack_start(GTK_BOX(vbox), misc, FALSE, FALSE, 0); groupedbox_pack(GROUPEDBOX(misc), sw_make("ui_allowmultipleinstances"), FALSE); #ifdef USE_DOCK button = sw_make("ui_docklet"); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(docklet_change_cb), jw); groupedbox_pack(GROUPEDBOX(misc), button, FALSE); groupedbox_pack(GROUPEDBOX(misc), sw_make("ui_start_in_dock"), FALSE); #endif /* USE_DOCK */ return vbox; }
static void source_add(gtk_ui_t *gu, settinglist_t *sl, prop_t *p, setting_t *s, setting_t *before, int position) { prop_sub_t *sub; GtkWidget *w, *vbox; prop_courier_t *pc = gu->gu_pc; s->s_settinglist = sl; s->s_hbox = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(sl->sl_box), s->s_hbox, FALSE, TRUE, 5); gtk_box_reorder_child(GTK_BOX(sl->sl_box), s->s_hbox, position * 2); s->s_separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(sl->sl_box), s->s_separator, FALSE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(sl->sl_box), s->s_separator, position * 2 + 1); gtk_widget_show(s->s_separator); gtk_widget_set_size_request(s->s_hbox, -1, 64); /* Icon */ w = gtk_image_new(); gtk_box_pack_start(GTK_BOX(s->s_hbox), w, FALSE, TRUE, 5); sub = prop_subscribe(0, PROP_TAG_NAME("self", "model", "metadata", "icon"), PROP_TAG_CALLBACK_STRING, set_icon, w, PROP_TAG_COURIER, pc, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); gtk_image_set_from_stock(GTK_IMAGE(w), GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(w), 0.5, 0.5); gtk_misc_set_padding(GTK_MISC(w), 8, 0); /* vbox */ vbox = gtk_vbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(s->s_hbox), vbox, TRUE, TRUE, 0); /* Title */ w = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(w), 0, 0); gtk_label_set_ellipsize(GTK_LABEL(w), PANGO_ELLIPSIZE_END); gtk_box_pack_start(GTK_BOX(vbox), w, FALSE, TRUE, 0); sub = prop_subscribe(0, PROP_TAG_NAME("self", "model", "metadata", "title"), PROP_TAG_CALLBACK_STRING, gu_subscription_set_label_xl, w, PROP_TAG_COURIER, pc, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); /* Short description */ w = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(w), 0, 0); gtk_label_set_ellipsize(GTK_LABEL(w), PANGO_ELLIPSIZE_END); gtk_box_pack_start(GTK_BOX(vbox), w, FALSE, TRUE, 0); sub = prop_subscribe(0, PROP_TAG_NAME("self", "model", "metadata", "shortdesc"), PROP_TAG_CALLBACK_STRING, gu_subscription_set_label, w, PROP_TAG_COURIER, pc, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); /* Spacer */ w = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), w, TRUE, FALSE, 0); /* Link */ #if 0 hbox = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0); w = gtk_button_new(); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(w), "clicked", G_CALLBACK(source_clicked), s); g_object_set(G_OBJECT(w), "label", "Open", NULL); sub = prop_subscribe(0, PROP_TAG_NAME("self", "url"), PROP_TAG_CALLBACK_STRING, source_set_url, s, PROP_TAG_COURIER, pc, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); #endif /* Finalize */ gtk_widget_show_all(s->s_hbox); }
static void gnc_search_dialog_book_option_changed (gpointer new_val, gpointer user_data) { GList *l; GNCSearchWindow *sw = user_data; gboolean *new_data = (gboolean*)new_val; /* Save current dialog focus */ GtkWidget *focused_widget = gtk_window_get_focus(GTK_WINDOW(sw->dialog)); g_return_if_fail (sw); if (strcmp (sw->search_for, GNC_ID_SPLIT) != 0) return; /* Adjust labels for future added search criteria */ for (l = sw->params_list; l; l = l->next) { GNCSearchParam *param = l->data; if (*new_data) { if (strcmp (param->title, N_("Action")) == 0) gnc_search_param_set_title (param, N_("Number/Action")); if (strcmp (param->title, N_("Number")) == 0) gnc_search_param_set_title (param, N_("Transaction Number")); } else { if (strcmp (param->title, N_("Number/Action")) == 0) gnc_search_param_set_title (param, N_("Action")); if (strcmp (param->title, N_("Transaction Number")) == 0) gnc_search_param_set_title (param, N_("Number")); } } /* Adjust labels for existing search criteria; walk the list of criteria */ for (l = sw->crit_list; l; l = l->next) { struct _crit_data *data = l->data; GList *children; /* For each, walk the list of container children to get combo_box */ for (children = gtk_container_get_children(GTK_CONTAINER(data->container)); children; children = children->next) { GtkWidget *combo_box = children->data; /* Get current active item if combo_box */ if (GTK_IS_COMBO_BOX(combo_box)) { GtkWidget *new_combo_box; gint index; /* Set index to current active item */ index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); /* Create new combo_box to replace existing one */ new_combo_box = get_comb_box_widget (sw, data); /* If current combo_box has focus, point to new_combo-box */ if (focused_widget == combo_box) focused_widget = new_combo_box; gtk_widget_destroy(combo_box); /* Set new combo_box to current active item */ gtk_combo_box_set_active(GTK_COMBO_BOX(new_combo_box), index); gtk_box_pack_start (GTK_BOX (data->container), new_combo_box, FALSE, FALSE, 0); gtk_box_reorder_child(GTK_BOX (data->container), new_combo_box, 0); gtk_widget_show_all (data->container); } } } gtk_widget_grab_focus(focused_widget); }
void gimp_enum_radio_frame_add (GtkFrame *frame, GtkWidget *widget, gint enum_value) { GtkWidget *vbox; GList *children; GList *list; gint pos; g_return_if_fail (GTK_IS_FRAME (frame)); g_return_if_fail (GTK_IS_WIDGET (widget)); vbox = gtk_bin_get_child (GTK_BIN (frame)); g_return_if_fail (GTK_IS_VBOX (vbox)); children = gtk_container_get_children (GTK_CONTAINER (vbox)); for (list = children, pos = 1; list; list = g_list_next (list), pos++) { if (GTK_IS_RADIO_BUTTON (list->data) && GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) == enum_value) { GtkWidget *radio = list->data; GtkWidget *hbox; GtkWidget *spacer; gint indicator_size; gint indicator_spacing; gint focus_width; gint focus_padding; gtk_widget_style_get (radio, "indicator-size", &indicator_size, "indicator-spacing", &indicator_spacing, "focus-line-width", &focus_width, "focus-padding", &focus_padding, NULL); hbox = gtk_hbox_new (FALSE, 0); spacer = gtk_vbox_new (FALSE, 0); gtk_widget_set_size_request (spacer, indicator_size + 3 * indicator_spacing + focus_width + focus_padding + GTK_CONTAINER (radio)->border_width, -1); gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0); gtk_widget_show (spacer); gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); gtk_widget_show (widget); g_object_set_data (G_OBJECT (radio), "set_sensitive", hbox); g_signal_connect (radio, "toggled", G_CALLBACK (gimp_toggle_button_sensitive_update), NULL); gtk_widget_set_sensitive (hbox, GTK_TOGGLE_BUTTON (list->data)->active); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (vbox), hbox, pos); gtk_widget_show (hbox); break; } } g_list_free (children); }
void ags_drum_input_pad_open_callback(GtkWidget *widget, AgsDrumInputPad *drum_input_pad) { GtkFileChooserDialog *file_chooser; GtkHBox *hbox; GtkLabel *label; GtkSpinButton *spin_button; GtkToggleButton *play; if(drum_input_pad->file_chooser != NULL) return; drum_input_pad->file_chooser = file_chooser = (GtkFileChooserDialog *) gtk_file_chooser_dialog_new(i18n("Open File"), (GtkWindow *) gtk_widget_get_toplevel((GtkWidget *) drum_input_pad), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_add_shortcut_folder_uri(GTK_FILE_CHOOSER(file_chooser), "file:///usr/share/hydrogen/data/drumkits", NULL); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(file_chooser), FALSE); g_object_set_data((GObject *) file_chooser, (char *) g_type_name(AGS_TYPE_AUDIO_FILE), NULL); g_object_set_data((GObject *) file_chooser, AGS_DRUM_INPUT_PAD_OPEN_AUDIO_FILE_NAME, NULL); hbox = (GtkHBox *) gtk_hbox_new(FALSE, 0); gtk_file_chooser_set_extra_widget((GtkFileChooser *) file_chooser, (GtkWidget *) hbox); label = (GtkLabel *) gtk_label_new(i18n("channel: ")); gtk_box_pack_start((GtkBox *) hbox, (GtkWidget *) label, FALSE, FALSE, 0); spin_button = (GtkSpinButton *) gtk_spin_button_new_with_range(0.0, AGS_AUDIO(AGS_PAD(drum_input_pad)->channel->audio)->audio_channels - 1, 1.0); g_object_set_data((GObject *) file_chooser, AGS_DRUM_INPUT_PAD_OPEN_SPIN_BUTTON, spin_button); gtk_box_pack_start((GtkBox *) hbox, (GtkWidget *) spin_button, FALSE, FALSE, 0); if(drum_input_pad->pad.group->active){ gtk_widget_set_sensitive((GtkWidget *) spin_button, FALSE); } #if 0 play = (GtkToggleButton *) g_object_new(GTK_TYPE_TOGGLE_BUTTON, "label", GTK_STOCK_MEDIA_PLAY, "use-stock", TRUE, "use-underline", TRUE, NULL); gtk_box_pack_start((GtkBox *) GTK_DIALOG(file_chooser)->action_area, (GtkWidget *) play, FALSE, FALSE, 0); gtk_box_reorder_child((GtkBox *) GTK_DIALOG(file_chooser)->action_area, (GtkWidget *) play, 0); #endif gtk_widget_show_all((GtkWidget *) file_chooser); g_signal_connect((GObject *) file_chooser, "response", G_CALLBACK(ags_drum_input_pad_open_response_callback), (gpointer) drum_input_pad); }
static gboolean monitors_apply_config (gpointer user_data) { ENTER; GtkWidget *p = user_data; MonitorsPlugin *mp; mp = lxpanel_plugin_get_data(p); int i; int current_n_monitors = 0; start: for (i = 0; i < N_MONITORS; i++) { if (mp->displayed_monitors[i]) current_n_monitors++; if (mp->displayed_monitors[i] && !mp->monitors[i]) { /* We've just activated monitor<i> */ mp->monitors[i] = monitors_add_monitor(p, mp, update_functions[i], tooltip_update[i], colors[i]); /* * It is probably best for users if their monitors are always * displayed in the same order : the CPU monitor always on the left, * the RAM monitor always on the right of the CPU monitor (if the * CPU monitor is displayed), etc. That's why we do not just use * gtk_box_pack_start/gtk_box_pack_end, and use * gtk_box_reorder_child. */ gtk_box_reorder_child(GTK_BOX(p), mp->monitors[i]->da,current_n_monitors-1); } else if (!mp->displayed_monitors[i] && mp->monitors[i]) { /* We've just removed monitor<i> */ gtk_widget_destroy(mp->monitors[i]->da); monitor_free(mp->monitors[i]); mp->monitors[i] = NULL; } if (mp->monitors[i] && strncmp(mp->monitors[i]->color, colors[i], COLOR_SIZE) != 0) { /* We've changed the color */ monitor_set_foreground_color(mp, mp->monitors[i], colors[i]); } } /* Workaround meant to prevent users to display no monitor at all. * FIXME : write something clean. When there is only one monitor displayed, * its toggle button should not be clickable in the prefs. */ if (current_n_monitors == 0) { mp->displayed_monitors[0] = 1; goto start; } config_group_set_int(mp->settings, "DisplayCPU", mp->displayed_monitors[CPU_POSITION]); config_group_set_int(mp->settings, "DisplayRAM", mp->displayed_monitors[MEM_POSITION]); config_group_set_string(mp->settings, "Action", mp->action); config_group_set_string(mp->settings, "CPUColor", mp->monitors[CPU_POSITION] ? colors[CPU_POSITION] : NULL); config_group_set_string(mp->settings, "RAMColor", mp->monitors[MEM_POSITION] ? colors[MEM_POSITION] : NULL); RET(FALSE); }
static void source_add(gtk_ui_t *gu, home_t *h, prop_t *p, source_t *s, source_t *before, int position) { prop_sub_t *sub; GtkWidget *w, *vbox, *hbox; s->s_home = h; s->s_hbox = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(h->h_sourcebox), s->s_hbox, FALSE, TRUE, 5); gtk_box_reorder_child(GTK_BOX(h->h_sourcebox), s->s_hbox, position * 2); s->s_separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(h->h_sourcebox), s->s_separator, FALSE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(h->h_sourcebox), s->s_separator, position * 2 + 1); gtk_widget_show(s->s_separator); /* Icon */ w = gtk_image_new(); gtk_box_pack_start(GTK_BOX(s->s_hbox), w, FALSE, TRUE, 5); sub = prop_subscribe(0, PROP_TAG_NAME("self", "icon"), PROP_TAG_CALLBACK_STRING, home_set_icon, w, PROP_TAG_COURIER, glibcourier, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); gtk_image_set_from_stock(GTK_IMAGE(w), GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(w), 0.5, 0.5); gtk_misc_set_padding(GTK_MISC(w), 12, 0); /* vbox */ vbox = gtk_vbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(s->s_hbox), vbox, TRUE, TRUE, 0); /* Title */ w = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(w), 0, 0); gtk_label_set_ellipsize(GTK_LABEL(w), PANGO_ELLIPSIZE_END); gtk_box_pack_start(GTK_BOX(vbox), w, FALSE, TRUE, 0); sub = prop_subscribe(0, PROP_TAG_NAME("self", "title"), PROP_TAG_CALLBACK_STRING, gu_subscription_set_label_xl, w, PROP_TAG_COURIER, glibcourier, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); /* Status */ w = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(w), 0, 0); gtk_label_set_ellipsize(GTK_LABEL(w), PANGO_ELLIPSIZE_END); gtk_box_pack_start(GTK_BOX(vbox), w, FALSE, TRUE, 0); sub = prop_subscribe(0, PROP_TAG_NAME("self", "status"), PROP_TAG_CALLBACK_STRING, gu_subscription_set_label, w, PROP_TAG_COURIER, glibcourier, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); /* Spacer */ w = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), w, TRUE, FALSE, 0); /* Link */ hbox = gtk_hbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0); w = gtk_button_new(); gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(w), "clicked", G_CALLBACK(source_clicked), s); g_object_set(G_OBJECT(w), "label", "Open", NULL); sub = prop_subscribe(0, PROP_TAG_NAME("self", "url"), PROP_TAG_CALLBACK_STRING, source_set_url, s, PROP_TAG_COURIER, glibcourier, PROP_TAG_NAMED_ROOT, p, "self", NULL); gu_unsubscribe_on_destroy(GTK_OBJECT(w), sub); /* Finalize */ gtk_widget_show_all(s->s_hbox); }
static void rb_audiocd_source_constructed (GObject *object) { RBAudioCdSourcePrivate *priv; RBAudioCdSource *source; RBEntryView *entry_view; GtkCellRenderer *renderer; GtkTreeViewColumn *extract; GtkWidget *widget; GtkAction *action; RhythmDB *db; RBPlugin *plugin; RBShell *shell; char *ui_file; int toggle_width; RB_CHAIN_GOBJECT_METHOD (rb_audiocd_source_parent_class, constructed, object); source = RB_AUDIOCD_SOURCE (object); priv = AUDIOCD_SOURCE_GET_PRIVATE (source); g_object_set (G_OBJECT (source), "name", "Unknown Audio", NULL); g_object_get (source, "shell", &shell, NULL); priv->action_group = _rb_source_register_action_group (RB_SOURCE (source), "AudioCdActions", NULL, 0, NULL); _rb_action_group_add_source_actions (priv->action_group, G_OBJECT (shell), rb_audiocd_source_actions, G_N_ELEMENTS (rb_audiocd_source_actions)); g_object_unref (shell); action = gtk_action_group_get_action (priv->action_group, "AudioCdCopyTracks"); /* Translators: this is the toolbar button label for Copy to Library action. */ g_object_set (action, "short-label", _("Extract"), NULL); #if !defined(HAVE_SJ_METADATA_GETTER) action = gtk_action_group_get_action (priv->action_group, "AudioCdSourceReloadMetadata"); g_object_set (action, "visible", FALSE, NULL); #endif /* we want audio cds to sort by track# by default */ entry_view = rb_source_get_entry_view (RB_SOURCE (source)); rb_entry_view_set_sorting_order (entry_view, "Track", GTK_SORT_ASCENDING); /* enable in-place editing for titles, artists, and genres */ rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_TITLE, TRUE); rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_ARTIST, TRUE); rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_GENRE, TRUE); /* create the 'extract' column */ renderer = gtk_cell_renderer_toggle_new (); extract = gtk_tree_view_column_new (); gtk_tree_view_column_pack_start (extract, renderer, FALSE); gtk_tree_view_column_set_cell_data_func (extract, renderer, (GtkTreeCellDataFunc) extract_cell_data_func, source, NULL); gtk_tree_view_column_set_clickable (extract, TRUE); widget = gtk_check_button_new (); g_object_set (widget, "active", TRUE, NULL); gtk_widget_show_all (widget); g_signal_connect_object (extract, "clicked", G_CALLBACK (extract_column_clicked_cb), source, 0); gtk_tree_view_column_set_widget (extract, widget); g_signal_connect_object (renderer, "toggled", G_CALLBACK (extract_toggled_cb), source, 0); /* set column width */ gtk_cell_renderer_get_size (renderer, GTK_WIDGET (entry_view), NULL, NULL, NULL, &toggle_width, NULL); gtk_tree_view_column_set_sizing (extract, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_fixed_width (extract, toggle_width + 5); rb_entry_view_insert_column_custom (entry_view, extract, "", "Extract", NULL, NULL, NULL, 1); gtk_widget_set_tooltip_text (gtk_tree_view_column_get_widget (extract), _("Select tracks to be extracted")); /* hide the 'album' column */ gtk_tree_view_column_set_visible (rb_entry_view_get_column (entry_view, RB_ENTRY_VIEW_COL_ALBUM), FALSE); /* handle extra metadata requests for album artist and album artist sortname */ db = get_db_for_source (source); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-request::" RHYTHMDB_PROP_ALBUM_ARTIST, G_CALLBACK (album_artist_metadata_request_cb), source, 0); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-request::" RHYTHMDB_PROP_ALBUM_ARTIST_SORTNAME, G_CALLBACK (album_artist_sortname_metadata_request_cb), source, 0); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-gather", G_CALLBACK (metadata_gather_cb), source, 0); g_object_unref (db); /* set up the album info widgets */ g_object_get (source, "plugin", &plugin, NULL); ui_file = rb_plugin_find_file (plugin, "album-info.ui"); g_object_unref (plugin); if (ui_file == NULL) { g_warning ("couldn't find album-info.ui"); } else { RBAudioCdSourcePrivate *priv; GtkWidget *table; GtkBuilder *builder; #if defined(HAVE_SJ_METADATA_GETTER) && GTK_CHECK_VERSION(2,17,6) GtkWidget *box; char *message; #endif priv = AUDIOCD_SOURCE_GET_PRIVATE (source); builder = rb_builder_load (ui_file, NULL); g_free (ui_file); table = GTK_WIDGET (gtk_builder_get_object (builder, "album_info")); g_assert (table != NULL); #if defined(HAVE_SJ_METADATA_GETTER) && GTK_CHECK_VERSION(2,17,6) /* Info bar for non-Musicbrainz data */ priv->info_bar = gtk_info_bar_new_with_buttons (_("S_ubmit Album"), GTK_RESPONSE_OK, _("Hide"), GTK_RESPONSE_CANCEL, NULL); message = g_strdup_printf ("<b>%s</b>\n%s", _("Could not find this album on MusicBrainz."), _("You can improve the MusicBrainz database by adding this album.")); priv->info_bar_label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (priv->info_bar_label), message); gtk_label_set_justify (GTK_LABEL (priv->info_bar_label), GTK_JUSTIFY_LEFT); g_free (message); box = gtk_info_bar_get_content_area (GTK_INFO_BAR (priv->info_bar)); gtk_container_add (GTK_CONTAINER (box), priv->info_bar_label); gtk_widget_show_all (box); gtk_widget_set_no_show_all (priv->info_bar, TRUE); g_signal_connect (G_OBJECT (priv->info_bar), "response", G_CALLBACK (info_bar_response_cb), source); gtk_table_attach_defaults (GTK_TABLE (table), priv->info_bar, 0, 2, 0, 1); #endif priv->artist_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_entry")); priv->artist_sort_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_sort_entry")); priv->album_entry = GTK_WIDGET (gtk_builder_get_object (builder, "album_entry")); priv->year_entry = GTK_WIDGET (gtk_builder_get_object (builder, "year_entry")); priv->genre_entry = GTK_WIDGET (gtk_builder_get_object (builder, "genre_entry")); priv->disc_number_entry = GTK_WIDGET (gtk_builder_get_object (builder, "disc_number_entry")); g_signal_connect_object (priv->album_entry, "focus-out-event", G_CALLBACK (update_album_cb), source, 0); g_signal_connect_object (priv->genre_entry, "focus-out-event", G_CALLBACK (update_genre_cb), source, 0); g_signal_connect_object (priv->year_entry, "focus-out-event", G_CALLBACK (update_year_cb), source, 0); g_signal_connect_object (priv->disc_number_entry, "focus-out-event", G_CALLBACK (update_disc_number_cb), source, 0); gtk_box_pack_start (GTK_BOX (priv->box), table, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (priv->box), table, 0); g_object_unref (builder); } g_object_ref (G_OBJECT (source)); g_thread_create ((GThreadFunc)rb_audiocd_load_songs, source, FALSE, NULL); }
int main(int argc, char *argv[]) { bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); gtk_init(&argc, &argv); app = glade_xml_new(UIDIR "uda-postconfig.glade", NULL, NULL); win = glade_xml_get_widget(app, "uda_postconfig_win"); ok_button = glade_xml_get_widget(app, "ok_button"); net_conf = glade_xml_get_widget(app, "net_conf"); gtk_widget_set_sensitive(ok_button, FALSE); main_vbox = glade_xml_get_widget(app, "main_vbox"); event_box = gtk_event_box_new(); title_label = gtk_label_new(""); gtk_label_set_markup(GTK_LABEL(title_label), _ ("<span size=\"x-large\" weight=\"bold\" foreground=\"white\">SYSTEM INFORMATION</span>")); gtk_container_add(GTK_CONTAINER(event_box), title_label); gtk_box_pack_start(GTK_BOX(main_vbox), event_box, FALSE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(main_vbox), event_box, 0); gdk_color_parse("#7b96ad", &color); gtk_widget_modify_bg(event_box, GTK_STATE_NORMAL, &color); gtk_widget_set_size_request(GTK_WIDGET(title_label), -1, 40); help_tv = glade_xml_get_widget(app, "help_text_view"); adm_img = glade_xml_get_widget(app, "image_superuser"); gtk_image_set_from_file(GTK_IMAGE(adm_img), UIDIR "admin.png"); comp_img = glade_xml_get_widget(app, "image_computer"); gtk_image_set_from_file(GTK_IMAGE(comp_img), UIDIR "computer.png"); soft_img = glade_xml_get_widget(app, "image_repo"); gtk_image_set_from_file(GTK_IMAGE(soft_img), UIDIR "software.png"); name_entry = glade_xml_get_widget(app, "root_name_entry"); passwd_entry = glade_xml_get_widget(app, "root_passwd_entry"); passwd2_entry = glade_xml_get_widget(app, "root_passwd2_entry"); cname_entry = glade_xml_get_widget(app, "computer_name_entry"); screen = gdk_screen_get_default(); gtk_widget_set_size_request(help_tv, gdk_screen_get_width(screen) * 30 / 100, -1); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(help_tv)); set_help_text(); label_aviso = glade_xml_get_widget(app, "label_aviso"); FILE *exist; exist = fopen("/tmp/dhcp_ok","r"); if (exist) gtk_label_set_text (GTK_LABEL(label_aviso), "Su red ya ha sido configurada satisfactoriamente"); else gtk_label_set_text (GTK_LABEL(label_aviso), "!No se pudo configurar la red de forma automática!"); /* Signals */ g_signal_connect(G_OBJECT(GTK_EDITABLE(name_entry)), "changed", G_CALLBACK(name_entry_changed), NULL); g_signal_connect(G_OBJECT(GTK_EDITABLE(name_entry)), "insert_text", G_CALLBACK(names_entry_insert), NULL); g_signal_connect(G_OBJECT(GTK_EDITABLE(passwd_entry)), "changed", G_CALLBACK(passwd_entry_changed), NULL); g_signal_connect(G_OBJECT(GTK_EDITABLE(passwd2_entry)), "changed", G_CALLBACK(passwd2_entry_changed), NULL); g_signal_connect(G_OBJECT(GTK_EDITABLE(cname_entry)), "changed", G_CALLBACK(cname_entry_changed), NULL); g_signal_connect(G_OBJECT(GTK_EDITABLE(cname_entry)), "insert_text", G_CALLBACK(names_entry_insert), NULL); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_button_cb), NULL); g_signal_connect(G_OBJECT(net_conf),"clicked", G_CALLBACK(net_conf_clicked), NULL); gtk_window_fullscreen(GTK_WINDOW(win)); gtk_widget_show_all(win); gtk_main(); return 0; }
CVoxelView::CVoxelView(CVoxelDisplay& rVoxelDisplay) : m_rVoxelDisplay(rVoxelDisplay), m_pBuilderInterface(NULL), m_pCubeButton(NULL), m_pSphereButton(NULL), m_pMinScaleFactorSpinButton(NULL), m_pMaxScaleFactorSpinButton(NULL), m_f64MinScaleFactor(1), m_f64MaxScaleFactor(2), m_pThresholdRangeAndOrLabel(NULL), m_pMinDisplayThresholdBoundaryButton(NULL), m_pMaxDisplayThresholdBoundaryButton(NULL), m_pMinDisplayThresholdScale(NULL), m_pMaxDisplayThresholdScale(NULL), m_f64MinDisplayThreshold(0.25), m_f64MaxDisplayThreshold(0.75) { //load the gtk builder interface m_pBuilderInterface=gtk_builder_new(); // glade_xml_new(OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL, NULL); gtk_builder_add_from_file(m_pBuilderInterface, OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL); if(!m_pBuilderInterface) { g_warning("Couldn't load the interface!"); return; } gtk_builder_connect_signals(m_pBuilderInterface, NULL); //toolbar //------- //voxel object buttons m_pCubeButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "CubeButton")); m_pSphereButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "SphereButton")); g_signal_connect(G_OBJECT(m_pCubeButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this); g_signal_connect(G_OBJECT(m_pSphereButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")), "toggled", G_CALLBACK(toggleColorModificationCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")), "toggled", G_CALLBACK(toggleTransparencyModificationCallback), this); g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")), "toggled", G_CALLBACK(toggleSizeModificationCallback), this); //min voxel scale factor m_pMinScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinScaleFactorSpinButton")); m_rVoxelDisplay.setMinScaleFactor(m_f64MinScaleFactor); gtk_spin_button_configure( m_pMinScaleFactorSpinButton, GTK_ADJUSTMENT(gtk_adjustment_new( m_f64MinScaleFactor, //initial value 0, //lower 5, //upper 0.1, //step increment 0.5, //page increment 0)), //page size - deprecated 0.1, //climb rate 1); //digits g_signal_connect(G_OBJECT(m_pMinScaleFactorSpinButton), "value-changed", G_CALLBACK(setMinScaleFactorCallback), this); //max voxel scale factor m_pMaxScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxScaleFactorSpinButton")); m_rVoxelDisplay.setMaxScaleFactor(m_f64MaxScaleFactor); gtk_spin_button_configure( m_pMaxScaleFactorSpinButton, GTK_ADJUSTMENT(gtk_adjustment_new( m_f64MaxScaleFactor, //initial value 0, //lower 5, //upper 0.1, //step increment 0.5, //page increment 0)), //page size - deprecated 0.1, //climb rate 1); //digits g_signal_connect(G_OBJECT(m_pMaxScaleFactorSpinButton), "value-changed", G_CALLBACK(setMaxScaleFactorCallback), this); boolean l_bInclusiveDisplayThresholdBoundary = true; m_rVoxelDisplay.setDisplayThresholdBoundaryType(l_bInclusiveDisplayThresholdBoundary); //AND/OR label m_pThresholdRangeAndOrLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilderInterface, "ThresholdRangeAndOrLabel")); gtk_label_set_label(m_pThresholdRangeAndOrLabel, l_bInclusiveDisplayThresholdBoundary? "AND" : "OR"); //min display threshold boundary type m_pMinDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdBoundaryButton")); gtk_button_set_label(m_pMinDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? ">" : "<"); g_signal_connect(G_OBJECT(m_pMinDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMinDisplayThresholdBoundaryTypeCallback), this); //max display threshold boundary type m_pMaxDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdBoundaryButton")); gtk_button_set_label(m_pMaxDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? "<" : ">"); g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMaxDisplayThresholdBoundaryTypeCallback), this); //min display threshold slider m_pMinDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01)); m_rVoxelDisplay.setMinDisplayThreshold(m_f64MinDisplayThreshold); gtk_range_set_value(GTK_RANGE(m_pMinDisplayThresholdScale), m_f64MinDisplayThreshold); gtk_scale_set_value_pos(m_pMinDisplayThresholdScale, GTK_POS_TOP); gtk_range_set_update_policy(GTK_RANGE(m_pMinDisplayThresholdScale), GTK_UPDATE_CONTINUOUS); gtk_widget_set_size_request(GTK_WIDGET(m_pMinDisplayThresholdScale), 100, -1); gtk_widget_show_all(GTK_WIDGET(m_pMinDisplayThresholdScale)); g_signal_connect(G_OBJECT(m_pMinDisplayThresholdScale), "value_changed", G_CALLBACK(setMinDisplayThresholdCallback), this); //replace existing scale (which somehow can't be used) with the newly created one GtkWidget* l_pOldMinScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdScale")); GtkWidget* l_pMinScaleParent = gtk_widget_get_parent(l_pOldMinScale); if(l_pMinScaleParent != NULL && GTK_IS_CONTAINER(l_pMinScaleParent)) { gtk_container_remove(GTK_CONTAINER(l_pMinScaleParent), l_pOldMinScale); if(GTK_IS_BOX(l_pMinScaleParent)) { gtk_box_pack_start(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), 1); } } //max display threshold slider m_pMaxDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01)); m_rVoxelDisplay.setMaxDisplayThreshold(m_f64MaxDisplayThreshold); gtk_range_set_value(GTK_RANGE(m_pMaxDisplayThresholdScale), m_f64MaxDisplayThreshold); gtk_scale_set_value_pos(m_pMaxDisplayThresholdScale, GTK_POS_TOP); gtk_range_set_update_policy(GTK_RANGE(m_pMaxDisplayThresholdScale), GTK_UPDATE_CONTINUOUS); gtk_widget_set_size_request(GTK_WIDGET(m_pMaxDisplayThresholdScale), 100, -1); gtk_widget_show_all(GTK_WIDGET(m_pMaxDisplayThresholdScale)); g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdScale), "value_changed", G_CALLBACK(setMaxDisplayThresholdCallback), this); //replace existing scale (which somehow can't be used) with the newly created one GtkWidget* l_pOldMaxScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdScale")); GtkWidget* l_pMaxScaleParent = gtk_widget_get_parent(l_pOldMaxScale); if(l_pMaxScaleParent != NULL && GTK_IS_CONTAINER(l_pMaxScaleParent)) { gtk_container_remove(GTK_CONTAINER(l_pMaxScaleParent), l_pOldMaxScale); if(GTK_IS_BOX(l_pMaxScaleParent)) { gtk_box_pack_start(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), 1); } } //skull opacity slider GtkWidget* l_pSkullOpacityScale = gtk_hscale_new_with_range(0.0, 1.0, 0.05); float64 l_f64SkullOpacity = 0.07; gtk_range_set_value(GTK_RANGE(l_pSkullOpacityScale), l_f64SkullOpacity); m_rVoxelDisplay.setSkullOpacity(l_f64SkullOpacity); gtk_scale_set_value_pos(GTK_SCALE(l_pSkullOpacityScale), GTK_POS_TOP); gtk_range_set_update_policy(GTK_RANGE(l_pSkullOpacityScale), GTK_UPDATE_CONTINUOUS); gtk_widget_set_size_request(l_pSkullOpacityScale, 100, -1); gtk_widget_show_all(l_pSkullOpacityScale); g_signal_connect(G_OBJECT(l_pSkullOpacityScale), "value_changed", G_CALLBACK(setSkullOpacityCallback), this); //replace existing scale (which somehow can't be used) with the newly created one GtkWidget* l_pOldScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "SkullOpacityScale")); GtkWidget* l_pScaleParent = gtk_widget_get_parent(l_pOldScale); if(l_pScaleParent != NULL && GTK_IS_CONTAINER(l_pScaleParent)) { gtk_container_remove(GTK_CONTAINER(l_pScaleParent), l_pOldScale); if(GTK_IS_BOX(l_pScaleParent)) { gtk_box_pack_start(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, 0); } } //camera animation button GtkToggleToolButton* l_pAnimateCameraButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton")); g_signal_connect(G_OBJECT(l_pAnimateCameraButton), "toggled", G_CALLBACK(toggleAnimateCameraCallback), this); //reposition camera g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "RepositionCamera")), "clicked", G_CALLBACK(repositionCameraCallback), this); this->toggleColorModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")))?true:false); this->toggleTransparencyModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")))?true:false); this->toggleSizeModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")))?true:false); this->enableAutoCameraMovementCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton")))?true:false); }
void gimp_enum_radio_box_add (GtkBox *box, GtkWidget *widget, gint enum_value, gboolean below) { GList *children; GList *list; gint pos; g_return_if_fail (GTK_IS_BOX (box)); g_return_if_fail (GTK_IS_WIDGET (widget)); children = gtk_container_get_children (GTK_CONTAINER (box)); for (list = children, pos = 1; list; list = g_list_next (list), pos++) { if (GTK_IS_RADIO_BUTTON (list->data) && GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) == enum_value) { GtkWidget *radio = list->data; GtkWidget *hbox; hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (box), hbox, pos); if (below) { GtkWidget *spacer; gint indicator_size; gint indicator_spacing; gint focus_width; gint focus_padding; gint border_width; gtk_widget_style_get (radio, "indicator-size", &indicator_size, "indicator-spacing", &indicator_spacing, "focus-line-width", &focus_width, "focus-padding", &focus_padding, NULL); border_width = gtk_container_get_border_width (GTK_CONTAINER (radio)); spacer = gtk_vbox_new (FALSE, 0); gtk_widget_set_size_request (spacer, indicator_size + 3 * indicator_spacing + focus_width + focus_padding + border_width, -1); gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0); gtk_widget_show (spacer); } else { GtkSizeGroup *size_group; size_group = g_object_get_data (G_OBJECT (box), "size-group"); if (! size_group) { size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); g_object_set_data (G_OBJECT (box), "size-group", size_group); gtk_size_group_add_widget (size_group, radio); g_object_unref (size_group); } else { gtk_size_group_add_widget (size_group, radio); } gtk_box_set_spacing (GTK_BOX (hbox), 4); g_object_ref (radio); gtk_container_remove (GTK_CONTAINER (box), radio); gtk_box_pack_start (GTK_BOX (hbox), radio, FALSE, FALSE, 0); g_object_unref (radio); } gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); gtk_widget_show (widget); g_object_bind_property (radio, "active", widget, "sensitive", G_BINDING_SYNC_CREATE); gtk_widget_show (hbox); break; } } g_list_free (children); }
void enter(dt_view_t *self) { dt_map_t *lib = (dt_map_t *)self->data; lib->map = g_object_new (OSM_TYPE_GPS_MAP, "map-source", OSM_GPS_MAP_SOURCE_OPENSTREETMAP, "proxy-uri",g_getenv("http_proxy"), NULL); if(dt_conf_get_bool("plugins/map/show_map_osd")) { OsmGpsMapLayer *osd = g_object_new (OSM_TYPE_GPS_MAP_OSD, "show-scale",TRUE, "show-coordinates",TRUE, "show-dpad",TRUE, "show-zoom",TRUE, NULL); osm_gps_map_layer_add(OSM_GPS_MAP(lib->map), osd); g_object_unref(G_OBJECT(osd)); } /* replace center widget */ GtkWidget *parent = gtk_widget_get_parent(dt_ui_center(darktable.gui->ui)); gtk_widget_hide(dt_ui_center(darktable.gui->ui)); gtk_box_pack_start(GTK_BOX(parent), GTK_WIDGET(lib->map) ,TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(parent), GTK_WIDGET(lib->map), 2); gtk_widget_show_all(GTK_WIDGET(lib->map)); /* setup proxy functions */ darktable.view_manager->proxy.map.view = self; darktable.view_manager->proxy.map.center_on_location = _view_map_center_on_location; /* setup collection listener and initialize main_query statement */ dt_control_signal_connect(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED, G_CALLBACK(_view_map_collection_changed), (gpointer) self); osm_gps_map_set_post_expose_callback(lib->map, _view_map_post_expose, lib); /* restore last zoom,location in map */ OsmGpsMapPoint *pt; float lon, lat; const float rlon = dt_conf_get_float("plugins/map/longitude"); const float rlat = dt_conf_get_float("plugins/map/latitude"); const int zoom = dt_conf_get_int("plugins/map/zoom"); pt = osm_gps_map_point_new_radians(rlat,rlon); osm_gps_map_point_get_degrees (pt, &lat, &lon); osm_gps_map_set_center_and_zoom(lib->map, lat, lon, zoom); osm_gps_map_point_free(pt); _view_map_collection_changed(NULL, self); /* connect signal for filmstrip image activate */ dt_control_signal_connect(darktable.signals, DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE, G_CALLBACK(_view_map_filmstrip_activate_callback), self); /* allow drag&drop of images from filmstrip */ gtk_drag_dest_set(GTK_WIDGET(lib->map), GTK_DEST_DEFAULT_ALL, target_list, n_targets, GDK_ACTION_COPY); g_signal_connect(GTK_WIDGET(lib->map), "drag-data-received", G_CALLBACK(drag_and_drop_received), self); }
void PrintReferencesDialog::on_button_add(const ustring & project) // Adds a new project to the gui. { // Get list of all projects. vector < ustring > projects = projects_get_all(); // Only add the project if it exists. if (!project.empty()) { if (!project_exists(project)) { return; } } // All the widgets we're going to insert. GtkWidget *hbox5; SelectProjectGui *selectprojectgui; GtkWidget *button_additional_project; GtkWidget *alignment1; GtkWidget *hbox6; GtkWidget *image1; GtkWidget *label17; // Build GUI. hbox5 = gtk_hbox_new(FALSE, 4); gtk_widget_show(hbox5); gtk_box_pack_start(GTK_BOX(vbox1), hbox5, TRUE, TRUE, 0); selectprojectgui = new SelectProjectGui(0); selectprojectgui->build(hbox5, "", project); button_additional_project = gtk_button_new(); gtk_widget_show(button_additional_project); gtk_box_pack_start(GTK_BOX(hbox5), button_additional_project, FALSE, FALSE, 0); alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(alignment1); gtk_container_add(GTK_CONTAINER(button_additional_project), alignment1); hbox6 = gtk_hbox_new(FALSE, 2); gtk_widget_show(hbox6); gtk_container_add(GTK_CONTAINER(alignment1), hbox6); image1 = gtk_image_new_from_stock("gtk-remove", GTK_ICON_SIZE_BUTTON); gtk_widget_show(image1); gtk_box_pack_start(GTK_BOX(hbox6), image1, FALSE, FALSE, 0); label17 = gtk_label_new_with_mnemonic(_("Remove")); gtk_widget_show(label17); gtk_box_pack_start(GTK_BOX(hbox6), label17, FALSE, FALSE, 0); g_signal_connect((gpointer) button_additional_project, "clicked", G_CALLBACK(on_button_additional_project_clicked), gpointer(this)); gtk_box_reorder_child(GTK_BOX(vbox1), hbox5, hboxes.size() + 7); // Store the relevant widgets. hboxes.push_back(hbox5); selectprojectguis.push_back(selectprojectgui); buttons.push_back(button_additional_project); // Reorder the accelerators on the remove buttons. rewrite_button_labels(); }
static void nouvelle_convers(PurpleConversation *conv, void *data) { // printf("Une nouvelle conversation:%s!!\n", purple_conversation_get_name(conv)); PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); GtkWidget *bbox=gtkconv->lower_hbox; GtkWidget *icon; GtkWidget *menu; GtkWidget *menuitem; void **arg; GtkSizeGroup *sg; int i, ret, handle; int argcp; char **argvp; char *gamename; GdkPixbuf *pixbuf; GtkIconSet *iconset; GtkIconFactory *factory; factory = gtk_icon_factory_new(); gtk_icon_factory_add_default(factory); pixbuf = gdk_pixbuf_new_from_xpm_data(ggz_xpm); iconset = gtk_icon_set_new_from_pixbuf(pixbuf); g_object_unref(G_OBJECT(pixbuf)); gtk_icon_factory_add (factory, "ggzicon", iconset); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); #if PURPLE_MAJOR_VERSION < 2 icon = purple_gtkconv_button_new("ggzicon", "Jouer", "Pfff", gtkconv->tooltips, GTK_SIGNAL_FUNC(PopMenu), NULL); #else icon = NULL; /* FIXME! */ #endif if(icon == NULL) { printf("Arf :/ \n"); return; } else { printf("OK :) \n"); } /* Menu */ menu = gtk_menu_new(); handle = ggz_conf_parse(GGZMODULECONFIG, GGZ_CONF_RDONLY); ret = ggz_conf_read_list(handle, "Games", "*Engines*", &argcp, &argvp); for(i = 0; i < argcp; i++) { gamename = argvp[i]; arg = malloc(sizeof(void*)*2); arg[0] = (gpointer)conv; arg[1] = strdup(gamename); menuitem = gtk_menu_item_new_with_label(gamename); gtk_signal_connect_object(GTK_OBJECT(menuitem), "event", GTK_SIGNAL_FUNC(icon_clicked), (gpointer) arg); gtk_menu_append(GTK_MENU(menu), menuitem); gtk_widget_show(menuitem); } ggz_conf_close(handle); //Menu général gtk_signal_connect_object(GTK_OBJECT(icon), "event", GTK_SIGNAL_FUNC(PopMenu), GTK_OBJECT(menu)); //Fin menu gtk_box_pack_start(GTK_BOX(bbox), icon, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(icon), GTK_RELIEF_NONE); gtk_tooltips_set_tip(gtkconv->tooltips, icon, g_strdup("Clickez sur ce bouton pour jouer avec votre correspondant"), 0); g_hash_table_insert(conv->data, g_strdup("icon"), icon); gtk_size_group_add_widget(sg, icon); gtk_box_reorder_child(GTK_BOX(bbox), icon, 7); gtk_widget_show(icon); }
static void carrick_list_drag_end (GtkWidget *widget, GdkDragContext *context, CarrickList *list) { CarrickListPrivate *priv = list->priv; GList *children; children = gtk_container_get_children (GTK_CONTAINER (priv->box)); /* destroy the popup window */ g_object_ref (widget); gtk_container_remove (GTK_CONTAINER (priv->drag_window), widget); gtk_widget_destroy (priv->drag_window); priv->drag_window = NULL; /* insert the widget into the list */ gtk_box_pack_start (GTK_BOX (priv->box), widget, FALSE, FALSE, 2); gtk_box_reorder_child (GTK_BOX (priv->box), widget, priv->drop_position); g_object_unref (widget); if (priv->drop_position != priv->drag_position) { GtkWidget *other_widget; DBusGProxy *service, * other_service; const gchar *path; move_data *data = NULL; service = carrick_service_item_get_proxy (CARRICK_SERVICE_ITEM (widget)); data = g_slice_new0 (move_data); data->list = GTK_WIDGET (list->priv->box); data->item = widget; data->pos = priv->drag_position; if (priv->drop_position == 0) { other_widget = g_list_nth_data (children, 0); other_service = carrick_service_item_get_proxy (CARRICK_SERVICE_ITEM (other_widget)); path = dbus_g_proxy_get_path (other_service); net_connman_Service_move_before_async (service, path, move_notify_cb, data); } else { other_widget = g_list_nth_data (children, priv->drop_position - 1); other_service = carrick_service_item_get_proxy (CARRICK_SERVICE_ITEM (other_widget)); path = dbus_g_proxy_get_path (other_service); net_connman_Service_move_after_async (service, path, move_notify_cb, data); } } g_list_free (children); }
static void device_changed_cb(const gchar *name, PurplePrefType type, gconstpointer value, gpointer data) { GtkSizeGroup *sg = data; GtkWidget *parent, *widget; GSList *widgets; GList *devices; GValue gvalue; gint position; gchar *label, *pref; widgets = gtk_size_group_get_widgets(GTK_SIZE_GROUP(sg)); for (; widgets; widgets = g_slist_next(widgets)) { const gchar *widget_name = gtk_widget_get_name(GTK_WIDGET(widgets->data)); if (!strcmp(widget_name, name)) { gchar *temp_str; gchar delimiters[3] = {0, 0, 0}; const gchar *text; gint keyval, pos; widget = widgets->data; /* Get label with _ from the GtkLabel */ text = gtk_label_get_text(GTK_LABEL(widget)); keyval = gtk_label_get_mnemonic_keyval(GTK_LABEL(widget)); delimiters[0] = g_ascii_tolower(keyval); delimiters[1] = g_ascii_toupper(keyval); pos = strcspn(text, delimiters); if (pos != -1) { temp_str = g_strndup(text, pos); label = g_strconcat(temp_str, "_", text + pos, NULL); g_free(temp_str); } else { label = g_strdup(text); } break; } } if (widgets == NULL) return; parent = gtk_widget_get_parent(widget); widget = parent; parent = gtk_widget_get_parent(GTK_WIDGET(widget)); gvalue.g_type = 0; g_value_init(&gvalue, G_TYPE_INT); gtk_container_child_get_property(GTK_CONTAINER(parent), GTK_WIDGET(widget), "position", &gvalue); position = g_value_get_int(&gvalue); g_value_unset(&gvalue); gtk_widget_destroy(widget); pref = g_strdup(name); strcpy(pref + strlen(pref) - strlen("plugin"), "device"); devices = get_element_devices(value); if (g_list_find_custom(devices, purple_prefs_get_string(pref), (GCompareFunc)strcmp) == NULL) purple_prefs_set_string(pref, g_list_next(devices)->data); widget = pidgin_prefs_dropdown_from_list(parent, label, PURPLE_PREF_STRING, pref, devices); g_list_free(devices); g_signal_connect_swapped(widget, "destroy", G_CALLBACK(g_free), pref); g_free(label); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5); gtk_widget_set_name(widget, name); gtk_size_group_add_widget(sg, widget); gtk_box_reorder_child(GTK_BOX(parent), gtk_widget_get_parent(GTK_WIDGET(widget)), position); }
static GtkWidget * gradient_box_new (GimpContainer *container, GimpContext *context, const gchar *label, gint spacing, GimpViewType view_type, GimpViewSize view_size, const gchar *reverse_prop, const gchar *editor_id, const gchar *editor_tooltip) { GtkWidget *hbox; GtkWidget *button; GList *children; if (! container) container = gimp_data_factory_get_container (context->gimp->gradient_factory); hbox = gimp_viewable_box_new (container, context, label, spacing, view_type, GIMP_VIEW_SIZE_SMALL, view_size, "gimp-gradient-list|gimp-gradient-grid", GIMP_STOCK_GRADIENT, _("Open the gradient selection dialog"), editor_id, editor_tooltip); children = gtk_container_get_children (GTK_CONTAINER (hbox)); button = children->data; g_list_free (children); GIMP_VIEWABLE_BUTTON (button)->button_view_size = GIMP_VIEW_SIZE_SMALL; if (reverse_prop) { GtkWidget *toggle; GtkWidget *view; GtkWidget *image; gchar *signal_name; toggle = gimp_prop_check_button_new (G_OBJECT (context), reverse_prop, NULL); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle), FALSE); gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (hbox), toggle, 1); gtk_widget_show (toggle); gimp_help_set_help_data (toggle, _("Reverse"), NULL); image = gtk_image_new_from_icon_name (GIMP_STOCK_FLIP_HORIZONTAL, GTK_ICON_SIZE_MENU); /* gimp_prop_check_button_new() adds the property nick as label of * the button by default. */ gtk_container_remove (GTK_CONTAINER (toggle), gtk_bin_get_child (GTK_BIN (toggle))); gtk_container_add (GTK_CONTAINER (toggle), image); gtk_widget_show (image); view = gtk_bin_get_child (GTK_BIN (button)); signal_name = g_strconcat ("notify::", reverse_prop, NULL); g_signal_connect_object (context, signal_name, G_CALLBACK (gimp_gradient_box_reverse_notify), G_OBJECT (view), 0); g_free (signal_name); gimp_gradient_box_reverse_notify (G_OBJECT (context), NULL, GIMP_VIEW (view)); } return hbox; }
void dt_dev_reload_history_items(dt_develop_t *dev) { dt_dev_pop_history_items(dev, 0); // remove unused history items: GList *history = g_list_nth(dev->history, dev->history_end); while(history) { GList *next = g_list_next(history); dt_dev_history_item_t *hist = (dt_dev_history_item_t *)(history->data); free(hist->params); free(hist->blend_params); free(history->data); dev->history = g_list_delete_link(dev->history, history); history = next; } dt_dev_read_history(dev); //we have to add new module instances first GList *modules = dev->iop; while(modules) { dt_iop_module_t *module = (dt_iop_module_t *)(modules->data); if (module->multi_priority > 0) { if (!dt_iop_is_hidden(module) && !module->expander) { module->gui_init(module); dt_iop_reload_defaults(module); //we search the base iop corresponding GList *mods = g_list_first(dev->iop); dt_iop_module_t *base = NULL; int pos_module = 0; int pos_base = 0; int pos = 0; while (mods) { dt_iop_module_t *mod = (dt_iop_module_t *)(mods->data); if (mod->multi_priority == 0 && mod->instance == module->instance) { base = mod; pos_base = pos; } else if (mod == module) pos_module = pos; mods = g_list_next(mods); pos++; } if (!base) continue; /* add module to right panel */ GtkWidget *expander = dt_iop_gui_get_expander(module); dt_ui_container_add_widget(darktable.gui->ui, DT_UI_CONTAINER_PANEL_RIGHT_CENTER, expander); GValue gv = { 0, { { 0 } } }; g_value_init(&gv,G_TYPE_INT); gtk_container_child_get_property(GTK_CONTAINER(dt_ui_get_container(darktable.gui->ui, DT_UI_CONTAINER_PANEL_RIGHT_CENTER)),base->expander,"position",&gv); gtk_box_reorder_child (dt_ui_get_container(darktable.gui->ui, DT_UI_CONTAINER_PANEL_RIGHT_CENTER),expander,g_value_get_int(&gv)+pos_base-pos_module); dt_iop_gui_set_expanded(module, TRUE); dt_iop_gui_update_blending(module); //the pipe need to be reconstruct dev->pipe->changed |= DT_DEV_PIPE_REMOVE; dev->preview_pipe->changed |= DT_DEV_PIPE_REMOVE; } } modules = g_list_next(modules); } dt_dev_pop_history_items(dev, dev->history_end); }
CTopographicMap3DView::CTopographicMap3DView(CTopographicMap3DDisplay& rTopographicMap3DDisplay, CTopographicMapDatabase& rTopographicMapDatabase, uint64 ui64DefaultInterpolation, float64 f64Delay) : m_rTopographicMap3DDisplay(rTopographicMap3DDisplay), m_rTopographicMapDatabase(rTopographicMapDatabase), m_f64MaxDelay(2.0), //maximum delay : 2s m_pBuilderInterface(NULL), m_ui64CurrentInterpolation(ui64DefaultInterpolation), m_pMapPotentials(NULL), m_pMapCurrents(NULL), m_pElectrodesToggleButton(NULL), m_bElectrodesToggledOn(false)//, //m_pSamplingPointsToggleButton(NULL), //m_bSamplingPointsToggledOn(false) { //load the gtk builder interface m_pBuilderInterface=gtk_builder_new(); // glade_xml_new(OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-TopographicMap3D.ui", NULL, NULL); gtk_builder_add_from_file(m_pBuilderInterface, OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-TopographicMap3D.ui", NULL); if(!m_pBuilderInterface) { g_warning("Couldn't load the interface!"); return; } gtk_builder_connect_signals(m_pBuilderInterface, NULL); //toolbar //------- //get pointers to interpolation type buttons m_pMapPotentials = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MapPotentials")); m_pMapCurrents = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MapCurrents")); g_signal_connect(G_OBJECT(m_pMapPotentials), "toggled", G_CALLBACK (setInterpolationCallback), this); g_signal_connect(G_OBJECT(m_pMapCurrents), "toggled", G_CALLBACK (setInterpolationCallback), this); //get pointer to electrodes toggle button m_pElectrodesToggleButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ToggleElectrodes")); //disable electrodes by default m_bElectrodesToggledOn = false; gtk_toggle_tool_button_set_active(m_pElectrodesToggleButton, m_bElectrodesToggledOn); //connect callback g_signal_connect(G_OBJECT(m_pElectrodesToggleButton), "toggled", G_CALLBACK(toggleElectrodesCallback), this); //get pointer to sampling points toggle button //m_pSamplingPointsToggleButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ToggleSamplingPoints")); //disable sampling points by default //m_bSamplingPointsToggledOn = false; //gtk_toggle_tool_button_set_active(m_pSamplingPointsToggleButton, m_bSamplingPointsToggledOn); //connect callback //g_signal_connect(G_OBJECT(m_pSamplingPointsToggleButton), "toggled", G_CALLBACK(toggleSamplingPointsCallback), this); //tell database about maximum delay m_rTopographicMapDatabase.adjustNumberOfDisplayedBuffers(m_f64MaxDelay); //ensure default delay lies in [0, m_f64MaxDelay] if(f64Delay > m_f64MaxDelay) { f64Delay = m_f64MaxDelay; } //set default delay setDelayCB(f64Delay); //configure delay slider GtkWidget* l_pDelayScale = gtk_hscale_new_with_range(0.0, m_f64MaxDelay, 0.1); gtk_range_set_value(GTK_RANGE(l_pDelayScale), f64Delay); gtk_scale_set_value_pos(GTK_SCALE(l_pDelayScale), GTK_POS_TOP); gtk_range_set_update_policy(GTK_RANGE(l_pDelayScale), GTK_UPDATE_CONTINUOUS); gtk_widget_set_size_request(l_pDelayScale, 100, -1); gtk_widget_show_all(l_pDelayScale); g_signal_connect(G_OBJECT(l_pDelayScale), "value_changed", G_CALLBACK(setDelayCallback), this); //replace existing scale (which somehow can't be used) with the newly created one GtkWidget* l_pOldScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "DelayScale")); GtkWidget* l_pScaleParent = gtk_widget_get_parent(l_pOldScale); if(l_pScaleParent != NULL && GTK_IS_CONTAINER(l_pScaleParent)) { gtk_container_remove(GTK_CONTAINER(l_pScaleParent), l_pOldScale); if(GTK_IS_BOX(l_pScaleParent)) { gtk_box_pack_start(GTK_BOX(l_pScaleParent), l_pDelayScale, TRUE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(l_pScaleParent), l_pDelayScale, 0); } } }
static gint _create_new(const gchar *filename, const gchar *key, gint editor_type) { EDITOR *editor; GtkWidget *vbox = NULL; GtkWidget *toolbar_nav = NULL; editor = g_new(EDITOR, 1); editor->html_widget = NULL; editor->sync = FALSE; editor->type = editor_type; switch (editor_type) { case STUDYPAD_EDITOR: editor->studypad = TRUE; editor->bookeditor = FALSE; editor->noteeditor = FALSE; editor->module = NULL; editor->key = NULL; editor->filename = NULL; widgets.studypad_dialog = editor_new(_("StudyPad"), editor); if (filename) { editor->filename = g_strdup(filename); _load_file(editor, g_strdup(filename)); } break; case NOTE_EDITOR: editor->noteeditor = TRUE; editor->bookeditor = FALSE; editor->studypad = FALSE; editor->filename = NULL; editor->module = g_strdup(filename); editor->key = g_strdup(key); editor->navbar.key = NULL; editor_new(_("Note Editor"), editor); vbox = GTKHTML_EDITOR(editor->window)->vbox; toolbar_nav = gui_navbar_versekey_editor_new(editor); gtk_widget_show(toolbar_nav); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(toolbar_nav), FALSE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(vbox), GTK_WIDGET(toolbar_nav), 1); editor_load_note(editor, NULL, NULL); break; case BOOK_EDITOR: editor->bookeditor = TRUE; editor->noteeditor = FALSE; editor->studypad = FALSE; editor->filename = NULL; editor->module = g_strdup(filename); editor->key = g_strdup(key); editor_new(_("Prayer List/Journal Editor"), editor); GtkWidget *box; UI_VBOX(box, TRUE, 0); gtk_widget_show(box); GtkWidget *hpaned1 = UI_HPANE(); gtk_widget_show(hpaned1); gtk_paned_pack2(GTK_PANED(hpaned1), box, TRUE, TRUE); GtkWidget *scrollbar = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrollbar); gtk_paned_pack1(GTK_PANED(hpaned1), GTK_WIDGET(scrollbar), TRUE, TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbar), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrollbar, settings.shadow_type); editor->treeview = gui_create_editor_tree(editor); gtk_widget_show(editor->treeview); gtk_container_add(GTK_CONTAINER(scrollbar), editor->treeview); gtk_paned_set_position(GTK_PANED(hpaned1), 125); gtk_tree_view_collapse_all((GtkTreeView *) editor->treeview); // then we should expand on the item to which we've opened for edit. vbox = GTKHTML_EDITOR(editor->window)->vbox; gtk_widget_reparent(vbox, box); gtk_container_add(GTK_CONTAINER(editor->window), hpaned1); editor_load_book(editor); break; } editor->is_changed = FALSE; editors_all = g_list_append(editors_all, (EDITOR *)editor); return 1; }
void liferea_shell_create (GtkApplication *app, const gchar *overrideWindowState) { GtkUIManager *ui_manager; GtkAccelGroup *accel_group; GError *error = NULL; gboolean toggle; gchar *id; debug_enter ("liferea_shell_create"); g_object_new (LIFEREA_SHELL_TYPE, NULL); shell->priv->window = GTK_WINDOW (liferea_shell_lookup ("mainwindow")); gtk_window_set_application (GTK_WINDOW (shell->priv->window), app); /* 1.) menu creation */ debug0 (DEBUG_GUI, "Setting up menues"); shell->priv->itemlist = itemlist_create (); /* Prepare some toggle button states */ conf_get_bool_value (REDUCED_FEEDLIST, &toggle); liferea_shell_feedlist_toggle_entries[0].is_active = toggle; ui_manager = gtk_ui_manager_new (); shell->priv->generalActions = gtk_action_group_new ("GeneralActions"); gtk_action_group_set_translation_domain (shell->priv->generalActions, PACKAGE); gtk_action_group_add_actions (shell->priv->generalActions, liferea_shell_action_entries, G_N_ELEMENTS (liferea_shell_action_entries), shell->priv); gtk_action_group_add_toggle_actions (shell->priv->generalActions, liferea_shell_action_toggle_entries, G_N_ELEMENTS (liferea_shell_action_toggle_entries), shell->priv); gtk_action_group_add_radio_actions (shell->priv->generalActions, liferea_shell_view_radio_entries, G_N_ELEMENTS (liferea_shell_view_radio_entries), itemlist_get_view_mode (), (GCallback)on_view_activate, (gpointer)TRUE); gtk_action_group_add_toggle_actions (shell->priv->generalActions, liferea_shell_feedlist_toggle_entries, G_N_ELEMENTS (liferea_shell_feedlist_toggle_entries), shell->priv); gtk_ui_manager_insert_action_group (ui_manager, shell->priv->generalActions, 0); shell->priv->addActions = gtk_action_group_new ("AddActions"); gtk_action_group_set_translation_domain (shell->priv->addActions, PACKAGE); gtk_action_group_add_actions (shell->priv->addActions, liferea_shell_add_action_entries, G_N_ELEMENTS (liferea_shell_add_action_entries), shell->priv); gtk_ui_manager_insert_action_group (ui_manager, shell->priv->addActions, 0); shell->priv->feedActions = gtk_action_group_new ("FeedActions"); gtk_action_group_set_translation_domain (shell->priv->feedActions, PACKAGE); gtk_action_group_add_actions (shell->priv->feedActions, liferea_shell_feed_action_entries, G_N_ELEMENTS (liferea_shell_feed_action_entries), shell->priv); gtk_ui_manager_insert_action_group (ui_manager, shell->priv->feedActions, 0); shell->priv->readWriteActions = gtk_action_group_new("ReadWriteActions"); gtk_action_group_set_translation_domain (shell->priv->readWriteActions, PACKAGE); gtk_action_group_add_actions (shell->priv->readWriteActions, liferea_shell_read_write_action_entries, G_N_ELEMENTS (liferea_shell_read_write_action_entries), shell->priv); gtk_ui_manager_insert_action_group (ui_manager, shell->priv->readWriteActions, 0); shell->priv->itemActions = gtk_action_group_new ("ItemActions"); gtk_action_group_set_translation_domain (shell->priv->itemActions, PACKAGE); gtk_action_group_add_actions (shell->priv->itemActions, liferea_shell_item_action_entries, G_N_ELEMENTS (liferea_shell_item_action_entries), shell->priv); gtk_ui_manager_insert_action_group (ui_manager, shell->priv->itemActions, 0); accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (shell->priv->window), accel_group); g_object_unref (accel_group); g_signal_connect (gtk_accel_map_get (), "changed", G_CALLBACK (on_accel_change), NULL); if (!gtk_ui_manager_add_ui_from_string (ui_manager, liferea_shell_ui_desc, -1, &error)) g_error ("building menus failed: %s", error->message); shell->priv->menubar = gtk_ui_manager_get_widget (ui_manager, "/MainwindowMenubar"); shell->priv->toolbar = gtk_ui_manager_get_widget (ui_manager, "/maintoolbar"); /* Ensure GTK3 toolbar shadows... */ gtk_style_context_add_class (gtk_widget_get_style_context (shell->priv->toolbar), "primary-toolbar"); /* what a pain, why is there no markup for this option? */ g_object_set (G_OBJECT (gtk_ui_manager_get_widget (ui_manager, "/maintoolbar/newFeedButton")), "is_important", TRUE, NULL); g_object_set (G_OBJECT (gtk_ui_manager_get_widget (ui_manager, "/maintoolbar/nextUnreadButton")), "is_important", TRUE, NULL); g_object_set (G_OBJECT (gtk_ui_manager_get_widget (ui_manager, "/maintoolbar/MarkAsReadButton")), "is_important", TRUE, NULL); g_object_set (G_OBJECT (gtk_ui_manager_get_widget (ui_manager, "/maintoolbar/UpdateAllButton")), "is_important", TRUE, NULL); g_object_set (G_OBJECT (gtk_ui_manager_get_widget (ui_manager, "/maintoolbar/SearchButton")), "is_important", TRUE, NULL); /* 2.) setup containers */ debug0 (DEBUG_GUI, "Setting up widget containers"); gtk_box_pack_start (GTK_BOX (liferea_shell_lookup ("vbox1")), shell->priv->toolbar, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (liferea_shell_lookup ("vbox1")), shell->priv->toolbar, 0); gtk_box_pack_start (GTK_BOX (liferea_shell_lookup ("vbox1")), shell->priv->menubar, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (liferea_shell_lookup ("vbox1")), shell->priv->menubar, 0); gtk_widget_show_all(GTK_WIDGET(shell->priv->toolbar)); g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_press_event", G_CALLBACK (on_key_press_event_null_cb), NULL); g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_release_event", G_CALLBACK (on_key_press_event_null_cb), NULL); g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "scroll_event", G_CALLBACK (on_notebook_scroll_event_null_cb), NULL); g_signal_connect (G_OBJECT (shell->priv->window), "delete_event", G_CALLBACK(on_close), shell->priv); g_signal_connect (G_OBJECT (shell->priv->window), "window_state_event", G_CALLBACK(on_window_state_event), shell->priv); g_signal_connect (G_OBJECT (shell->priv->window), "key_press_event", G_CALLBACK(on_key_press_event), shell->priv); /* 3.) setup status bar */ debug0 (DEBUG_GUI, "Setting up status bar"); shell->priv->statusbar = GTK_STATUSBAR (liferea_shell_lookup ("statusbar")); shell->priv->statusbarLocked = FALSE; shell->priv->statusbarLockTimer = 0; shell->priv->statusbar_feedsinfo = gtk_label_new(""); gtk_widget_show(shell->priv->statusbar_feedsinfo); gtk_box_pack_start (GTK_BOX (shell->priv->statusbar), shell->priv->statusbar_feedsinfo, FALSE, FALSE, 5); /* 4.) setup tabs */ debug0 (DEBUG_GUI, "Setting up tabbed browsing"); shell->priv->tabs = browser_tabs_create (GTK_NOTEBOOK (liferea_shell_lookup ("browsertabs"))); /* 5.) setup feed list */ debug0 (DEBUG_GUI, "Setting up feed list"); shell->priv->feedlistView = GTK_TREE_VIEW (liferea_shell_lookup ("feedlist")); feed_list_view_init (shell->priv->feedlistView); /* 6.) setup menu sensivity */ debug0 (DEBUG_GUI, "Initialising menues"); /* On start, no item or feed is selected, so Item menu should be insensitive: */ liferea_shell_update_item_menu (FALSE); /* necessary to prevent selection signals when filling the feed list and setting the 2/3 pane mode view */ gtk_widget_set_sensitive (GTK_WIDGET (shell->priv->feedlistView), FALSE); /* 7.) setup item view */ debug0 (DEBUG_GUI, "Setting up item view"); shell->priv->itemview = itemview_create (GTK_WIDGET (shell->priv->window)); /* 8.) load icons as required */ debug0 (DEBUG_GUI, "Loading icons"); icons_load (); /* 9.) update and restore all menu elements */ liferea_shell_update_toolbar (); liferea_shell_update_history_actions (); liferea_shell_setup_URL_receiver (); liferea_shell_restore_state (overrideWindowState); gtk_widget_set_sensitive (GTK_WIDGET (shell->priv->feedlistView), TRUE); /* 10.) After main window is realized get theme colors and set up feed list and tray icon */ render_init_theme_colors (GTK_WIDGET (shell->priv->window)); shell->priv->feedlist = feedlist_create (); g_signal_connect (shell->priv->feedlist, "new-items", G_CALLBACK (liferea_shell_update_unread_stats), shell->priv->feedlist); /* 11.) Restore latest selection */ // FIXME: Move to feed list code if (conf_get_str_value (LAST_NODE_SELECTED, &id)) { feed_list_view_select (node_from_id (id)); g_free (id); } /* 12. Setup shell plugins */ shell->priv->extensions = peas_extension_set_new (PEAS_ENGINE (liferea_plugins_engine_get_default ()), LIFEREA_TYPE_SHELL_ACTIVATABLE, "shell", shell, NULL); g_signal_connect (shell->priv->extensions, "extension-added", G_CALLBACK (on_extension_added), shell); g_signal_connect (shell->priv->extensions, "extension-removed", G_CALLBACK (on_extension_removed), shell); peas_extension_set_call (shell->priv->extensions, "activate"); /* 14. Rebuild search folders if needed */ if (searchFolderRebuild) vfolder_foreach (vfolder_rebuild); debug_exit ("liferea_shell_create"); }
GtkWidget * gimp_bucket_fill_options_gui (GimpToolOptions *tool_options) { GObject *config = G_OBJECT (tool_options); GtkWidget *vbox = gimp_paint_options_gui (tool_options); GtkWidget *vbox2; GtkWidget *frame; GtkWidget *hbox; GtkWidget *button; GtkWidget *scale; GtkWidget *combo; gchar *str; GdkModifierType toggle_mask; toggle_mask = gimp_get_toggle_behavior_mask (); /* fill type */ str = g_strdup_printf (_("Fill Type (%s)"), gimp_get_mod_string (toggle_mask)), frame = gimp_prop_enum_radio_frame_new (config, "fill-mode", str, 0, 0); g_free (str); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), NULL, 2, "pattern-view-type", "pattern-view-size"); gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_BUCKET_FILL, TRUE); /* fill selection */ str = g_strdup_printf (_("Affected Area (%s)"), gimp_get_mod_string (GDK_SHIFT_MASK)); frame = gimp_prop_boolean_radio_frame_new (config, "fill-selection", str, _("Fill whole selection"), _("Fill similar colors")); g_free (str); gtk_box_reorder_child (GTK_BOX (gtk_bin_get_child (GTK_BIN (frame))), g_object_get_data (G_OBJECT (frame), "radio-button"), 1); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); frame = gimp_frame_new (_("Finding Similar Colors")); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); g_object_bind_property (config, "fill-selection", frame, "sensitive", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (frame), vbox2); gtk_widget_show (vbox2); /* the fill transparent areas toggle */ button = gimp_prop_check_button_new (config, "fill-transparent", _("Fill transparent areas")); gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); /* the sample merged toggle */ button = gimp_prop_check_button_new (config, "sample-merged", _("Sample merged")); gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_widget_show (button); /* the threshold scale */ scale = gimp_prop_spin_scale_new (config, "threshold", _("Threshold"), 1.0, 16.0, 1); gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0); gtk_widget_show (scale); /* the fill criterion combo */ combo = gimp_prop_enum_combo_box_new (config, "fill-criterion", 0, 0); gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Fill by")); gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0); gtk_widget_show (combo); return vbox; }
void glade_gtk_box_set_child_property (GladeWidgetAdaptor * adaptor, GObject * container, GObject * child, const gchar * property_name, GValue * value) { GladeWidget *gbox, *gchild, *gchild_iter; GList *children, *list; gboolean is_position; gint old_position, iter_position, new_position; static gboolean recursion = FALSE; g_return_if_fail (GTK_IS_BOX (container)); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (property_name != NULL || value != NULL); gbox = glade_widget_get_from_gobject (container); gchild = glade_widget_get_from_gobject (child); g_return_if_fail (GLADE_IS_WIDGET (gbox)); if (gtk_widget_get_parent (GTK_WIDGET (child)) != GTK_WIDGET (container)) return; /* Get old position */ if ((is_position = (strcmp (property_name, "position") == 0)) != FALSE) { gtk_container_child_get (GTK_CONTAINER (container), GTK_WIDGET (child), property_name, &old_position, NULL); /* Get the real value */ new_position = g_value_get_int (value); } if (is_position && recursion == FALSE) { children = glade_widget_get_children (gbox); children = g_list_sort (children, (GCompareFunc) sort_box_children); for (list = children; list; list = list->next) { gchild_iter = glade_widget_get_from_gobject (list->data); if (gchild_iter == gchild) { gtk_box_reorder_child (GTK_BOX (container), GTK_WIDGET (child), new_position); continue; } /* Get the old value from glade */ glade_widget_pack_property_get (gchild_iter, "position", &iter_position); /* Search for the child at the old position and update it */ if (iter_position == new_position && glade_property_superuser () == FALSE) { /* Update glade with the real value */ recursion = TRUE; glade_widget_pack_property_set (gchild_iter, "position", old_position); recursion = FALSE; continue; } else { gtk_box_reorder_child (GTK_BOX (container), GTK_WIDGET (list->data), iter_position); } } for (list = children; list; list = list->next) { gchild_iter = glade_widget_get_from_gobject (list->data); /* Refresh values yet again */ glade_widget_pack_property_get (gchild_iter, "position", &iter_position); gtk_box_reorder_child (GTK_BOX (container), GTK_WIDGET (list->data), iter_position); } if (children) g_list_free (children); } /* Chain Up */ if (!is_position) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->child_set_property (adaptor, container, child, property_name, value); gtk_container_check_resize (GTK_CONTAINER (container)); }