void dt_ui_container_focus_widget(dt_ui_t *ui, const dt_ui_container_t c, GtkWidget *w) { //if(!GTK_IS_CONTAINER(ui->containers[c])) return; g_return_if_fail(GTK_IS_CONTAINER(ui->containers[c])); gtk_container_set_focus_child(GTK_CONTAINER(ui->containers[c]), w); gtk_widget_queue_draw(ui->containers[c]); }
/* * Override GtkContainer's focus movement so the user can * explicitly specify the tab order. */ static gint columns_focus(GtkContainer *container, GtkDirectionType dir) { Columns *cols; GList *pos; GtkWidget *focuschild; g_return_val_if_fail(container != NULL, FALSE); g_return_val_if_fail(IS_COLUMNS(container), FALSE); cols = COLUMNS(container); if (!GTK_WIDGET_DRAWABLE(cols) || !GTK_WIDGET_IS_SENSITIVE(cols)) return FALSE; if (!GTK_WIDGET_CAN_FOCUS(container) && (dir == GTK_DIR_TAB_FORWARD || dir == GTK_DIR_TAB_BACKWARD)) { focuschild = container->focus_child; gtk_container_set_focus_child(container, NULL); if (dir == GTK_DIR_TAB_FORWARD) pos = cols->taborder; else pos = g_list_last(cols->taborder); while (pos) { GtkWidget *child = pos->data; if (focuschild) { if (focuschild == child) { focuschild = NULL; /* now we can start looking in here */ if (GTK_WIDGET_DRAWABLE(child) && GTK_IS_CONTAINER(child) && !GTK_WIDGET_HAS_FOCUS(child)) { if (gtk_container_focus(GTK_CONTAINER(child), dir)) return TRUE; } } } else if (GTK_WIDGET_DRAWABLE(child)) { if (GTK_IS_CONTAINER(child)) { if (gtk_container_focus(GTK_CONTAINER(child), dir)) return TRUE; } else if (GTK_WIDGET_CAN_FOCUS(child)) { gtk_widget_grab_focus(child); return TRUE; } } if (dir == GTK_DIR_TAB_FORWARD) pos = pos->next; else pos = pos->prev; } return FALSE; } else return columns_inherited_focus(container, dir); }
void search_box(CSIde_app *app){ SearchBox *search =(SearchBox*) g_slice_new(SearchBox); GtkWidget *search_dialog, *area, *grid, *btn_find, *btn_replace, *btn_replace_all; search_dialog = gtk_dialog_new_with_buttons ("search box", GTK_WINDOW(app->main_window), GTK_DIALOG_DESTROY_WITH_PARENT, "Close", GTK_RESPONSE_CANCEL, NULL); search->find_entry = gtk_search_entry_new(); search->replace_entry = gtk_entry_new(); search->app = app; btn_find = gtk_button_new_with_label("Find"); g_signal_connect(btn_find,"clicked",G_CALLBACK(search_btn_clicked),(gpointer) search); btn_replace = gtk_button_new_with_label("Replace"); g_signal_connect(btn_replace,"clicked",G_CALLBACK(replace_btn_clicked),(gpointer) search); btn_replace_all = gtk_button_new_with_label("Replace all"); g_signal_connect(btn_replace_all,"clicked",G_CALLBACK(replace_all_btn_clicked),(gpointer) search); area = gtk_dialog_get_content_area(GTK_DIALOG(search_dialog)); gtk_container_set_border_width(GTK_CONTAINER(area),10); grid = gtk_grid_new(); gtk_container_set_focus_child (GTK_CONTAINER(grid),search->find_entry); //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); gtk_grid_set_row_spacing (GTK_GRID(grid),10); gtk_grid_set_column_spacing (GTK_GRID(grid),10); gtk_box_pack_start (GTK_BOX(area),grid,TRUE,TRUE,0); gtk_grid_attach (GTK_GRID(grid),btn_find,1,1,5,1); gtk_grid_attach (GTK_GRID(grid),search->find_entry,6,1,6,1); gtk_grid_attach (GTK_GRID(grid),btn_replace,1,3,5,1); gtk_grid_attach (GTK_GRID(grid),search->replace_entry,6,3,6,1); gtk_grid_attach (GTK_GRID(grid),btn_replace_all,1,5,5,1); gtk_widget_show_all(grid); gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(search->app->editor->buffer),&iStart); switch(gtk_dialog_run(GTK_DIALOG(search_dialog))){ case GTK_RESPONSE_CANCEL : gtk_widget_destroy(search_dialog); g_slice_free(SearchBox,search); break; } }
/** * text_search_new: * * Returns: a new #GtkWidget */ GtkWidget * text_search_new (GtkTextView *view) { g_return_val_if_fail (GTK_IS_TEXT_VIEW (view), NULL); TextSearch *tsearch; GtkWidget *wid; tsearch = TEXT_SEARCH (g_object_new (TEXT_SEARCH_TYPE, "spacing", 5, "homogeneous", FALSE, NULL)); tsearch->priv->view = view; g_object_ref ((GObject*) tsearch->priv->view); tsearch->priv->text = gtk_text_view_get_buffer (view); gtk_text_buffer_create_tag (tsearch->priv->text, "search", "background", "yellow", NULL); wid = browser_make_small_button (FALSE, FALSE, NULL, GTK_STOCK_CLOSE, _("Hide search toolbar")); gtk_box_pack_start (GTK_BOX (tsearch), wid, FALSE, FALSE, 0); g_signal_connect_swapped (wid, "clicked", G_CALLBACK (hide_search_bar), tsearch); wid = gtk_label_new (_("Search:")); gtk_box_pack_start (GTK_BOX (tsearch), wid, FALSE, FALSE, 0); wid = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (tsearch), wid, TRUE, TRUE, 0); tsearch->priv->search_entry = wid; gtk_container_set_focus_child (GTK_CONTAINER (tsearch), tsearch->priv->search_entry); g_signal_connect (wid, "changed", G_CALLBACK (search_text_changed_cb), tsearch); wid = browser_make_small_button (FALSE, FALSE, NULL, GTK_STOCK_GO_BACK, NULL); gtk_box_pack_start (GTK_BOX (tsearch), wid, FALSE, FALSE, 0); g_signal_connect (wid, "clicked", G_CALLBACK (go_back_search_cb), tsearch); wid = browser_make_small_button (FALSE, FALSE, NULL, GTK_STOCK_GO_FORWARD, NULL); gtk_box_pack_start (GTK_BOX (tsearch), wid, FALSE, FALSE, 0); g_signal_connect (wid, "clicked", G_CALLBACK (go_forward_search_cb), tsearch); wid = gtk_check_button_new_with_label (_("Case sensitive")); gtk_box_pack_start (GTK_BOX (tsearch), wid, FALSE, FALSE, 0); tsearch->priv->search_sensitive = GTK_TOGGLE_BUTTON (wid); g_signal_connect (wid, "toggled", G_CALLBACK (sensitive_toggled_cb), tsearch); gtk_widget_show_all ((GtkWidget*) tsearch); gtk_widget_hide ((GtkWidget*) tsearch); return (GtkWidget*) tsearch; }
static void drawer_focus_panel_widget (Drawer *drawer, GtkDirectionType direction) { PanelWidget *panel_widget; panel_widget = panel_toplevel_get_panel_widget (drawer->toplevel); gtk_window_present (GTK_WINDOW (drawer->toplevel)); gtk_container_set_focus_child (GTK_CONTAINER (panel_widget), NULL); gtk_widget_child_focus (GTK_WIDGET (panel_widget), direction); }
int clip_GTK_CONTAINERSETFOCUSCHILD(ClipMachine * cm) { C_widget *ccon = _fetch_cw_arg(cm); C_widget *cwid = _fetch_cwidget(cm,_clip_spar(cm,2)); CHECKCWID(ccon,GTK_IS_CONTAINER); CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cwid,GTK_IS_WIDGET); gtk_container_set_focus_child(GTK_CONTAINER(ccon->widget), cwid->widget); return 0; err: return 1; }
static void hildon_font_selection_dialog_init (HildonFontSelectionDialog *fontseldiag) { HildonFontSelectionDialogPrivate *priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE (fontseldiag); GtkWidget *preview_button; g_assert (priv); priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ()); hildon_font_selection_dialog_construct_notebook (fontseldiag); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (fontseldiag)->vbox), GTK_WIDGET (priv->notebook), TRUE, TRUE, 0); /* Add dialog buttons */ gtk_dialog_add_button (GTK_DIALOG (fontseldiag), _("ecdg_bd_font_dialog_ok"), GTK_RESPONSE_OK); preview_button = gtk_button_new_with_label (_("ecdg_bd_font_dialog_preview")); gtk_box_pack_start (GTK_BOX(GTK_DIALOG (fontseldiag)->action_area), preview_button, FALSE, TRUE, 0); g_signal_connect_swapped (preview_button, "clicked", G_CALLBACK (hildon_font_selection_dialog_show_preview), fontseldiag); gtk_widget_show(preview_button); gtk_dialog_add_button (GTK_DIALOG (fontseldiag), _("ecdg_bd_font_dialog_cancel"), GTK_RESPONSE_CANCEL); /*Set default preview text*/ priv->preview_text = g_strdup (_("ecdg_fi_preview_font_preview_text")); gtk_window_set_title (GTK_WINDOW (fontseldiag), _("ecdg_ti_font")); /*here is the line to make sure that notebook has the default focus*/ gtk_container_set_focus_child (GTK_CONTAINER (GTK_DIALOG (fontseldiag)->vbox), GTK_WIDGET (priv->notebook)); }
/* Create the toolbar for the greyramp window. */ static GtkWidget* createGreyrampToolbar(GtkTable *table, const int col, GtkWidget *greyramp, GtkWidget *whiteSpinButton, GtkWidget *blackSpinButton, const int blackPoint, const int whitePoint) { GtkWidget *quitButton = gtk_button_new_with_label("Close"); GtkWidget *swapButton = gtk_button_new_with_label("Swap"); GtkWidget *undoButton = gtk_button_new_with_label("Undo"); g_signal_connect(G_OBJECT(quitButton), "pressed", G_CALLBACK(onCloseGreyramp), greyramp); g_signal_connect(G_OBJECT(undoButton), "pressed", G_CALLBACK(onPressUndoButton), greyramp); g_signal_connect(G_OBJECT(swapButton), "pressed", G_CALLBACK(onPressSwapButton), greyramp); /* Pack them vertically into the 'toolbar' (which is just a vbox for now) */ GtkWidget *vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 5); const int padding = 5; int row = 0; gtk_table_attach(table, whiteSpinButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, padding, padding); ++row; gtk_table_attach(table, quitButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, padding, padding); ++row; gtk_table_attach(table, swapButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, padding, padding); ++row; gtk_table_attach(table, undoButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, padding, padding); ++row; gtk_table_attach(table, blackSpinButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, padding, padding); ++row; /* Make sure neither spin button is focused at the start because if it is * then its text will be selected and we will inadvertently overwrite the * contents of the primary clipboard. */ gtk_container_set_focus_child(GTK_CONTAINER(vbox), quitButton); return vbox; }
static void npw_druid_fill_property_page (NPWDruid* druid, NPWPage* page) { GtkWidget *widget; GList *children; GtkLabel *label; NPWDruidAddPropertyData data; /* Add page to assistant, after current page */ widget = gtk_assistant_get_nth_page (GTK_ASSISTANT (druid->window), gtk_assistant_get_current_page (GTK_ASSISTANT (druid->window)) + 1); /* Remove previous widgets */ gtk_container_foreach (GTK_CONTAINER (npw_page_get_widget (page)), cb_druid_destroy_widget, NULL); /* Update title */ children = gtk_container_get_children (GTK_CONTAINER (widget)); label = GTK_LABEL (g_list_nth_data (children, 0)); g_list_free (children); gtk_label_set_text (label, npw_page_get_label (page)); gtk_assistant_set_page_title (GTK_ASSISTANT (druid->window), widget, npw_page_get_label (page)); /* Add new widget */ data.druid = druid; data.row = 0; data.table = GTK_GRID (npw_page_get_widget (page)); data.first_entry = NULL; npw_page_foreach_property (page, (GFunc)cb_druid_add_property, &data); /* Move focus on first entry */ if (data.first_entry != NULL) { gtk_container_set_focus_child (GTK_CONTAINER (data.table), data.first_entry); } gtk_widget_show_all (widget); }
void plugin_init(GeanyData *data) { conf = g_build_path(G_DIR_SEPARATOR_S, geany_data->app->configdir, "plugins", "quick-find.conf", NULL); config = g_key_file_new(); g_key_file_load_from_file(config, conf, G_KEY_FILE_NONE, NULL); executable = utils_get_setting_string(config, "main", "executable", DEFAULT_EXECUTABLE); trim_file = g_regex_new(g_strconcat("^.*", G_DIR_SEPARATOR_S, NULL), G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL); trim_regex = g_regex_new("\n$", G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL); label = gtk_label_new(_("Find")); panel = gtk_vbox_new(FALSE, 6); scrollable_table = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable_table), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(panel), scrollable_table, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), panel, label); entry = gtk_entry_new(); gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND); g_signal_connect(entry, "activate", G_CALLBACK(on_activate), NULL); GtkWidget *button_box = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(button_box), entry, TRUE, TRUE, 0); GtkWidget *button = gtk_button_new_with_label(_("Find")); g_signal_connect(button, "clicked", G_CALLBACK(on_click), NULL); gtk_box_pack_end(GTK_BOX(button_box), button, FALSE, TRUE, 0); check_case = gtk_check_button_new_with_label(_("Case Sensitive")); ui_widget_set_tooltip_text(check_case, _("Perform a case-sensitive search.")); gtk_box_pack_end(GTK_BOX(panel), check_case, FALSE, TRUE, 0); gtk_box_pack_end(GTK_BOX(panel), button_box, FALSE, TRUE, 0); gtk_container_set_focus_child(GTK_CONTAINER(panel), entry); GtkTreeViewColumn *number_column, *line_column, *file_column, *text_column; GtkCellRenderer *render; list = gtk_tree_store_new(4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list)); render = gtk_cell_renderer_text_new(); number_column = gtk_tree_view_column_new_with_attributes("#", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), number_column); gtk_tree_view_column_set_alignment(number_column, 1.0); gtk_cell_renderer_set_alignment(render, 1.0, 0.0); gtk_tree_view_column_add_attribute(number_column, render, "text", 0); render = gtk_cell_renderer_text_new(); line_column = gtk_tree_view_column_new_with_attributes("Line", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), line_column); gtk_tree_view_column_set_alignment(line_column, 1.0); gtk_cell_renderer_set_alignment(render, 1.0, 0.0); gtk_tree_view_column_add_attribute(line_column, render, "text", 1); render = gtk_cell_renderer_text_new(); file_column = gtk_tree_view_column_new_with_attributes("File", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), file_column); gtk_tree_view_column_add_attribute(file_column, render, "text", 2); gtk_tree_view_column_set_cell_data_func(file_column, render, (GtkTreeCellDataFunc)cell_data, NULL, NULL); render = gtk_cell_renderer_text_new(); text_column = gtk_tree_view_column_new_with_attributes("Text", render, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), text_column); gtk_tree_view_column_add_attribute(text_column, render, "text", 3); g_object_unref(GTK_TREE_MODEL(list)); GtkTreeSelection *select = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); g_signal_connect(select, "changed", G_CALLBACK(selected_row), NULL); gtk_container_add(GTK_CONTAINER(scrollable_table), tree); gtk_widget_show(label); gtk_widget_show_all(panel); g_signal_connect(geany->main_widgets->window, "key-release-event", G_CALLBACK(panel_focus_tab), NULL); GeanyKeyGroup *key_group; key_group = plugin_set_key_group(geany_plugin, "quick_find_keyboard_shortcut", KB_GROUP, NULL); keybindings_set_item(key_group, KB_QUICK_FIND, entry_focus, 0, 0, "quick_find", _("Quick Find..."), NULL); }
static gint midori_frontend_diagnostic_dialog (MidoriApp* app, MidoriWebSettings* settings, KatzeArray* session) { GtkWidget* dialog; GtkWidget* content_area; GtkWidget* align; GtkWidget* box; GtkWidget* button; MidoriStartup load_on_startup = katze_object_get_enum (settings, "load-on-startup"); gint response; dialog = gtk_message_dialog_new ( NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("CDOS crashed the last time it was opened. You can report the problem at %s."), PACKAGE_BUGREPORT); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE); gtk_window_set_title (GTK_WINDOW (dialog), g_get_application_name ()); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); align = gtk_alignment_new (0.5, 0.5, 0.5, 0.5); gtk_box_pack_start (GTK_BOX (content_area), align, FALSE, TRUE, 0); box = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (align), box); button = gtk_button_new_with_mnemonic (_("Modify _preferences")); g_signal_connect (button, "clicked", G_CALLBACK (button_modify_preferences_clicked_cb), settings); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 4); button = gtk_button_new_with_mnemonic (_("Disable all _extensions")); if (g_object_get_data (G_OBJECT (app), "extensions")) g_signal_connect (button, "clicked", G_CALLBACK (button_disable_extensions_clicked_cb), app); else gtk_widget_set_sensitive (button, FALSE); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 4); gtk_widget_show_all (align); button = katze_property_proxy (settings, "show-crash-dialog", NULL); gtk_button_set_label (GTK_BUTTON (button), _("Show a dialog after Midori crashed")); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (content_area), button, FALSE, TRUE, 0); gtk_container_set_focus_child (GTK_CONTAINER (dialog), gtk_dialog_get_action_area (GTK_DIALOG (dialog))); gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("Discard old tabs"), MIDORI_STARTUP_BLANK_PAGE, _("Show last tabs without loading"), MIDORI_STARTUP_DELAYED_PAGES, _("Show last open tabs"), MIDORI_STARTUP_LAST_OPEN_PAGES, NULL); gchar* crash_log = g_build_filename (midori_paths_get_runtime_dir (), "gdb.bt", NULL); if (g_access (crash_log, F_OK) == 0) { GtkWidget* log_button = gtk_button_new_with_mnemonic (_("Show last crash _log")); g_signal_connect_data (log_button, "clicked", G_CALLBACK (midori_frontend_crash_log_cb), crash_log, (GClosureNotify)g_free, 0); gtk_widget_show (log_button); gtk_box_pack_start (GTK_BOX (box), log_button, FALSE, FALSE, 4); } else g_free (crash_log); gchar* gdb = g_find_program_in_path ("gdb"); if (gdb != NULL) { GtkWidget* gdb_button = gtk_button_new_with_mnemonic (_("Run in _debugger")); g_signal_connect (button, "clicked", G_CALLBACK (midori_frontend_debugger_cb), dialog); gtk_widget_show (gdb_button); gtk_box_pack_start (GTK_BOX (box), gdb_button, FALSE, FALSE, 4); } gtk_dialog_set_default_response (GTK_DIALOG (dialog), load_on_startup == MIDORI_STARTUP_HOMEPAGE ? MIDORI_STARTUP_BLANK_PAGE : load_on_startup); /* GtkLabel can't wrap the text properly. Until some day this works, we implement this hack to do it ourselves. */ GList* ch = gtk_container_get_children (GTK_CONTAINER (content_area)); GtkWidget* hbox = (GtkWidget*)g_list_nth_data (ch, 0); g_list_free (ch); ch = gtk_container_get_children (GTK_CONTAINER (hbox)); GtkWidget* vbox = (GtkWidget*)g_list_nth_data (ch, 1); g_list_free (ch); ch = gtk_container_get_children (GTK_CONTAINER (vbox)); GtkWidget* label = (GtkWidget*)g_list_nth_data (ch, 0); g_list_free (ch); GtkRequisition req; gtk_widget_size_request (content_area, &req); gtk_widget_set_size_request (label, req.width * 0.9, -1); response = midori_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_DELETE_EVENT) response = G_MAXINT; else if (response == GTK_RESPONSE_HELP) { sokoke_spawn_gdb (gdb, FALSE); response = G_MAXINT; } else if (response == MIDORI_STARTUP_BLANK_PAGE) katze_array_clear (session); return response; }
static void populate_window(ChmSee *self) { GtkWidget* vbox = gtk_vbox_new(FALSE, 0); GladeXML *glade; glade = glade_xml_new(get_resource_path(GLADE_FILE), "main_vbox", NULL); if (glade == NULL) { g_error("Cannot find glade file!"); exit(1); } g_object_set_data(G_OBJECT (self), "glade", glade); GtkWidget *main_vbox; main_vbox = get_widget(self, "main_vbox"); gtk_container_add(GTK_CONTAINER (self), vbox); GtkActionGroup* action_group = gtk_action_group_new ("MenuActions"); selfp->action_group = action_group; gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), self); gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), self); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "NewTab"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "CloseTab"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "Home"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "Back"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "Forward"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "SidePane"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "ZoomIn"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "ZoomOut"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "ZoomReset"), FALSE); GtkUIManager* ui_manager = gtk_ui_manager_new (); selfp->ui_manager = ui_manager; gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); GtkAccelGroup* accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (self), accel_group); GError* error = NULL; if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); exit (EXIT_FAILURE); } GtkWidget* menubar = gtk_handle_box_new(); selfp->menubar = menubar; gtk_container_add(GTK_CONTAINER(menubar), gtk_ui_manager_get_widget (ui_manager, "/MainMenu")); gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0); GtkWidget* toolbar = gtk_handle_box_new(); selfp->toolbar = toolbar; gtk_container_add(GTK_CONTAINER(toolbar), gtk_ui_manager_get_widget(ui_manager, "/toolbar")); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); GtkWidget* ui_chmfile = chmsee_ui_chmfile_new(); selfp->ui_chmfile = ui_chmfile; gtk_box_pack_start(GTK_BOX(vbox), ui_chmfile, TRUE, TRUE, 0); gtk_container_set_focus_child(GTK_CONTAINER(vbox), ui_chmfile); g_signal_connect_swapped(ui_chmfile, "model_changed", G_CALLBACK(on_ui_chmfile_model_changed), self); g_signal_connect_swapped(ui_chmfile, "html_changed", G_CALLBACK(on_ui_chmfile_html_changed), self); g_signal_connect_swapped(ui_chmfile, "notify::link-message", G_CALLBACK(on_ui_chmfile_html_link_message_notify), self); gtk_tool_button_set_icon_widget( GTK_TOOL_BUTTON(gtk_ui_manager_get_widget(ui_manager, "/toolbar/sidepane")), gtk_image_new_from_file(get_resource_path("show-pane.png"))); gtk_box_pack_start (GTK_BOX (vbox), main_vbox, FALSE, FALSE, 0); gtk_widget_show_all(vbox); accel_group = g_object_new(GTK_TYPE_ACCEL_GROUP, NULL); gtk_window_add_accel_group(GTK_WINDOW (self), accel_group); /* status bar */ selfp->statusbar = glade_xml_get_widget(glade, "statusbar"); selfp->scid_default = gtk_statusbar_get_context_id(GTK_STATUSBAR (selfp->statusbar), "default"); update_status_bar(self, _("Ready!")); }