int main (int argc, char **argv) { GtkWidget *window; GtkWidget *vbox, *hbox, *button, *stack, *switcher; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_container_add (GTK_CONTAINER (window), vbox); switcher = gtk_stack_switcher_new (); gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE, 0); stack = gtk_stack_new (); gtk_box_pack_start (GTK_BOX (vbox), stack, TRUE, TRUE, 0); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_label ("Embedd"); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked), stack); gtk_widget_show_all (window); gtk_main (); return 0; }
static GtkWidget* main_window() { GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Switcher"); gtk_container_set_border_width(GTK_CONTAINER(window), 10); GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10); gtk_container_add(GTK_CONTAINER(window), box); // Stack GtkWidget* main_area = gtk_stack_new(); gtk_stack_set_transition_type(GTK_STACK(main_area), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); gtk_stack_set_transition_duration(GTK_STACK(main_area), 2000); // Checkbox GtkWidget* check_button = gtk_check_button_new_with_label("Do not fn check me"); gtk_stack_add_titled(GTK_STACK(main_area), check_button, "check_name", "Check Box"); // Label GtkWidget* label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), "<big>OMG this text is huge!</big>"); gtk_stack_add_titled(GTK_STACK(main_area), label, "label_name", "Big Label"); // StackSwitcher GtkWidget* stack_switcher = gtk_stack_switcher_new(); gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(stack_switcher), GTK_STACK(main_area)); gtk_box_pack_start(GTK_BOX(box), stack_switcher, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), main_area, TRUE, TRUE, 0); return window; }
static void gth_window_set_n_pages (GthWindow *self, int n_pages) { int i; if (self->priv->n_pages != 0) { g_critical ("The number of pages of a GthWindow can be set only once."); return; } self->priv->n_pages = n_pages; self->priv->overlay = gtk_overlay_new (); gtk_style_context_add_class (gtk_widget_get_style_context (self->priv->overlay), "window-overlay"); gtk_widget_show (self->priv->overlay); gtk_container_add (GTK_CONTAINER (self), self->priv->overlay); g_signal_connect (self->priv->overlay, "get-child-position", G_CALLBACK (overlay_get_child_position_cb), self); self->priv->grid = gtk_grid_new (); gtk_widget_show (self->priv->grid); gtk_container_add (GTK_CONTAINER (self->priv->overlay), self->priv->grid); self->priv->stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (self->priv->stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE); gtk_widget_show (self->priv->stack); gtk_grid_attach (GTK_GRID (self->priv->grid), self->priv->stack, 0, 2, 1, 1); self->priv->toolbars = g_new0 (GtkWidget *, n_pages); self->priv->contents = g_new0 (GtkWidget *, n_pages); self->priv->pages = g_new0 (GtkWidget *, n_pages); for (i = 0; i < n_pages; i++) { GtkWidget *page; self->priv->pages[i] = page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (page); gtk_container_add (GTK_CONTAINER (self->priv->stack), page); self->priv->toolbars[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (self->priv->toolbars[i]); gtk_box_pack_start (GTK_BOX (page), self->priv->toolbars[i], FALSE, FALSE, 0); self->priv->contents[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_hide (self->priv->contents[i]); gtk_box_pack_start (GTK_BOX (page), self->priv->contents[i], TRUE, TRUE, 0); } self->priv->window_size = g_new0 (GthWindowSize, n_pages); for (i = 0; i < n_pages; i++) self->priv->window_size[i].saved = FALSE; }
static void ekiga_window_init_gui (EkigaWindow *mw) { GtkWidget *window_vbox; // FIXME ??? ekiga-settings.h gtk_window_set_title (GTK_WINDOW (mw), _("Ekiga Softphone")); gtk_window_set_icon_name (GTK_WINDOW (mw), PACKAGE_NAME); window_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (mw), window_vbox); gtk_widget_show_all (window_vbox); /* The info bar */ mw->priv->info_bar = gm_info_bar_new (); gtk_box_pack_start (GTK_BOX (window_vbox), GTK_WIDGET (mw->priv->info_bar), TRUE, TRUE, 0); /* The main stack */ mw->priv->main_stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (mw->priv->main_stack), GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT); /* The main menu */ ekiga_window_init_menu (mw); /* The actions toolbar */ ekiga_window_init_actions_toolbar (mw); /* The status toolbar */ ekiga_window_init_status_toolbar (mw); gtk_widget_show_all (mw->priv->status_toolbar); gtk_box_pack_start (GTK_BOX (window_vbox), mw->priv->status_toolbar, false, false, 0); /* The stack pages */ ekiga_window_init_contact_list (mw); ekiga_window_init_dialpad (mw); ekiga_window_init_history (mw); gtk_widget_show_all (mw->priv->main_stack); gtk_box_pack_start (GTK_BOX (window_vbox), mw->priv->main_stack, true, true, 0); /* Realize */ gtk_widget_realize (GTK_WIDGET (mw)); /* Update the widget when the user changes the configuration */ g_settings_bind (mw->priv->user_interface_settings->get_g_settings (), "panel-section", mw->priv->main_stack, "visible-child-name", G_SETTINGS_BIND_DEFAULT); }
void ManageDB_sidebar(GtkApplication *application){ GtkWidget *sidebar; GtkWidget *stack; GtkWidget *box; GtkWidget *widget; GtkWidget *header; windowdb = gtk_application_window_new (application); header = gtk_header_bar_new (); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE); gtk_window_set_titlebar (GTK_WINDOW(windowdb), header); gtk_window_set_title(GTK_WINDOW(windowdb), "Gerenciamento do Banco de Dados"); gtk_window_set_default_size (GTK_WINDOW (windowdb), 500, 500); g_signal_connect (windowdb, "destroy", G_CALLBACK (gtk_widget_destroyed), &windowdb); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); sidebar = gtk_stack_sidebar_new (); gtk_box_pack_start (GTK_BOX (box), sidebar, FALSE, FALSE, 0); stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN); gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack)); /* Separator between sidebar and stack */ widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX(box), widget, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE, 0); /* Precisamos adicionar as ações... */ Welcome_side(widget, stack); Create_side(widget, stack); Backup_side(widget, stack); Restore_side(widget, stack); Delete_side(widget, stack); Advanced_side(widget, stack); gtk_container_add (GTK_CONTAINER (windowdb), box); gtk_widget_show_all (windowdb); }
static void ev_sidebar_init (EvSidebar *ev_sidebar) { EvSidebarPrivate *priv; GtkWidget *switcher; GtkWidget *stack; priv = GET_PRIVATE (ev_sidebar); /* data model */ priv->page_model = (GtkTreeModel *) gtk_list_store_new (PAGE_COLUMN_NUM_COLS, G_TYPE_STRING, GTK_TYPE_WIDGET, G_TYPE_STRING, G_TYPE_STRING); switcher = gtk_stack_switcher_new (); priv->switcher = switcher; gtk_box_pack_end (GTK_BOX (ev_sidebar), switcher, FALSE, TRUE, 0); g_object_set (switcher, "icon-size", 1, NULL); gtk_container_set_border_width (GTK_CONTAINER (switcher), 6); gtk_widget_set_halign (switcher, GTK_ALIGN_FILL); gtk_widget_set_hexpand (switcher, TRUE); gtk_box_set_homogeneous (GTK_BOX (switcher), TRUE); gtk_widget_show (priv->switcher); stack = gtk_stack_new (); priv->stack = stack; gtk_stack_set_homogeneous (GTK_STACK (stack), TRUE); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); gtk_box_pack_end (GTK_BOX (ev_sidebar), stack, TRUE, TRUE, 0); gtk_widget_show (priv->stack); g_signal_connect (stack, "notify::visible-child", G_CALLBACK (ev_sidebar_child_change_cb), ev_sidebar); }
static void nemo_context_menu_menu_item_init (NemoContextMenuMenuItem *item) { item->on_toggle = FALSE; GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); GtkWidget *stack = gtk_stack_new (); item->stack = stack; GtkWidget *label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (label), 0.98, 0.5); gtk_stack_add_named (GTK_STACK (stack), label, "toggle"); item->toggle_label_widget = label; label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_stack_add_named (GTK_STACK (stack), label, "action"); item->label_widget = label; gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE, 0); GtkWidget *toggle = gtk_image_new (); gtk_box_pack_end (GTK_BOX (box), toggle, FALSE, FALSE, 0); item->toggle_widget = toggle; gtk_widget_show_all (box); gtk_container_add (GTK_CONTAINER (item), box); update_toggle_state (item, FALSE, FALSE); item->settings_monitor_id = g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_CONTEXT_MENUS_SHOW_ALL_ACTIONS, G_CALLBACK (update_toggle_state), item); }
static void pragha_application_construct_window (PraghaApplication *pragha) { /* Main window */ pragha->mainwindow = gtk_application_window_new (GTK_APPLICATION (pragha)); gtk_window_set_icon_name (GTK_WINDOW(pragha->mainwindow), "pragha"); /* Get all widgets instances */ pragha->menu_ui_manager = pragha_menubar_new (); pragha->menu_ui = pragha_gmenu_toolbar_new (pragha); pragha->toolbar = pragha_toolbar_new (); pragha->infobox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); pragha->pane1 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); pragha->main_stack = gtk_stack_new (); pragha->pane2 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); pragha->sidebar1 = pragha_sidebar_new (); pragha->sidebar2 = pragha_sidebar_new (); pragha->library = pragha_library_pane_new (); pragha->playlist = pragha_playlist_new (); pragha->statusbar = pragha_statusbar_get (); pragha->scanner = pragha_scanner_new(); pragha->status_icon = pragha_status_icon_new (pragha); pragha_menubar_connect_signals (pragha->menu_ui_manager, pragha); /* Contruct the window. */ pragha_window_new (pragha); gtk_window_set_title (GTK_WINDOW(pragha->mainwindow), _("Pragha Music Player")); }
void gui_init(struct dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_exposure_gui_data_t)); dt_iop_exposure_gui_data_t *g = (dt_iop_exposure_gui_data_t *)self->gui_data; dt_iop_exposure_params_t *p = (dt_iop_exposure_params_t *)self->params; g->modes = NULL; g->deflicker_histogram_sources = NULL; g->deflicker_histogram = NULL; dt_pthread_mutex_init(&g->lock, NULL); /* register hooks with current dev so that histogram can interact with this module. */ darktable.develop->proxy.exposure.module = self; darktable.develop->proxy.exposure.set_white = dt_iop_exposure_set_white; darktable.develop->proxy.exposure.get_white = dt_iop_exposure_get_white; darktable.develop->proxy.exposure.set_black = dt_iop_exposure_set_black; darktable.develop->proxy.exposure.get_black = dt_iop_exposure_get_black; self->request_color_pick = DT_REQUEST_COLORPICK_OFF; self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->mode = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->mode, NULL, _("mode")); dt_bauhaus_combobox_add(g->mode, C_("mode", "manual")); g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_MANUAL)); dt_bauhaus_combobox_add(g->mode, _("automatic")); g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_DEFLICKER)); dt_bauhaus_combobox_set_default(g->mode, 0); dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode))); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->mode), TRUE, TRUE, 0); g->black = dt_bauhaus_slider_new_with_range(self, -0.1, 0.1, .001, p->black, 4); g_object_set(G_OBJECT(g->black), "tooltip-text", _("adjust the black level"), (char *)NULL); dt_bauhaus_slider_set_format(g->black, "%.4f"); dt_bauhaus_widget_set_label(g->black, NULL, _("black")); dt_bauhaus_slider_enable_soft_boundaries(g->black, -1.0, 1.0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->black), TRUE, TRUE, 0); g->mode_stack = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(g->mode_stack),FALSE); gtk_box_pack_start(GTK_BOX(self->widget), g->mode_stack, TRUE, TRUE, 0); GtkWidget *vbox_manual = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->exposure = dt_bauhaus_slider_new_with_range(self, -3.0, 3.0, .02, p->exposure, 3); g_object_set(G_OBJECT(g->exposure), "tooltip-text", _("adjust the exposure correction"), (char *)NULL); dt_bauhaus_slider_set_format(g->exposure, "%.2fEV"); dt_bauhaus_widget_set_label(g->exposure, NULL, _("exposure")); dt_bauhaus_slider_enable_soft_boundaries(g->exposure, -18.0, 18.0); gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(g->exposure), TRUE, TRUE, 0); GtkBox *hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); g->autoexp = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("auto"))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autoexp), FALSE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexp), FALSE, TRUE, 0); g->autoexpp = dt_bauhaus_slider_new_with_range(self, 0.0, 0.2, .001, 0.01, 3); g_object_set(G_OBJECT(g->autoexpp), "tooltip-text", _("percentage of bright values clipped out"), (char *)NULL); gtk_widget_set_sensitive(GTK_WIDGET(g->autoexpp), TRUE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexpp), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(hbox), TRUE, TRUE, 0); gtk_widget_show_all(vbox_manual); gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_manual, "manual"); GtkWidget *vbox_deflicker = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->deflicker_percentile = dt_bauhaus_slider_new_with_range(self, 0, 100, .01, p->deflicker_percentile, 3); // FIXME: this needs a better tooltip! g_object_set(G_OBJECT(g->deflicker_percentile), "tooltip-text", _("percentile"), (char *)NULL); dt_bauhaus_slider_set_format(g->deflicker_percentile, "%.2f%%"); dt_bauhaus_widget_set_label(g->deflicker_percentile, NULL, _("percentile")); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_percentile), TRUE, TRUE, 0); g->deflicker_target_level = dt_bauhaus_slider_new_with_range(self, -18.0, 18.0, .01, p->deflicker_target_level, 3); g_object_set(G_OBJECT(g->deflicker_target_level), "tooltip-text", _("target level"), (char *)NULL); dt_bauhaus_slider_set_format(g->deflicker_target_level, "%.2fEV"); dt_bauhaus_widget_set_label(g->deflicker_target_level, NULL, _("target level")); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_target_level), TRUE, TRUE, 0); g->deflicker_histogram_source = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->deflicker_histogram_source, NULL, _("histogram of")); dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("pre-processed image")); g->deflicker_histogram_sources = g_list_append(g->deflicker_histogram_sources, GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL)); dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("source raw data")); g->deflicker_histogram_sources = g_list_append(g->deflicker_histogram_sources, GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE)); dt_bauhaus_combobox_set_default(g->deflicker_histogram_source, DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL); dt_bauhaus_combobox_set(g->deflicker_histogram_source, g_list_index(g->modes, GUINT_TO_POINTER(p->deflicker_histogram_source))); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_histogram_source), TRUE, TRUE, 0); GtkBox *hbox1 = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); GtkLabel *label = GTK_LABEL(gtk_label_new(_("computed EC: "))); gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(label), FALSE, FALSE, 0); g->deflicker_used_EC = GTK_LABEL(gtk_label_new("")); // This gets filled in by process g_object_set(G_OBJECT(g->deflicker_used_EC), "tooltip-text", _("what exposure correction have actually been used"), (char *)NULL); gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(g->deflicker_used_EC), FALSE, FALSE, 0); dt_pthread_mutex_lock(&g->lock); g->deflicker_computed_exposure = NAN; dt_pthread_mutex_unlock(&g->lock); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(hbox1), FALSE, FALSE, 0); gtk_widget_show_all(vbox_deflicker); gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_deflicker, "deflicker"); g_signal_connect(G_OBJECT(g->mode), "value-changed", G_CALLBACK(mode_callback), self); g_signal_connect(G_OBJECT(g->black), "value-changed", G_CALLBACK(black_callback), self); g_signal_connect(G_OBJECT(g->exposure), "value-changed", G_CALLBACK(exposure_callback), self); g_signal_connect(G_OBJECT(g->autoexpp), "value-changed", G_CALLBACK(autoexpp_callback), self); g_signal_connect(G_OBJECT(g->autoexp), "toggled", G_CALLBACK(autoexp_callback), self); g_signal_connect(G_OBJECT(g->deflicker_percentile), "value-changed", G_CALLBACK(deflicker_params_callback), self); g_signal_connect(G_OBJECT(g->deflicker_target_level), "value-changed", G_CALLBACK(deflicker_params_callback), self); g_signal_connect(G_OBJECT(g->deflicker_histogram_source), "value-changed", G_CALLBACK(deflicker_histogram_source_callback), self); g_signal_connect(G_OBJECT(self->widget), "draw", G_CALLBACK(draw), self); }
static void gdaui_dsn_editor_init (GdauiDsnEditor *config, G_GNUC_UNUSED GdauiDsnEditorClass *klass) { GtkWidget *grid; GtkWidget *label; GtkWidget *exp; gchar *str; g_return_if_fail (GDAUI_IS_DSN_EDITOR (config)); gtk_orientable_set_orientation (GTK_ORIENTABLE (config), GTK_ORIENTATION_VERTICAL); /* allocate private structure */ config->priv = g_new0 (GdauiDsnEditorPrivate, 1); config->priv->dsn_info = g_new0 (GdaDsnInfo, 1); config->priv->no_change_signal = TRUE; /* data source's name and icon */ GtkWidget *hbox_header; hbox_header = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (config), hbox_header, FALSE, FALSE, 6); config->priv->icon = gtk_image_new (); gtk_widget_set_size_request (config->priv->icon, -1, SUPPORT_ICON_SIZE); gtk_box_pack_start (GTK_BOX (hbox_header), config->priv->icon, FALSE, FALSE, 0); config->priv->wname = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox_header), config->priv->wname, FALSE, FALSE, 10); GtkWidget *menu_button; menu_button = gtk_menu_button_new (); gtk_box_pack_end (GTK_BOX (hbox_header), menu_button, FALSE, FALSE, 0); GtkWidget *menu_icon; menu_icon = gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_MENU); gtk_button_set_image (GTK_BUTTON (menu_button), menu_icon); GMenu *smenu; smenu = g_menu_new (); gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), G_MENU_MODEL (smenu)); GMenuItem *mitem; mitem = g_menu_item_new ("Test data source", "win.DSNTest"); g_menu_insert_item (smenu, -1, mitem); mitem = g_menu_item_new ("Reset data source's changes", "win.DSNReset"); g_menu_insert_item (smenu, -1, mitem); mitem = g_menu_item_new ("Duplicate data source", "win.DSNCopy"); g_menu_insert_item (smenu, -1, mitem); GtkWindow *win; win = gtk_application_get_active_window (GTK_APPLICATION (g_application_get_default ())); g_action_map_add_action_entries (G_ACTION_MAP (win), win_entries, G_N_ELEMENTS (win_entries), config); /* stack in a scrolled window */ GtkWidget *sw; sw = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_vexpand (sw, TRUE); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_NONE); gtk_box_pack_start (GTK_BOX (config), sw, TRUE, TRUE, 6); /* Stack */ config->priv->stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (config->priv->stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); gtk_container_add (GTK_CONTAINER (sw), config->priv->stack); /* set up widgets */ grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); gtk_widget_show (grid); label = gtk_label_new_with_mnemonic (_("_System wide data source:")); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_hexpand (label, FALSE); g_object_set (G_OBJECT (label), "xalign", 0., NULL); gtk_widget_show (label); gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1); config->priv->is_system = gtk_check_button_new (); gtk_widget_show (config->priv->is_system); g_signal_connect (G_OBJECT (config->priv->is_system), "toggled", G_CALLBACK (field_toggled_cb), config); gtk_grid_attach (GTK_GRID (grid), config->priv->is_system, 1, 1, 1, 1); str = g_strdup_printf ("%s <span foreground='red' weight='bold'>*</span>", _("_Provider:")); label = gtk_label_new (""); gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); g_free (str); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_hexpand (label, FALSE); g_object_set (G_OBJECT (label), "xalign", 0., NULL); gtk_widget_show (label); gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1); config->priv->wprovider = gdaui_provider_selector_new (); gtk_widget_set_hexpand (config->priv->wprovider, TRUE); gtk_label_set_mnemonic_widget (GTK_LABEL (label), config->priv->wprovider); gtk_widget_show (config->priv->wprovider); g_signal_connect (G_OBJECT (config->priv->wprovider), "changed", G_CALLBACK (field_changed_cb), config); gtk_grid_attach (GTK_GRID (grid), config->priv->wprovider, 1, 2, 1, 1); label = gtk_label_new_with_mnemonic (_("_Description:")); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_hexpand (label, FALSE); g_object_set (G_OBJECT (label), "xalign", 0., NULL); gtk_widget_show (label); gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); config->priv->wdesc = gtk_text_view_new (); gtk_container_add (GTK_CONTAINER (sw), config->priv->wdesc); gtk_text_view_set_editable (GTK_TEXT_VIEW (config->priv->wdesc), TRUE); gtk_widget_set_vexpand (config->priv->wdesc, TRUE); gtk_label_set_mnemonic_widget (GTK_LABEL (label), config->priv->wdesc); g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (config->priv->wdesc)), "changed", G_CALLBACK (field_changed_cb), config); gtk_grid_attach (GTK_GRID (grid), sw, 1, 3, 1, 1); config->priv->warning = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (config->priv->warning), _("<span foreground='red'>The database provider used by this data source is not available,\n" "editing the data source's attributes is disabled</span>")); gtk_widget_set_halign (config->priv->warning, GTK_ALIGN_CENTER); gtk_widget_set_hexpand (config->priv->warning, TRUE); g_object_set (G_OBJECT (config->priv->warning), "xalign", 0.5, NULL); gtk_label_set_justify (GTK_LABEL (config->priv->warning), GTK_JUSTIFY_CENTER); gtk_label_set_line_wrap (GTK_LABEL (config->priv->warning), TRUE); gtk_grid_attach (GTK_GRID (grid), config->priv->warning, 0, 8, 2, 1); gtk_stack_add_named (GTK_STACK (config->priv->stack), grid, PANE_DEFINITION); /* connection's spec */ config->priv->dsn_spec = _gdaui_provider_spec_editor_new (gdaui_provider_selector_get_provider (GDAUI_PROVIDER_SELECTOR (config->priv->wprovider))); g_signal_connect (G_OBJECT (config->priv->dsn_spec), "changed", G_CALLBACK (field_changed_cb), config); gtk_widget_show (config->priv->dsn_spec); gtk_stack_add_named (GTK_STACK (config->priv->stack), config->priv->dsn_spec, PANE_PARAMS); /* connection's authentication */ config->priv->dsn_auth = _gdaui_provider_auth_editor_new (gdaui_provider_selector_get_provider (GDAUI_PROVIDER_SELECTOR (config->priv->wprovider))); g_signal_connect (G_OBJECT (config->priv->dsn_auth), "changed", G_CALLBACK (field_changed_cb), config); gtk_widget_show (config->priv->dsn_auth); gtk_stack_add_named (GTK_STACK (config->priv->stack), config->priv->dsn_auth, PANE_AUTH); config->priv->no_change_signal = FALSE; }
PocketvoxSetup* pocketvox_setup_new() { PocketvoxSetup *setup = (PocketvoxSetup *)g_object_new(TYPE_POCKETVOX_SETUP, NULL); setup->priv = G_TYPE_INSTANCE_GET_PRIVATE (setup, TYPE_POCKETVOX_SETUP, PocketvoxSetupPrivate); PocketvoxSetupPrivate *priv = setup->priv; bindtextdomain (GETTEXT_PACKAGE, PROGRAMNAME_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); priv->settings = g_settings_new("org.pocketvox.config"); //Build the window priv->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(priv->window), GTK_WIN_POS_CENTER_ALWAYS); gtk_window_set_title(GTK_WINDOW(priv->window), "pocketvox-gtk"); gtk_window_set_default_size(GTK_WINDOW(priv->window), 500, 350); gtk_window_set_icon_name(GTK_WINDOW(priv->window), "pocketvox"); gtk_container_set_border_width(GTK_CONTAINER(priv->window), 5); g_signal_connect_swapped(priv->window, "delete-event", G_CALLBACK(pocketvox_setup_save_and_quit), setup); GtkWidget *bar = gtk_header_bar_new(); gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(bar), TRUE); gtk_window_set_titlebar(GTK_WINDOW(priv->window), bar); //add a vertical box GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(priv->window), box); //a button for all GtkWidget* button_notification = gtk_button_new_with_label(_("Notifications")); GtkWidget* button_user = gtk_button_new_with_label(_("Users")); GtkWidget* button_pocketsphinx = gtk_button_new_with_label(_("Pocketsphinx")); GtkWidget* button_gstreamer = gtk_button_new_with_label(_("Gstreamer")); gtk_widget_set_tooltip_text(button_notification, _("Display notifications parameters")); gtk_widget_set_tooltip_text(button_user, _("Display user parameters")); gtk_widget_set_tooltip_text(button_pocketsphinx, _("Display pocketsphinx parameters")); gtk_widget_set_tooltip_text(button_gstreamer, _("Display gstreamer parameters")); gtk_button_set_relief(GTK_BUTTON(button_notification), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(button_user), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(button_pocketsphinx), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(button_gstreamer), GTK_RELIEF_NONE); GtkWidget *grid_button = gtk_grid_new(); gtk_grid_attach(GTK_GRID(grid_button), button_user, 0, 0, 1, 1); gtk_grid_attach(GTK_GRID(grid_button), button_notification, 0, 1, 1, 1); gtk_grid_attach(GTK_GRID(grid_button), button_pocketsphinx, 0, 2, 1, 1); gtk_grid_attach(GTK_GRID(grid_button), button_gstreamer, 0, 3, 1, 1); GtkWidget* grid_notification = pocketvox_setup_get_notification_grid(setup); GtkWidget* grid_user = pocketvox_setup_get_user_grid(setup); GtkWidget* grid_pocketsphinx = pocketvox_setup_get_pocketsphinx_grid(setup); GtkWidget* grid_gstreamer = pocketvox_setup_get_gstreamer_grid(setup); //connect all signals (TODO) g_signal_connect_swapped(button_notification, "clicked", G_CALLBACK(gtk_widget_show), grid_notification); g_signal_connect_swapped(button_notification, "clicked", G_CALLBACK(gtk_widget_hide), grid_user); g_signal_connect_swapped(button_notification, "clicked", G_CALLBACK(gtk_widget_hide), grid_pocketsphinx); g_signal_connect_swapped(button_notification, "clicked", G_CALLBACK(gtk_widget_hide), grid_gstreamer); g_signal_connect_swapped(button_pocketsphinx, "clicked", G_CALLBACK(gtk_widget_hide), grid_notification); g_signal_connect_swapped(button_pocketsphinx, "clicked", G_CALLBACK(gtk_widget_hide), grid_user); g_signal_connect_swapped(button_pocketsphinx, "clicked", G_CALLBACK(gtk_widget_show), grid_pocketsphinx); g_signal_connect_swapped(button_pocketsphinx, "clicked", G_CALLBACK(gtk_widget_hide), grid_gstreamer); g_signal_connect_swapped(button_user, "clicked", G_CALLBACK(gtk_widget_hide), grid_notification); g_signal_connect_swapped(button_user, "clicked", G_CALLBACK(gtk_widget_show), grid_user); g_signal_connect_swapped(button_user, "clicked", G_CALLBACK(gtk_widget_hide), grid_pocketsphinx); g_signal_connect_swapped(button_user, "clicked", G_CALLBACK(gtk_widget_hide), grid_gstreamer); g_signal_connect_swapped(button_gstreamer, "clicked", G_CALLBACK(gtk_widget_hide), grid_notification); g_signal_connect_swapped(button_gstreamer, "clicked", G_CALLBACK(gtk_widget_hide), grid_user); g_signal_connect_swapped(button_gstreamer, "clicked", G_CALLBACK(gtk_widget_hide), grid_pocketsphinx); g_signal_connect_swapped(button_gstreamer, "clicked", G_CALLBACK(gtk_widget_show), grid_gstreamer); //add GtkWidget* gridBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(gridBox), grid_user, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(gridBox), grid_notification, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(gridBox), grid_pocketsphinx, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(gridBox), grid_gstreamer, TRUE, TRUE, 0); GtkWidget* separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL); gtk_widget_show(separator); GtkWidget *hgridBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(hgridBox), grid_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hgridBox), separator, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(hgridBox), gridBox, TRUE, TRUE, 0); GtkWidget *stack = gtk_stack_new(); gtk_stack_set_transition_type(GTK_STACK(stack) , GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); gtk_stack_set_transition_duration(GTK_STACK(stack), 1000); gtk_stack_add_titled(GTK_STACK(stack), hgridBox, "Setup", _("Configuration")); GtkWidget* scrolledWindow = gtk_scrolled_window_new(NULL, NULL); //return void pocketvox_setup_get_modules_grid(setup); gtk_container_add(GTK_CONTAINER(scrolledWindow), priv->listBox); gtk_widget_show_all(scrolledWindow); gtk_stack_add_titled(GTK_STACK(stack), scrolledWindow, "Modules", _("Modules")); //adding a task switcher GtkWidget* stackSwitcher = gtk_stack_switcher_new(); gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(stackSwitcher), GTK_STACK(stack)); gtk_header_bar_set_custom_title(GTK_HEADER_BAR(bar), stackSwitcher); GtkWidget *add_module_button = gtk_button_new_from_icon_name("gtk-new", GTK_ICON_SIZE_MENU); GtkWidget *remove_module_button = gtk_button_new_from_icon_name("gtk-delete", GTK_ICON_SIZE_MENU); gtk_button_set_relief(GTK_BUTTON(add_module_button), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(remove_module_button), GTK_RELIEF_NONE); gtk_header_bar_pack_start(GTK_HEADER_BAR(bar), add_module_button); gtk_header_bar_pack_start(GTK_HEADER_BAR(bar), remove_module_button); g_signal_connect_swapped(remove_module_button, "clicked", G_CALLBACK(pocketvox_setup_remove_module), setup); g_signal_connect_swapped(add_module_button, "clicked", G_CALLBACK(pocketvox_setup_add_module_callback), setup); g_signal_connect_swapped(stack, "notify::visible-child", G_CALLBACK(pocketvox_stack_child_changed), add_module_button); g_signal_connect_swapped(stack, "notify::visible-child", G_CALLBACK(pocketvox_stack_child_changed), remove_module_button); //add them to the vbox gtk_box_pack_start(GTK_BOX(box), stack, TRUE, TRUE, 0); gtk_widget_show(grid_user); gtk_widget_hide(grid_notification); gtk_widget_hide(grid_pocketsphinx); gtk_widget_hide(grid_gstreamer); gtk_widget_show(gridBox); gtk_widget_show_all(grid_button); gtk_widget_show(hgridBox); gtk_widget_show(box); gtk_widget_show(stack); gtk_widget_show(stackSwitcher); gtk_widget_show_all(bar); //get the setup return setup; }
/* object libre impuesto window constructed */ static void libre_impuesto_window_constructed (GObject *object) { GtkBox *box; GtkPaned *paned; GtkWidget *widget; GtkWidget *notebook; GtkWidget *background; LibreImpuesto *impuesto; LibreImpuestoWindow *impuesto_window = LIBRE_IMPUESTO_WINDOW (object); LibreImpuestoWindowPrivate *priv = impuesto_window->priv; impuesto = libre_impuesto_window_get_impuesto (impuesto_window); libre_impuesto_window_actions_init(impuesto_window); // Create a GtkBox container widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (impuesto_window), widget); box = GTK_BOX (widget); widget = libre_impuesto_window_construct_menubar (impuesto_window); if (widget != NULL) gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = libre_impuesto_window_construct_headerbar (impuesto_window); if (widget != NULL) gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (box, widget, TRUE, TRUE, 0); paned = GTK_PANED (widget); widget = gtk_statusbar_new(); g_object_bind_property ( impuesto_window, "statusbar-visible", widget, "visible", G_BINDING_SYNC_CREATE); gtk_statusbar_push (GTK_STATUSBAR (widget), 1, PACKAGE_STRING); gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = gtk_statusbar_get_message_area (GTK_STATUSBAR (widget)); gtk_widget_set_halign (widget, GTK_ALIGN_END); widget = libre_impuesto_window_construct_sidebar (impuesto, impuesto_window); if (widget != NULL) gtk_paned_pack1 (paned, widget, FALSE, FALSE); background = gtk_drawing_area_new(); gtk_widget_set_name (background, "libre-impuesto-background"); g_signal_connect (background, "draw", G_CALLBACK (draw_area_cb), NULL); notebook = impuesto_notebook_new(); priv->notebook = GTK_NOTEBOOK (notebook); g_object_set_data ( G_OBJECT(impuesto_window), "notebook", notebook); g_signal_connect ( GTK_NOTEBOOK (notebook), "tab-close-request", G_CALLBACK (notebook_page_close_request_cb), impuesto_window); g_signal_connect ( GTK_NOTEBOOK (notebook), "switch-page", G_CALLBACK (switch_page_cb), impuesto_window); widget = gtk_stack_new(); priv->stack = GTK_STACK (widget); gtk_container_add_with_properties (GTK_CONTAINER (widget), background, "name", "background", NULL); gtk_container_add_with_properties (GTK_CONTAINER (widget), notebook, "name", "notebook", NULL); if (widget != NULL) gtk_paned_pack2 (paned, widget, TRUE, FALSE); gtk_widget_show_all (GTK_WIDGET(box)); //gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0); gtk_application_add_window (GTK_APPLICATION (impuesto), GTK_WINDOW(impuesto_window)); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (libre_impuesto_window_parent_class)->constructed (object); }
/* Constrcut side bar widget. */ static GtkWidget * libre_impuesto_window_construct_sidebar (LibreImpuesto *impuesto, LibreImpuestoWindow *impuesto_window) { GtkStack * stack; GtkWidget *switcher; GtkTreePath *tree_path; GtkTreeStore * tree_store; GtkTreeViewColumn *column; GtkTreeSelection *selection; GtkCellRenderer *cell_renderer; GtkWidget *paned, *box_switcher, *widget, *frame, *scroll; paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); g_object_bind_property (impuesto_window, "sidebar-visible", paned, "visible", G_BINDING_SYNC_CREATE); box_switcher = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); switcher = gtk_stack_switcher_new (); g_object_set_data(G_OBJECT(impuesto_window), "switcher", switcher); gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_VERTICAL); gtk_box_pack_end (GTK_BOX (box_switcher), switcher, FALSE, FALSE, 0); stack = GTK_STACK (gtk_stack_new ()); gtk_stack_set_homogeneous ( stack, TRUE); gtk_box_pack_end (GTK_BOX (box_switcher), GTK_WIDGET(stack), TRUE, TRUE, 0); scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); tree_store = libre_impuesto_get_tree_data_general( impuesto ); widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL(tree_store)); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title (column,_( "Libre Impuestos")); cell_renderer = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell_renderer, FALSE); gtk_tree_view_column_add_attribute (column, cell_renderer, "pixbuf", 0); cell_renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); gtk_tree_view_column_add_attribute (column, cell_renderer, "text", 1); gtk_tree_view_append_column (GTK_TREE_VIEW(widget), column); gtk_tree_view_expand_all(GTK_TREE_VIEW(widget)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(widget)); g_signal_connect_swapped ( selection, "changed", G_CALLBACK (node_tree_selection_changed_cb), G_OBJECT (impuesto_window)); gtk_container_add (GTK_CONTAINER (scroll), widget); gtk_container_add_with_properties (GTK_CONTAINER (stack), scroll, "name", _("Generales"), "title",_("General Options"), "icon-name", GTK_STOCK_HOME, NULL); scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); tree_store = libre_impuesto_get_tree_data_formulario( impuesto ); widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL(tree_store)); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title (column, _("Electronic Forms")); cell_renderer = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell_renderer, FALSE); gtk_tree_view_column_add_attribute (column, cell_renderer, "pixbuf", 0); cell_renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); gtk_tree_view_column_add_attribute (column, cell_renderer, "text", 1); gtk_tree_view_append_column (GTK_TREE_VIEW(widget), column); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(widget)); g_signal_connect_swapped ( selection, "changed", G_CALLBACK (node_tree_selection_changed_cb), G_OBJECT (impuesto_window)); gtk_container_add (GTK_CONTAINER (scroll), widget); gtk_container_add_with_properties (GTK_CONTAINER (stack), scroll, "name", _("Modulos"), "title",_( "Electronic Forms"), "icon-name", GTK_STOCK_HOME, NULL); tree_path = gtk_tree_path_new_from_string ("0"); gtk_tree_view_expand_row (GTK_TREE_VIEW(widget), tree_path, FALSE); scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); tree_store = libre_impuesto_get_tree_data_consultor( impuesto ); widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL(tree_store)); column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title (column,_("Consultores")); cell_renderer = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, cell_renderer, FALSE); gtk_tree_view_column_add_attribute (column, cell_renderer, "pixbuf", 0); cell_renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); gtk_tree_view_column_add_attribute (column, cell_renderer, "text", 1); gtk_tree_view_append_column (GTK_TREE_VIEW(widget), column); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(widget)); g_signal_connect_swapped ( selection, "changed", G_CALLBACK (node_tree_selection_changed_cb), G_OBJECT (impuesto_window)); gtk_container_add (GTK_CONTAINER (scroll), widget); gtk_container_add_with_properties (GTK_CONTAINER (stack), scroll, "name", _("Consultores"), "title",_( "Consultores"), "icon-name", GTK_STOCK_HOME, NULL); tree_path = gtk_tree_path_new_from_string ("0"); gtk_tree_view_expand_row (GTK_TREE_VIEW(widget), tree_path, FALSE); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); gtk_paned_pack1 ( GTK_PANED(paned), box_switcher, TRUE, FALSE ); gtk_widget_show_all (box_switcher); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); widget = gtk_drawing_area_new (); gtk_widget_set_name (widget, "logo"); /*gtk_widget_set_size_request (widget, gdk_pixbuf_get_width (logo), gdk_pixbuf_get_height (logo));*/ gtk_widget_set_size_request (widget, -1, 50); g_signal_connect (widget, "draw", G_CALLBACK (draw_area_cb), NULL); gtk_container_add (GTK_CONTAINER (frame), widget); gtk_paned_pack2 (GTK_PANED(paned), frame, TRUE, FALSE); return paned; }
int main (int argc, char *argv[]) { ClutterTimeline *timeline; ClutterActor *stage; GtkWidget *window, *stack, *clutter; GtkWidget *label, *button, *vbox; GdkPixbuf *pixbuf; SuperOH *oh; gint i; GError *error; error = NULL; if (gtk_clutter_init_with_args (&argc, &argv, NULL, NULL, NULL, &error) != CLUTTER_INIT_SUCCESS) { if (error) { g_critical ("Unable to initialize Clutter-GTK: %s", error->message); g_error_free (error); return EXIT_FAILURE; } else g_error ("Unable to initialize Clutter-GTK"); } /* calling gtk_clutter_init* multiple times should be safe */ g_assert (gtk_clutter_init (NULL, NULL) == CLUTTER_INIT_SUCCESS); pixbuf = gdk_pixbuf_new_from_file (EXAMPLES_DATADIR G_DIR_SEPARATOR_S "redhand.png", NULL); if (!pixbuf) g_error("pixbuf load failed"); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), WINWIDTH, WINHEIGHT); gtk_window_set_title (GTK_WINDOW (window), "Clutter Embedding"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (vbox), GTK_ORIENTATION_VERTICAL); gtk_widget_set_hexpand (vbox, TRUE); gtk_widget_set_vexpand (vbox, TRUE); gtk_container_add (GTK_CONTAINER (window), vbox); stack = gtk_stack_new (); gtk_container_add (GTK_CONTAINER (vbox), stack); label = gtk_label_new ("This is a label in a stack"); gtk_stack_add_named (GTK_STACK (stack), label, "label"); clutter = gtk_clutter_embed_new (); gtk_stack_add_named (GTK_STACK (stack), clutter, "clutter"); gtk_widget_realize (clutter); stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter)); clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue); label = gtk_label_new ("This is a label"); gtk_container_add (GTK_CONTAINER (vbox), label); gtk_widget_set_hexpand (label, TRUE); button = gtk_button_new_with_label ("This is a button...clicky"); g_signal_connect (button, "clicked", G_CALLBACK (clickity), stack); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_set_hexpand (button, TRUE); button = gtk_button_new_with_mnemonic ("_Fullscreen"); g_signal_connect (button, "clicked", G_CALLBACK (on_fullscreen), window); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_set_hexpand (button, TRUE); button = gtk_button_new_with_mnemonic ("_Quit"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_set_hexpand (button, TRUE); oh = g_new (SuperOH, 1); oh->stage = stage; oh->group = clutter_actor_new (); clutter_actor_set_pivot_point (oh->group, 0.5, 0.5); for (i = 0; i < NHANDS; i++) { gint x, y, w, h; /* Create a texture from pixbuf, then clone in to same resources */ if (i == 0) { oh->hand[i] = gtk_clutter_texture_new (); gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (oh->hand[i]), pixbuf, NULL); } else oh->hand[i] = clutter_clone_new (oh->hand[0]); /* Place around a circle */ w = clutter_actor_get_width (oh->hand[0]); h = clutter_actor_get_height (oh->hand[0]); x = WINWIDTH / 2 + RADIUS * cos (i * M_PI / (NHANDS / 2)) - w / 2; y = WINHEIGHT / 2 + RADIUS * sin (i * M_PI / (NHANDS / 2)) - h / 2; clutter_actor_set_position (oh->hand[i], x, y); clutter_actor_set_pivot_point (oh->hand[i], 0.5, 0.5); /* Add to our group group */ clutter_actor_add_child (oh->group, oh->hand[i]); } /* Add the group to the stage */ clutter_actor_add_child (stage, oh->group); clutter_actor_add_constraint (oh->group, clutter_align_constraint_new (oh->stage, CLUTTER_ALIGN_BOTH, 0.5)); g_signal_connect (stage, "button-press-event", G_CALLBACK (input_cb), oh); g_signal_connect (stage, "key-release-event", G_CALLBACK (input_cb), oh); gtk_widget_show_all (window); /* Create a timeline to manage animation */ timeline = clutter_timeline_new (6000); clutter_timeline_set_repeat_count (timeline, -1); /* fire a callback for frame change */ g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), oh); /* and start it */ clutter_timeline_start (timeline); gtk_main (); return 0; }
void gui_init(dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_levels_gui_data_t)); dt_iop_levels_gui_data_t *c = (dt_iop_levels_gui_data_t *)self->gui_data; dt_iop_levels_params_t *p = (dt_iop_levels_params_t *)self->params; dt_pthread_mutex_init(&c->lock, NULL); dt_pthread_mutex_lock(&c->lock); c->auto_levels[0] = NAN; c->auto_levels[1] = NAN; c->auto_levels[2] = NAN; dt_pthread_mutex_unlock(&c->lock); c->modes = NULL; c->mouse_x = c->mouse_y = -1.0; c->dragging = 0; c->activeToggleButton = NULL; c->current_pick = NONE; c->last_picked_color = -1; for(int i = 0; i < 3; i++) for(int j = 0; j < 2; j++) c->pick_xy_positions[i][j] = -1; self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5)); c->mode = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(c->mode, NULL, _("mode")); dt_bauhaus_combobox_add(c->mode, C_("mode", "manual")); c->modes = g_list_append(c->modes, GUINT_TO_POINTER(LEVELS_MODE_MANUAL)); dt_bauhaus_combobox_add(c->mode, _("automatic")); c->modes = g_list_append(c->modes, GUINT_TO_POINTER(LEVELS_MODE_AUTOMATIC)); dt_bauhaus_combobox_set_default(c->mode, LEVELS_MODE_MANUAL); dt_bauhaus_combobox_set(c->mode, g_list_index(c->modes, GUINT_TO_POINTER(p->mode))); gtk_box_pack_start(GTK_BOX(self->widget), c->mode, TRUE, TRUE, 0); c->mode_stack = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(c->mode_stack),FALSE); gtk_box_pack_start(GTK_BOX(self->widget), c->mode_stack, TRUE, TRUE, 0); c->area = GTK_DRAWING_AREA(dtgtk_drawing_area_new_with_aspect_ratio(9.0 / 16.0)); GtkWidget *vbox_manual = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5)); gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(c->area), TRUE, TRUE, 0); gtk_widget_set_tooltip_text(GTK_WIDGET(c->area),_("drag handles to set black, gray, and white points. " "operates on L channel.")); gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK); g_signal_connect(G_OBJECT(c->area), "draw", G_CALLBACK(dt_iop_levels_area_draw), self); g_signal_connect(G_OBJECT(c->area), "button-press-event", G_CALLBACK(dt_iop_levels_button_press), self); g_signal_connect(G_OBJECT(c->area), "button-release-event", G_CALLBACK(dt_iop_levels_button_release), self); g_signal_connect(G_OBJECT(c->area), "motion-notify-event", G_CALLBACK(dt_iop_levels_motion_notify), self); g_signal_connect(G_OBJECT(c->area), "leave-notify-event", G_CALLBACK(dt_iop_levels_leave_notify), self); g_signal_connect(G_OBJECT(c->area), "scroll-event", G_CALLBACK(dt_iop_levels_scroll), self); GtkWidget *autobutton = gtk_button_new_with_label(_("auto")); gtk_widget_set_tooltip_text(autobutton, _("apply auto levels")); gtk_widget_set_size_request(autobutton, -1, DT_PIXEL_APPLY_DPI(24)); GtkWidget *blackpick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT); gtk_widget_set_tooltip_text(blackpick, _("pick black point from image")); GtkWidget *greypick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT); gtk_widget_set_tooltip_text(greypick, _("pick medium gray point from image")); GtkWidget *whitepick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT); gtk_widget_set_tooltip_text(whitepick, _("pick white point from image")); GdkRGBA color = { 0 }; color.alpha = 1.0; dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(blackpick), &color); color.red = color.green = color.blue = 0.5; dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(greypick), &color); color.red = color.green = color.blue = 1.0; dtgtk_togglebutton_override_color(DTGTK_TOGGLEBUTTON(whitepick), &color); GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(10)); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(autobutton), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(blackpick), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(greypick), TRUE, TRUE, 0); gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(whitepick), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_manual), box, TRUE, TRUE, 0); gtk_widget_show_all(vbox_manual); gtk_stack_add_named(GTK_STACK(c->mode_stack), vbox_manual, "manual"); c->percentile_black = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[0], 3); gtk_widget_set_tooltip_text(c->percentile_black, _("black percentile")); dt_bauhaus_slider_set_format(c->percentile_black, "%.1f%%"); dt_bauhaus_widget_set_label(c->percentile_black, NULL, _("black")); c->percentile_grey = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[1], 3); gtk_widget_set_tooltip_text(c->percentile_grey, _("gray percentile")); dt_bauhaus_slider_set_format(c->percentile_grey, "%.1f%%"); dt_bauhaus_widget_set_label(c->percentile_grey, NULL, _("gray")); c->percentile_white = dt_bauhaus_slider_new_with_range(self, 0.0f, 100.0f, .1f, p->percentiles[2], 3); gtk_widget_set_tooltip_text(c->percentile_white, _("white percentile")); dt_bauhaus_slider_set_format(c->percentile_white, "%.1f%%"); dt_bauhaus_widget_set_label(c->percentile_white, NULL, _("white")); GtkWidget *vbox_automatic = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, 5)); gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_black), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_grey), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox_automatic), GTK_WIDGET(c->percentile_white), FALSE, FALSE, 0); gtk_widget_show_all(vbox_automatic); gtk_stack_add_named(GTK_STACK(c->mode_stack), vbox_automatic, "automatic"); switch(p->mode) { case LEVELS_MODE_AUTOMATIC: gtk_stack_set_visible_child_name(GTK_STACK(c->mode_stack), "automatic"); break; case LEVELS_MODE_MANUAL: default: gtk_stack_set_visible_child_name(GTK_STACK(c->mode_stack), "manual"); break; } g_signal_connect(G_OBJECT(c->mode), "value-changed", G_CALLBACK(dt_iop_levels_mode_callback), self); g_signal_connect(G_OBJECT(c->percentile_black), "value-changed", G_CALLBACK(dt_iop_levels_percentiles_callback), self); g_signal_connect(G_OBJECT(c->percentile_grey), "value-changed", G_CALLBACK(dt_iop_levels_percentiles_callback), self); g_signal_connect(G_OBJECT(c->percentile_white), "value-changed", G_CALLBACK(dt_iop_levels_percentiles_callback), self); g_signal_connect(G_OBJECT(autobutton), "clicked", G_CALLBACK(dt_iop_levels_autoadjust_callback), (gpointer)self); g_signal_connect(G_OBJECT(blackpick), "toggled", G_CALLBACK(dt_iop_levels_pick_black_callback), self); g_signal_connect(G_OBJECT(greypick), "toggled", G_CALLBACK(dt_iop_levels_pick_grey_callback), self); g_signal_connect(G_OBJECT(whitepick), "toggled", G_CALLBACK(dt_iop_levels_pick_white_callback), self); }
GtkWidget * dsn_config_new (void) { DsnConfigPrivate *priv; GtkWidget *dsn; GtkWidget *label; GtkWidget *sw; gchar *title; GdaDataModel *model; priv = g_new0 (DsnConfigPrivate, 1); dsn = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_show (dsn); gtk_container_set_border_width (GTK_CONTAINER (dsn), 6); g_object_set_data_full (G_OBJECT (dsn), DSN_CONFIG_DATA, priv, (GDestroyNotify) free_private_data); /* title */ title = g_strdup_printf ("<b>%s</b>\n%s", _("Data Sources"), _("Data sources are the means by which database " "connections are identified: all " "the information needed to open a connection to " "a specific database using a 'provider' is referenced using " "a unique name.")); priv->title = gdaui_bar_new (title); g_free (title); gdaui_bar_set_icon_from_resource (GDAUI_BAR (priv->title), "/images/gdaui-generic.png"); gtk_box_pack_start (GTK_BOX (dsn), priv->title, FALSE, FALSE, 0); gtk_widget_show (priv->title); /* horizontal box for the provider list and its properties */ GtkWidget *hbox; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (dsn), hbox, TRUE, TRUE, 0); /* left part */ GtkWidget *vbox; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_size_request (vbox, 150, -1); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); /* create the data source list */ sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); model = gda_config_list_dsn (); priv->dsn_list = gdaui_raw_grid_new (model); gtk_tree_view_move_column_after (GTK_TREE_VIEW (priv->dsn_list), gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 1), gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 2)); g_object_unref (model); g_object_set_data (G_OBJECT (dsn), "grid", priv->dsn_list); gdaui_data_proxy_column_set_editable (GDAUI_DATA_PROXY (priv->dsn_list), 0, FALSE); gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), -1, FALSE); gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), 0, TRUE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->dsn_list), FALSE); g_object_set (priv->dsn_list, "info-cell-visible", FALSE, NULL); gtk_container_add (GTK_CONTAINER (sw), priv->dsn_list); g_signal_connect (priv->dsn_list, "selection-changed", G_CALLBACK (list_selection_changed_cb), dsn); g_signal_connect (priv->dsn_list, "populate-popup", G_CALLBACK (list_popup_cb), dsn); /* add/delete buttons */ GtkWidget *toolbar; toolbar = gtk_toolbar_new (); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "inline-toolbar"); gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0); GtkToolItem *titem; titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-add-symbolic"); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceNew"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-remove-symbolic"); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceDelete"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); /* create the data source's properties */ GtkWidget *stack; stack = gtk_stack_new (); priv->stack = stack; gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE, 10); label = gtk_label_new (_("No data source selected.")); gtk_stack_add_named (GTK_STACK (stack), label, ST_NOPROP); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_stack_add_named (GTK_STACK (stack), vbox, ST_PROP); GtkWidget *form; form = gdaui_dsn_editor_new (); priv->dsn_editor = GDAUI_DSN_EDITOR (form); gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0); g_signal_connect (priv->dsn_editor, "changed", G_CALLBACK (dsn_editor_changed_cb), dsn); /* action buttons */ GtkWidget *hbox2; hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 6); GtkWidget *bbox; bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_hexpand (bbox, TRUE); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_CENTER); gtk_box_pack_start (GTK_BOX (hbox2), bbox, FALSE, FALSE, 6); GtkWidget *button; button = gtk_toggle_button_new_with_label (_("Definition")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_DEFINITION] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_toggle_button_new_with_label (_("Parameters")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_PARAMS] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_toggle_button_new_with_label (_("Authentication")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_AUTH] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_button_new_from_icon_name ("document-save-symbolic", GTK_ICON_SIZE_BUTTON); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); priv->commit_button = button; gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_tooltip_text (button, _("Write changes made to the DSN")); g_signal_connect (button, "clicked", G_CALLBACK (save_cb), dsn); gtk_widget_show_all (hbox); return dsn; }
gint main (gint argc, gchar ** argv) { GtkWidget *window, *box, *button, *hbox, *combo; GtkWidget *w2, *w3; GtkListStore* store; GtkWidget *tree_view; GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkWidget *scrolled_win; int i; GtkTreeIter iter; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (window, 300, 300); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), box); switcher = gtk_stack_switcher_new (); gtk_box_pack_start (GTK_BOX (box), switcher, FALSE, FALSE, 0); stack = gtk_stack_new (); /* Make transitions longer so we can see that they work */ gtk_stack_set_transition_duration (GTK_STACK (stack), 1500); gtk_widget_set_halign (stack, GTK_ALIGN_START); gtk_container_add (GTK_CONTAINER (box), stack); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); w1 = gtk_text_view_new (); gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (w1)), "This is a\nTest\nBalh!", -1); gtk_container_add_with_properties (GTK_CONTAINER (stack), w1, "name", "1", "title", "1", NULL); w2 = gtk_button_new_with_label ("Gazoooooooooooooooonk"); gtk_container_add (GTK_CONTAINER (stack), w2); gtk_container_child_set (GTK_CONTAINER (stack), w2, "name", "2", "title", "2", "needs-attention", TRUE, NULL); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_size_request (scrolled_win, 100, 200); store = gtk_list_store_new (1, G_TYPE_STRING); for (i = 0; i < 40; i++) gtk_list_store_insert_with_values (store, &iter, i, 0, "Testvalule", -1); tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); gtk_container_add (GTK_CONTAINER (scrolled_win), tree_view); w3 = scrolled_win; renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Target", renderer, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); gtk_stack_add_titled (GTK_STACK (stack), w3, "3", "3"); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add (GTK_CONTAINER (box), hbox); button = gtk_button_new_with_label ("1"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w1); button = gtk_button_new_with_label ("2"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w2); button = gtk_button_new_with_label ("3"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w3); button = gtk_button_new_with_label ("1"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "1"); button = gtk_button_new_with_label ("2"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "2"); button = gtk_button_new_with_label ("3"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "3"); button = gtk_check_button_new_with_label ("homogeneous"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_stack_get_homogeneous (GTK_STACK (stack))); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) toggle_homogeneous, NULL); button = gtk_toggle_button_new_with_label ("Add icon"); g_signal_connect (button, "toggled", (GCallback) toggle_icon_name, NULL); gtk_container_add (GTK_CONTAINER (hbox), button); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "NONE"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "CROSSFADE"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_RIGHT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_LEFT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_UP"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_DOWN"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_LEFT_RIGHT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "SLIDE_UP_DOWN"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_UP"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_DOWN"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_LEFT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_RIGHT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_UP"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_DOWN"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_LEFT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "UNDER_RIGHT"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "OVER_UP_DOWN"); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_container_add (GTK_CONTAINER (hbox), combo); g_signal_connect (combo, "changed", (GCallback) toggle_transitions, NULL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add (GTK_CONTAINER (box), hbox); button = gtk_button_new_with_label ("<"); g_signal_connect (button, "clicked", (GCallback) on_back_button_clicked, stack); g_signal_connect (stack, "notify::visible-child-name", (GCallback)update_back_button_sensitivity, button); gtk_container_add (GTK_CONTAINER (hbox), button); button = gtk_button_new_with_label (">"); gtk_container_add (GTK_CONTAINER (hbox), button); g_signal_connect (button, "clicked", (GCallback) on_forward_button_clicked, stack); g_signal_connect (stack, "notify::visible-child-name", (GCallback)update_forward_button_sensitivity, button); gtk_widget_show_all (window); gtk_main (); gtk_widget_destroy (window); return 0; }
static void cc_bluetooth_panel_init (CcBluetoothPanel *self) { GError *error = NULL; self->priv = BLUETOOTH_PANEL_PRIVATE (self); g_resources_register (cc_bluetooth_get_resource ()); self->priv->builder = gtk_builder_new (); gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE); gtk_builder_add_from_resource (self->priv->builder, "/org/gnome/control-center/bluetooth/bluetooth.ui", &error); if (error != NULL) { g_warning ("Could not load ui: %s", error->message); g_error_free (error); return; } self->priv->cancellable = g_cancellable_new (); /* RFKill */ self->priv->rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon.Rfkill", "/org/gnome/SettingsDaemon/Rfkill", "org.gnome.SettingsDaemon.Rfkill", NULL, NULL); self->priv->properties = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon.Rfkill", "/org/gnome/SettingsDaemon/Rfkill", "org.freedesktop.DBus.Properties", NULL, NULL); self->priv->stack = gtk_stack_new (); gtk_stack_set_homogeneous (GTK_STACK (self->priv->stack), TRUE); add_stack_page (self, _("No Bluetooth Found"), _("Plug in a dongle to use Bluetooth."), BLUETOOTH_NO_DEVICES_PAGE); add_stack_page (self, _("Bluetooth Turned Off"), _("Turn on to connect devices and receive file transfers."), BLUETOOTH_DISABLED_PAGE); add_stack_page (self, _("Airplane Mode is on"), _("Bluetooth is disabled when airplane mode is on."), BLUETOOTH_AIRPLANE_PAGE); add_stack_page (self, _("Hardware Airplane Mode is on"), _("Turn off the Airplane mode switch to enable Bluetooth."), BLUETOOTH_HW_AIRPLANE_PAGE); self->priv->widget = bluetooth_settings_widget_new (); g_signal_connect (G_OBJECT (self->priv->widget), "panel-changed", G_CALLBACK (panel_changed), self); gtk_stack_add_named (GTK_STACK (self->priv->stack), self->priv->widget, BLUETOOTH_WORKING_PAGE); gtk_widget_show (self->priv->widget); gtk_widget_show (self->priv->stack); gtk_container_add (GTK_CONTAINER (self), self->priv->stack); airplane_mode_changed (NULL, NULL, NULL, self); g_signal_connect (self->priv->rfkill, "g-properties-changed", G_CALLBACK (airplane_mode_changed), self); g_signal_connect_swapped (G_OBJECT (self->priv->widget), "adapter-status-changed", G_CALLBACK (cc_bluetooth_panel_update_power), self); g_signal_connect (G_OBJECT (WID ("switch_bluetooth")), "notify::active", G_CALLBACK (power_callback), self); }
/* Gobj */ static void bjb_window_base_constructed (GObject *obj) { BjbWindowBase *self = BJB_WINDOW_BASE (obj); BjbWindowBasePriv *priv; gboolean maximized; const gint32 *position; const gint32 *size; gsize n_elements; GVariant *variant; G_OBJECT_CLASS (bjb_window_base_parent_class)->constructed (obj); priv = self->priv; priv->settings = bjb_app_get_settings ((gpointer) g_application_get_default ()); gtk_window_set_position (GTK_WINDOW (self),GTK_WIN_POS_CENTER); gtk_window_set_title (GTK_WINDOW (self), _(BIJIBEN_MAIN_WIN_TITLE)); variant = g_settings_get_value (G_SETTINGS (priv->settings), "window-size"); size = g_variant_get_fixed_array (variant, &n_elements, sizeof (gint32)); if (n_elements == 2) gtk_window_set_default_size (GTK_WINDOW (self), size[0], size[1]); g_variant_unref (variant); variant = g_settings_get_value (G_SETTINGS (priv->settings), "window-position"); position = g_variant_get_fixed_array (variant, &n_elements, sizeof (gint32)); if (n_elements == 2) gtk_window_move (GTK_WINDOW (self), position[0], position[1]); g_variant_unref (variant); maximized = g_settings_get_boolean (G_SETTINGS (priv->settings), "window-maximized"); if (maximized) gtk_window_maximize (GTK_WINDOW (self)); /* We probably want to offer a no entry window at first (startup) */ priv->entry = NULL ; priv->controller = bjb_controller_new (bijiben_get_manager (BIJIBEN_APPLICATION(g_application_get_default())), GTK_WINDOW (obj), priv->entry ); /* Shared toolbar */ priv->view = bjb_main_view_new (GTK_WIDGET (obj), priv->controller); priv->main_toolbar = bjb_main_toolbar_new (priv->view, priv->controller); gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->main_toolbar)); /* Search entry toolbar */ priv->search_bar = bjb_search_toolbar_new (GTK_WIDGET (obj), priv->controller); gtk_box_pack_start (GTK_BOX (priv->vbox), GTK_WIDGET (priv->search_bar), FALSE, FALSE, 0); /* UI : stack for different views */ priv->stack = GTK_STACK (gtk_stack_new ()); gtk_box_pack_start (GTK_BOX (priv->vbox), GTK_WIDGET (priv->stack), TRUE, TRUE, 0); priv->spinner = gtk_spinner_new (); gtk_stack_add_named (priv->stack, priv->spinner, "spinner"); gtk_stack_set_visible_child_name (priv->stack, "spinner"); gtk_widget_show (priv->spinner); gtk_spinner_start (GTK_SPINNER (priv->spinner)); priv->no_note = bjb_empty_results_box_new (); gtk_stack_add_named (priv->stack, priv->no_note, "empty"); gtk_stack_add_named (priv->stack, GTK_WIDGET (priv->view), "main-view"); gtk_widget_show (GTK_WIDGET (priv->stack)); /* Connection to window signals */ g_signal_connect (GTK_WIDGET (self), "destroy", G_CALLBACK (bjb_window_base_destroy), self); g_signal_connect (self, "window-state-event", G_CALLBACK (bjb_application_window_state_changed), priv->settings); g_signal_connect (self, "configure-event", G_CALLBACK (bjb_application_window_configured), self); /* Keys */ g_signal_connect (GTK_WIDGET (self), "key-press-event", G_CALLBACK(on_key_pressed_cb), self); /* If a note is requested at creation, show it * This is a specific type of window not associated with any view */ if (priv->note == NULL) { bjb_window_base_switch_to (self, BJB_WINDOW_BASE_MAIN_VIEW); } else { priv->detached = TRUE; bjb_window_base_switch_to_item (self, BIJI_ITEM (priv->note)); } /* For some reason, do not gtk_widget_show _self_ * or gtk_application_get_menu_bar will run, * fire a warning, while app menu will not show up * you have been warned! * * This is probably due to the fact that, * at startup, we still are * inside... drums... gapplication startup () */ gtk_widget_show (priv->vbox); }
void gui_init(dt_lib_module_t *self) { self->data = calloc(1, sizeof(dt_lib_live_view_t)); // Setup lib data dt_lib_live_view_t *lib = self->data; lib->splitline_x = lib->splitline_y = 0.5; // Setup gui self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); dt_gui_add_help_link(self->widget, "live_view.html#live_view"); GtkWidget *box; box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0); lib->live_view = dtgtk_togglebutton_new(dtgtk_cairo_paint_eye, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL); lib->live_view_zoom = dtgtk_button_new( dtgtk_cairo_paint_zoom, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL); // TODO: see _zoom_live_view_clicked lib->rotate_ccw = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL); lib->rotate_cw = dtgtk_button_new(dtgtk_cairo_paint_refresh, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_UP, NULL); lib->flip = dtgtk_togglebutton_new(dtgtk_cairo_paint_flip, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_UP, NULL); gtk_box_pack_start(GTK_BOX(box), lib->live_view, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->live_view_zoom, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->rotate_ccw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->rotate_cw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->flip, TRUE, TRUE, 0); gtk_widget_set_tooltip_text(lib->live_view, _("toggle live view")); gtk_widget_set_tooltip_text(lib->live_view_zoom, _("zoom live view")); gtk_widget_set_tooltip_text(lib->rotate_ccw, _("rotate 90 degrees ccw")); gtk_widget_set_tooltip_text(lib->rotate_cw, _("rotate 90 degrees cw")); gtk_widget_set_tooltip_text(lib->flip, _("flip live view horizontally")); g_signal_connect(G_OBJECT(lib->live_view), "clicked", G_CALLBACK(_toggle_live_view_clicked), lib); g_signal_connect(G_OBJECT(lib->live_view_zoom), "clicked", G_CALLBACK(_zoom_live_view_clicked), lib); g_signal_connect(G_OBJECT(lib->rotate_ccw), "clicked", G_CALLBACK(_rotate_ccw), lib); g_signal_connect(G_OBJECT(lib->rotate_cw), "clicked", G_CALLBACK(_rotate_cw), lib); g_signal_connect(G_OBJECT(lib->flip), "clicked", G_CALLBACK(_toggle_flip_clicked), lib); // focus buttons box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0); lib->focus_in_big = dtgtk_button_new(dtgtk_cairo_paint_solid_triangle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_LEFT, NULL); lib->focus_in_small = dtgtk_button_new(dtgtk_cairo_paint_arrow, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_LEFT, NULL); // TODO icon not centered lib->focus_out_small = dtgtk_button_new(dtgtk_cairo_paint_arrow, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_RIGHT, NULL); // TODO same here lib->focus_out_big = dtgtk_button_new(dtgtk_cairo_paint_solid_triangle, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER | CPF_DIRECTION_RIGHT, NULL); gtk_box_pack_start(GTK_BOX(box), lib->focus_in_big, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->focus_in_small, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->focus_out_small, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), lib->focus_out_big, TRUE, TRUE, 0); gtk_widget_set_tooltip_text(lib->focus_in_big, _("move focus point in (big steps)")); gtk_widget_set_tooltip_text(lib->focus_in_small, _("move focus point in (small steps)")); gtk_widget_set_tooltip_text(lib->focus_out_small, _("move focus point out (small steps)")); gtk_widget_set_tooltip_text(lib->focus_out_big, _("move focus point out (big steps)")); // Near 3 g_signal_connect(G_OBJECT(lib->focus_in_big), "clicked", G_CALLBACK(_focus_button_clicked), GINT_TO_POINTER(2)); // Near 1 g_signal_connect(G_OBJECT(lib->focus_in_small), "clicked", G_CALLBACK(_focus_button_clicked), GINT_TO_POINTER(0)); // Far 1 g_signal_connect(G_OBJECT(lib->focus_out_small), "clicked", G_CALLBACK(_focus_button_clicked), GINT_TO_POINTER(4)); // Far 3 g_signal_connect(G_OBJECT(lib->focus_out_big), "clicked", G_CALLBACK(_focus_button_clicked), GINT_TO_POINTER(6)); // Guides lib->guide_selector = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(lib->guide_selector, NULL, _("guides")); gtk_box_pack_start(GTK_BOX(self->widget), lib->guide_selector, TRUE, TRUE, 0); lib->guides_widgets = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(lib->guides_widgets), FALSE); gtk_box_pack_start(GTK_BOX(self->widget), lib->guides_widgets, TRUE, TRUE, 0); dt_bauhaus_combobox_add(lib->guide_selector, _("none")); int i = 0; for(GList *iter = darktable.guides; iter; iter = g_list_next(iter), i++) { GtkWidget *widget = NULL; dt_guides_t *guide = (dt_guides_t *)iter->data; dt_bauhaus_combobox_add(lib->guide_selector, _(guide->name)); if(guide->widget) { // generate some unique name so that we can have the same name several times char name[5]; snprintf(name, sizeof(name), "%d", i); widget = guide->widget(NULL, guide->user_data); gtk_widget_show_all(widget); gtk_stack_add_named(GTK_STACK(lib->guides_widgets), widget, name); } lib->guides_widgets_list = g_list_append(lib->guides_widgets_list, widget); } gtk_widget_set_no_show_all(lib->guides_widgets, TRUE); gtk_widget_set_tooltip_text(lib->guide_selector, _("display guide lines to help compose your photograph")); g_signal_connect(G_OBJECT(lib->guide_selector), "value-changed", G_CALLBACK(guides_presets_changed), lib); lib->flip_guides = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(lib->flip_guides, NULL, _("flip")); dt_bauhaus_combobox_add(lib->flip_guides, _("none")); dt_bauhaus_combobox_add(lib->flip_guides, _("horizontally")); dt_bauhaus_combobox_add(lib->flip_guides, _("vertically")); dt_bauhaus_combobox_add(lib->flip_guides, _("both")); gtk_widget_set_tooltip_text(lib->flip_guides, _("flip guides")); gtk_box_pack_start(GTK_BOX(self->widget), lib->flip_guides, TRUE, TRUE, 0); lib->overlay = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(lib->overlay, NULL, _("overlay")); dt_bauhaus_combobox_add(lib->overlay, _("none")); dt_bauhaus_combobox_add(lib->overlay, _("selected image")); dt_bauhaus_combobox_add(lib->overlay, _("id")); gtk_widget_set_tooltip_text(lib->overlay, _("overlay another image over the live view")); g_signal_connect(G_OBJECT(lib->overlay), "value-changed", G_CALLBACK(overlay_changed), lib); gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay, TRUE, TRUE, 0); lib->overlay_id_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); GtkWidget *label = gtk_label_new(_("image id")); gtk_widget_set_halign(label, GTK_ALIGN_START); lib->overlay_id = gtk_spin_button_new_with_range(0, 1000000000, 1); gtk_spin_button_set_digits(GTK_SPIN_BUTTON(lib->overlay_id), 0); gtk_widget_set_tooltip_text(lib->overlay_id, _("enter image id of the overlay manually")); g_signal_connect(G_OBJECT(lib->overlay_id), "value-changed", G_CALLBACK(_overlay_id_changed), lib); gtk_spin_button_set_value(GTK_SPIN_BUTTON(lib->overlay_id), dt_conf_get_int("plugins/lighttable/live_view/overlay_imgid")); gtk_box_pack_start(GTK_BOX(lib->overlay_id_box), label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(lib->overlay_id_box), lib->overlay_id, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_id_box, TRUE, TRUE, 0); gtk_widget_show(lib->overlay_id); gtk_widget_show(label); lib->overlay_mode = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(lib->overlay_mode, NULL, _("overlay mode")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "normal")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "xor")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "add")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "saturate")); #if(CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "multiply")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "screen")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "overlay")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "darken")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "lighten")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "color dodge")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "color burn")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "hard light")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "soft light")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "difference")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "exclusion")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL hue")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL saturation")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL color")); dt_bauhaus_combobox_add(lib->overlay_mode, C_("blendmode", "HSL luminosity")); #endif gtk_widget_set_tooltip_text(lib->overlay_mode, _("mode of the overlay")); dt_bauhaus_combobox_set(lib->overlay_mode, dt_conf_get_int("plugins/lighttable/live_view/overlay_mode")); g_signal_connect(G_OBJECT(lib->overlay_mode), "value-changed", G_CALLBACK(_overlay_mode_changed), lib); gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_mode, TRUE, TRUE, 0); lib->overlay_splitline = dt_bauhaus_combobox_new(NULL); dt_bauhaus_widget_set_label(lib->overlay_splitline, NULL, _("split line")); dt_bauhaus_combobox_add(lib->overlay_splitline, _("off")); dt_bauhaus_combobox_add(lib->overlay_splitline, _("on")); gtk_widget_set_tooltip_text(lib->overlay_splitline, _("only draw part of the overlay")); dt_bauhaus_combobox_set(lib->overlay_splitline, dt_conf_get_int("plugins/lighttable/live_view/splitline")); g_signal_connect(G_OBJECT(lib->overlay_splitline), "value-changed", G_CALLBACK(_overlay_splitline_changed), lib); gtk_box_pack_start(GTK_BOX(self->widget), lib->overlay_splitline, TRUE, TRUE, 0); gtk_widget_set_visible(GTK_WIDGET(lib->overlay_mode), FALSE); gtk_widget_set_visible(GTK_WIDGET(lib->overlay_id_box), FALSE); gtk_widget_set_visible(GTK_WIDGET(lib->overlay_splitline), FALSE); gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_mode), TRUE); gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_id_box), TRUE); gtk_widget_set_no_show_all(GTK_WIDGET(lib->overlay_splitline), TRUE); guides_presets_set_visibility(lib, 0); }
/** * Creates empty main application window */ GtkWidget *create_mainwindow (ezeedo_wrapper_structure *ezeedo) { // define widgets GtkWidget *window; GtkWidget *headerbar; GtkWidget *windowmenu_button; GtkWidget *stack; GtkWidget *stackswitcher; GtkWidget *todo_stack; GtkWidget *todo_paned; GtkWidget *todolist_scrollbox; GtkWidget *todolist_box; GtkWidget *categories_scrollbox; GtkWidget *categories_box; GtkWidget *task_entry; GtkWidget *done_stack; GtkWidget *donelist_scrollbox; GtkWidget *donelist_box; GtkWidget *archive_button; // define action GSimpleAction *about_action; // get window size and position from gsettings store GSettings *settings; gint width; gint height; gint x; gint y; gint sidebar_size; settings = g_settings_new ("org.y20k.ezeedo"); width = g_settings_get_int (settings, "main-window-width"); height = g_settings_get_int (settings, "main-window-height"); x = g_settings_get_int (settings, "main-window-position-y"); y = g_settings_get_int (settings, "main-window-position-y"); sidebar_size = g_settings_get_int (settings, "sidebar-size"); g_object_unref (settings); // create main window with title and default size window = gtk_application_window_new (ezeedo->application); gtk_window_set_title (GTK_WINDOW (window), "Ezeedo"); gtk_window_set_icon_name (GTK_WINDOW (window), EZEEDOICON); gtk_window_set_default_size (GTK_WINDOW (window), width, height); gtk_window_move (GTK_WINDOW (window), x, y); // create headerbar and stack switcher headerbar = gtk_header_bar_new (); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(headerbar), true); stackswitcher = gtk_stack_switcher_new (); // create stack for todo and done stack = gtk_stack_new (); // create stack for todolist todo_stack = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); // create paned container for left and right columns of todo tab todo_paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_position (GTK_PANED(todo_paned), sidebar_size); // create categories scrollbox and box for left pane categories_scrollbox = gtk_scrolled_window_new (NULL, NULL); categories_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); // create todolist scrollbox and box for right pane todolist_scrollbox = gtk_scrolled_window_new (NULL, NULL); todolist_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); // create task entry task_entry = gtk_entry_new (); gtk_widget_set_margin_start (GTK_WIDGET(task_entry), 10); gtk_widget_set_margin_end (GTK_WIDGET(task_entry), 10); gtk_widget_set_margin_top (GTK_WIDGET(task_entry), 10); gtk_widget_set_margin_bottom (GTK_WIDGET(task_entry), 10); gtk_entry_set_placeholder_text (GTK_ENTRY(task_entry), "Enter new task"); gtk_entry_set_max_length (GTK_ENTRY(task_entry), TASKLENGTH); gtk_widget_grab_focus (task_entry); // create stack for donelist done_stack = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); // create donelist scrollbox and box donelist_scrollbox = gtk_scrolled_window_new (NULL, NULL); donelist_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); // create archive button archive_button = gtk_button_new_with_label ("Archive all done tasks"); gtk_widget_set_margin_start (GTK_WIDGET (archive_button), 10); gtk_widget_set_margin_end (GTK_WIDGET (archive_button), 10); gtk_widget_set_margin_top (GTK_WIDGET (archive_button), 10); gtk_widget_set_margin_bottom (GTK_WIDGET (archive_button), 10); // add some widgets to ezeedo wrapper structure ezeedo->window = window; ezeedo->todo_paned = todo_paned; ezeedo->categories_box = categories_box; ezeedo->todolist_box = todolist_box; ezeedo->donelist_box = donelist_box; // create window menu windowmenu_button = create_windowmenu (ezeedo); // create about action and connect about action signal about_action = g_simple_action_new ("about", NULL); g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action)); g_signal_connect (about_action, "activate", G_CALLBACK (show_about_window), window); // detect entry signal g_signal_connect (task_entry, "activate", G_CALLBACK (add_task_entry), ezeedo); // detect archive button pressed g_signal_connect (archive_button, "clicked", G_CALLBACK (display_info_dialog), "Task archival is not supported yet."); // detect window close g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (close_window), ezeedo); // construct headerbar for main window gtk_window_set_titlebar (GTK_WINDOW(window), headerbar); gtk_header_bar_pack_start (GTK_HEADER_BAR(headerbar), stackswitcher); gtk_header_bar_pack_end (GTK_HEADER_BAR(headerbar), windowmenu_button); // add stack to main window gtk_container_add (GTK_CONTAINER(window), stack); // set stack switcher and populate stack with todolist and donelist gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER(stackswitcher), GTK_STACK(stack)); gtk_stack_add_titled (GTK_STACK(stack), todo_stack, "To do", "To do"); gtk_stack_add_titled (GTK_STACK(stack), done_stack, "Done", "Done"); // construct main todo stack gtk_container_add (GTK_CONTAINER(todo_stack), todo_paned); gtk_paned_add1 (GTK_PANED(todo_paned), categories_scrollbox); gtk_paned_add2 (GTK_PANED(todo_paned), todolist_scrollbox); // add box to scrollable box gtk_container_add (GTK_CONTAINER(todolist_scrollbox), todolist_box); // add task entry to todo stack gtk_container_add (GTK_CONTAINER(todo_stack), task_entry); // add box to scrollable box gtk_container_add (GTK_CONTAINER(categories_scrollbox), categories_box); // construct main donelist stack gtk_container_add (GTK_CONTAINER(done_stack), donelist_scrollbox); gtk_container_add (GTK_CONTAINER(donelist_scrollbox), donelist_box); return (window); }
GtkWidget * do_sidebar (GtkWidget *do_widget) { static GtkWidget *window = NULL; GtkWidget *sidebar; GtkWidget *stack; GtkWidget *box; GtkWidget *widget; GtkWidget *header; const gchar* pages[] = { "Welcome to GTK+", "GtkStackSidebar Widget", "Automatic navigation", "Consistent appearance", "Scrolling", "Page 6", "Page 7", "Page 8", "Page 9", NULL }; const gchar *c = NULL; guint i; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable (GTK_WINDOW (window), TRUE); gtk_widget_set_size_request (window, 500, 350); header = gtk_header_bar_new (); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE); gtk_window_set_titlebar (GTK_WINDOW(window), header); gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); sidebar = gtk_stack_sidebar_new (); gtk_box_pack_start (GTK_BOX (box), sidebar, FALSE, FALSE); stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN); gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack)); /* Separator between sidebar and stack */ widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX(box), widget, FALSE, FALSE); gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE); for (i=0; (c = *(pages+i)) != NULL; i++ ) { if (i == 0) { widget = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU); gtk_image_set_pixel_size (GTK_IMAGE (widget), 256); } else { widget = gtk_label_new (c); } gtk_stack_add_named (GTK_STACK (stack), widget, c); gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", c, NULL); } gtk_container_add (GTK_CONTAINER (window), box); } if (!gtk_widget_get_visible (window)) gtk_widget_show_all (window); else gtk_widget_destroy (window); return window; }
static void nemo_toolbar_constructed (GObject *obj) { NemoToolbar *self = NEMO_TOOLBAR (obj); GtkWidget *toolbar; GtkWidget *hbox; GtkToolItem *tool_box; GtkWidget *box; GtkStyleContext *context; G_OBJECT_CLASS (nemo_toolbar_parent_class)->constructed (obj); gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)), GTK_JUNCTION_BOTTOM); self->priv->show_location_entry = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_LOCATION_ENTRY); /* add the UI */ self->priv->ui_manager = gtk_ui_manager_new (); gtk_ui_manager_insert_action_group (self->priv->ui_manager, self->priv->action_group, 0); toolbar = gtk_toolbar_new (); self->priv->toolbar = toolbar; gtk_box_pack_start (GTK_BOX (self), self->priv->toolbar, TRUE, TRUE, 0); context = gtk_widget_get_style_context (GTK_WIDGET(toolbar)); gtk_style_context_add_class (context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); /* Back/Forward/Up */ self->priv->navigation_box = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->previous_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_BACK); gtk_container_add (GTK_CONTAINER (box), self->priv->previous_button); self->priv->next_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_FORWARD); gtk_container_add (GTK_CONTAINER (box), self->priv->next_button); self->priv->up_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_UP); gtk_container_add (GTK_CONTAINER (box), self->priv->up_button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_container_add (GTK_CONTAINER (self->priv->navigation_box), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->navigation_box)); gtk_widget_show_all (GTK_WIDGET (self->priv->navigation_box)); gtk_widget_set_margin_right (GTK_WIDGET (self->priv->navigation_box), 6); /* Refresh */ self->priv->refresh_box = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->refresh_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_RELOAD); gtk_container_add (GTK_CONTAINER (box), self->priv->refresh_button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_container_add (GTK_CONTAINER (self->priv->refresh_box), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->refresh_box)); gtk_widget_show_all (GTK_WIDGET (self->priv->refresh_box)); gtk_widget_set_margin_right (GTK_WIDGET (self->priv->refresh_box), 6); /* Home/Computer */ self->priv->location_box = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->home_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_HOME); gtk_container_add (GTK_CONTAINER (box), self->priv->home_button); self->priv->computer_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_COMPUTER); gtk_container_add (GTK_CONTAINER (box), self->priv->computer_button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_container_add (GTK_CONTAINER (self->priv->location_box), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->location_box)); gtk_widget_show_all (GTK_WIDGET (self->priv->location_box)); gtk_widget_set_margin_right (GTK_WIDGET (self->priv->location_box), 6); /* Container to hold the location and pathbars */ self->priv->stack = gtk_stack_new(); gtk_stack_set_transition_type (GTK_STACK (self->priv->stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE); gtk_stack_set_transition_duration (GTK_STACK (self->priv->stack), 150); /* Regular Path Bar */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (self->priv->stack), TRUE, TRUE, 0); self->priv->path_bar = g_object_new (NEMO_TYPE_PATH_BAR, NULL); gtk_stack_add_named(GTK_STACK (self->priv->stack), GTK_WIDGET (self->priv->path_bar), "path_bar"); /* Entry-Like Location Bar */ self->priv->location_bar = nemo_location_bar_new (); gtk_stack_add_named(GTK_STACK (self->priv->stack), GTK_WIDGET (self->priv->location_bar), "location_bar"); gtk_widget_show_all (hbox); tool_box = gtk_tool_item_new (); gtk_tool_item_set_expand (tool_box, TRUE); gtk_container_add (GTK_CONTAINER (tool_box), hbox); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (tool_box)); gtk_widget_show (GTK_WIDGET (tool_box)); /* Search/Open in Terminal/New Folder/Toggle Location */ self->priv->tools_box = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->toggle_location_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_TOGGLE_LOCATION); gtk_container_add (GTK_CONTAINER (box), self->priv->toggle_location_button); self->priv->open_terminal_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_OPEN_IN_TERMINAL); gtk_container_add (GTK_CONTAINER (box), self->priv->open_terminal_button); self->priv->new_folder_button = toolbar_create_toolbutton (self, FALSE, NEMO_ACTION_NEW_FOLDER); gtk_container_add (GTK_CONTAINER (box), self->priv->new_folder_button); self->priv->search_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_SEARCH); gtk_container_add (GTK_CONTAINER (box), self->priv->search_button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_container_add (GTK_CONTAINER (self->priv->tools_box), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->tools_box)); gtk_widget_show_all (GTK_WIDGET (self->priv->tools_box)); gtk_widget_set_margin_left (GTK_WIDGET (self->priv->tools_box), 6); setup_root_info_bar (self); /* View Select */ self->priv->view_box = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->icon_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_ICON_VIEW); gtk_container_add (GTK_CONTAINER (box), self->priv->icon_view_button); self->priv->list_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_LIST_VIEW); gtk_container_add (GTK_CONTAINER (box), self->priv->list_view_button); self->priv->compact_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_COMPACT_VIEW); gtk_container_add (GTK_CONTAINER (box), self->priv->compact_view_button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_container_add (GTK_CONTAINER (self->priv->view_box), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (self->priv->toolbar), GTK_WIDGET (self->priv->view_box)); gtk_widget_show_all (GTK_WIDGET (self->priv->view_box)); gtk_widget_set_margin_left (GTK_WIDGET (self->priv->view_box), 6); /* nemo patch */ g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_PREVIOUS_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_NEXT_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_UP_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_EDIT_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_RELOAD_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_HOME_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_COMPUTER_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_SEARCH_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_NEW_FOLDER_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_OPEN_IN_TERMINAL_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_ICON_VIEW_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_LIST_VIEW_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_SHOW_COMPACT_VIEW_ICON_TOOLBAR, G_CALLBACK (toolbar_update_appearance), self); toolbar_update_appearance (self); }
static GtkWidget* create_starter_widget (StarterPlugin* plugin) { GError *error; GtkWidget *stack; GtkWidget *switcher; GtkWidget *starter_box; GtkWidget *switcher_box; GtkWidget *actions_frame; GtkWidget *actions_listbox; GtkWidget *recent_projects_box; GtkWidget *recent_listbox; GtkBuilder *builder; GtkWidget *button; error = NULL; builder = gtk_builder_new (); if (!gtk_builder_add_from_resource (builder, "/org/gnome/anjuta/ui/starter.ui", &error)) { DEBUG_PRINT ("Could not load starter.ui! %s", error->message); g_error_free (error); } else { /* Manually assembling stack and switcher because they are not available in glade yet */ switcher = gtk_stack_switcher_new (); stack = gtk_stack_new (); gtk_stack_switcher_set_stack (switcher, stack); gtk_stack_set_transition_type (stack, GTK_STACK_TRANSITION_TYPE_CROSSFADE); gtk_stack_set_transition_duration (stack, TRANSITION_TIME); starter_box = GTK_WIDGET (gtk_builder_get_object (builder, STARTER_BOX)); switcher_box = GTK_WIDGET (gtk_builder_get_object (builder, SWITCHER_BOX)); gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (starter_box)), starter_box); g_object_ref (starter_box); gtk_box_pack_start (switcher_box, switcher, FALSE, FALSE, 0); gtk_box_pack_start (starter_box, stack, FALSE, FALSE, 0); gtk_widget_show_all (starter_box); actions_listbox = GTK_WIDGET (gtk_builder_get_object (builder, ACTIONS_LISTBOX)); gtk_list_box_set_header_func (GTK_LIST_BOX (actions_listbox), add_action_separators, NULL, NULL); actions_frame = GTK_WIDGET (gtk_builder_get_object (builder, ACTIONS_FRAME)); gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (actions_frame)), actions_frame); g_object_ref (actions_frame); gtk_stack_add_titled (stack, actions_frame, ACTIONS_ID, "Actions"); recent_projects_box = GTK_WIDGET (gtk_builder_get_object (builder, RECENT_PROJECTS_BOX)); gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (recent_projects_box)), recent_projects_box); g_object_ref (recent_projects_box); recent_listbox = GTK_WIDGET (gtk_builder_get_object (builder, RECENT_LISTBOX)); refresh_recent_project_view (GTK_LIST_BOX (recent_listbox)); gtk_stack_add_titled (stack, recent_projects_box, RECENT_PROJECTS_ID, "Recent Projects"); button = GTK_WIDGET (gtk_builder_get_object (builder, REMOVE_PROJECT_BUTTON)); g_signal_connect_object (G_OBJECT (button), "clicked", G_CALLBACK (on_remove_project_clicked), recent_listbox, G_CONNECT_AFTER); gtk_builder_connect_signals (builder, plugin); } g_object_unref (builder); return starter_box; }