当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_NOTEBOOK函数代码示例

本文整理汇总了C++中GTK_NOTEBOOK函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_NOTEBOOK函数的具体用法?C++ GTK_NOTEBOOK怎么用?C++ GTK_NOTEBOOK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_NOTEBOOK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: save_file

void save_file(GtkButton *button) {
  /** Save editor content as the stored filename. **/

  #ifdef DEBUG
    DEBUG_FUNC_MARK
  #endif


  /** Retrieve the stored filepath: **/
  gpointer filepath = g_object_get_data(G_OBJECT(current_editor.current_buffer), "filepath") ;

  char *cmp_filepath = g_strdup_printf("%s/New", (char *) g_get_home_dir()) ;
  if ( g_strcmp0(filepath,cmp_filepath) == 0) {
    /** File is the start file **/

    free(cmp_filepath) ;
    save_as_file(NULL) ;
    return ;
  }

  free(cmp_filepath) ;


  /** Getting current editor content **/
  GtkTextIter iter_start, iter_end ;
  GError *error=NULL               ;

  gtk_text_buffer_get_start_iter(current_editor.current_buffer,&iter_start);
  gtk_text_buffer_get_end_iter(current_editor.current_buffer,&iter_end);

  gchar *file_content = gtk_text_buffer_get_text(current_editor.current_buffer, &iter_start, &iter_end, FALSE);


  char *back_up_filepath = NULL ;

  if (settings.backup_file) {
    /** backup creation by renaming the ancient (last saved) file (content) by adding an '~' the backup files suffix. **/

    back_up_filepath = g_strdup_printf("%s~",(char *) filepath) ;
    rename(filepath,back_up_filepath) ;

  }

  if ( ! g_file_set_contents(filepath, file_content, -1, &error) ) {
    /** Failed to save editor content as file, display an error message and return. **/


    rename(back_up_filepath, filepath) ; /** We must reset the renaming because else we lost the correct filename in this error case. **/
    free(back_up_filepath) ;

    char *msg = g_strdup_printf(_("Failed to save file:\n%s"), (char *) filepath) ;

    display_message_dialog(_("Cannot save file !!!"), msg, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE) ;

    free(msg) ;

    return ;
  }

  free(back_up_filepath) ;


  /** Update the notebook label tab **/
  GtkWidget *notebook_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui->editor_notebook), current_editor.current_notebook_page);

  /** The tab contains an mimetype icon, the filename and the page closing button. **/
  GList *tab_compound_list = gtk_container_get_children(GTK_CONTAINER(notebook_tab)) ;

  tab_compound_list = g_list_first(tab_compound_list) ;

  while (tab_compound_list->data != NULL) {
      /** We iterate over the notebook tab component to find the filename label.**/

      if  (g_object_get_data(G_OBJECT(tab_compound_list->data), "tab_filename_widget")) {
        /** We reset the filename without the asterix ('*'). **/
        gtk_label_set_text(GTK_LABEL(tab_compound_list->data), g_path_get_basename(filepath)) ;
        break ;
      }

      tab_compound_list = tab_compound_list->next ;
  }


  /** We mark the TextBuffer as not modified since last saving operation. **/
  gtk_text_buffer_set_modified(current_editor.current_buffer, FALSE) ;


  /** setting the base filename in the bottom bar. **/
  gtk_label_set_text(GTK_LABEL(gui->bottom_bar->filename_label), g_path_get_basename(filepath)) ;
 
  File_Editor *file_editor = (File_Editor *) g_object_get_data(G_OBJECT(current_editor.current_textview), "file_editor") ;
 
  gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(gui->editor_notebook), file_editor->scrolled_window, g_path_get_basename(filepath) ) ;
 
  g_free(file_content) ;


  if (settings.rm_trailing_spaces) {
    /** Deleting trailing spaces. **/
    char *trailing_spaces_deleting ;
//.........这里部分代码省略.........
开发者ID:mrcyberfighter,项目名称:it-edit-2.91,代码行数:101,代码来源:files_callbacks.c

示例2: showMainWindow

void showMainWindow(int argc, char** argv) {
    fprintf(stderr, "DEBUG: Running main window\n");
    gtk_init(&argc, &argv);

    GtkWindow *window;


    // Main window 
    window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 460, 450);
    gtk_container_set_border_width(GTK_CONTAINER(window), 8);
    gtk_window_set_title(GTK_WINDOW(window), _("Keyboard configuration tool"));

    /* TODO Set application icon
     GtkImage *app_icon = GTK_IMAGE(gtk_image_new_from_icon_name("keyboard", GTK_ICON_SIZE_SMALL_TOOLBAR));
     gtk_window_set_icon( window, gtk_image_get_pixbuf(app_icon));
     */
    g_signal_connect(window, "destroy",
            G_CALLBACK(gtk_main_quit), NULL);

    GtkWidget *vbox = gtk_vbox_new(FALSE, 10);

    gtk_container_add(GTK_CONTAINER(window), vbox);

    GtkWidget *tabs = gtk_notebook_new();

    gtk_container_add(GTK_CONTAINER(vbox), tabs);

    /*
     * Adding tabs to the notebook
     */

    Distribution_Tab *tab_distributions = build_tab_distribution();
    Others_Tab *tab_others = build_tab_others();
    About_Tab *tab_credits = build_tab_credits();

    gtk_notebook_append_page(GTK_NOTEBOOK(tabs), tab_distributions->tab_content, tab_distributions->tab_name);
    gtk_notebook_append_page(GTK_NOTEBOOK(tabs), tab_others->tab_content, tab_others->tab_name);
    gtk_notebook_append_page(GTK_NOTEBOOK(tabs), tab_credits->tab_content, tab_credits->tab_name);
    /*
     * Adding Control Buttons
     */

    GtkWidget *control_box = gtk_hbox_new(FALSE, 4);
    gtk_container_add(GTK_CONTAINER(vbox), control_box);

    GtkWidget *span, *button_cancel, *button_accept, * button_aplic;

    span = gtk_label_new("");



    gtk_widget_set_size_request(span, 45, 0);

    button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
    gtk_widget_set_size_request(button_cancel, BUTTON_WIDTH, BUTTON_HIGH);

    button_accept = gtk_button_new_from_stock(GTK_STOCK_OK);
    gtk_widget_set_size_request(button_accept, BUTTON_WIDTH, BUTTON_HIGH);

    button_aplic = gtk_button_new_from_stock(GTK_STOCK_APPLY);
    gtk_widget_set_size_request(button_aplic, BUTTON_WIDTH, BUTTON_HIGH);

    gtk_container_add(GTK_CONTAINER(control_box), span);

    gtk_container_add(GTK_CONTAINER(control_box), button_accept);
    gtk_container_add(GTK_CONTAINER(control_box), button_aplic);
    gtk_container_add(GTK_CONTAINER(control_box), button_cancel);


    g_signal_connect(button_accept, "clicked",
            G_CALLBACK(button_acept_callback), NULL);

    g_signal_connect(button_aplic, "clicked",
            G_CALLBACK(button_aplic_callback), NULL);

    g_signal_connect(button_cancel, "clicked",
            G_CALLBACK(button_cancel_callback), NULL);

    gtk_widget_show_all(GTK_WIDGET(window));
    gtk_main();
}
开发者ID:tforsman,项目名称:lxkb_config,代码行数:83,代码来源:gtk+2.x.c

示例3: gtk_notebook_next_page

void wxMDIParentFrame::ActivateNext()
{
    if (m_clientWindow)
        gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:5,代码来源:mdi.cpp

示例4: _camera_import_dialog_new

static void _camera_import_dialog_new(_camera_import_dialog_t *data)
{
  data->dialog = gtk_dialog_new_with_buttons(_("import images from camera"), NULL, GTK_DIALOG_MODAL,
                                             _("cancel"), GTK_RESPONSE_NONE, C_("camera import", "import"),
                                             GTK_RESPONSE_ACCEPT, NULL);
  gtk_window_set_default_size(GTK_WINDOW(data->dialog), 100, 600);
  GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(data->dialog));

  // List - setup store
  data->store = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);

  // IMPORT PAGE
  data->import.page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
  gtk_container_set_border_width(GTK_CONTAINER(data->import.page), 5);

  // Top info
  data->import.info = gtk_label_new(_("please wait while prefetching thumbnails of images from camera..."));
  gtk_label_set_single_line_mode(GTK_LABEL(data->import.info), FALSE);
  gtk_widget_set_halign(data->import.info, GTK_ALIGN_START);
  gtk_box_pack_start(GTK_BOX(data->import.page), data->import.info, FALSE, FALSE, 0);

  // jobcode
  data->import.jobname
      = _camera_import_gconf_widget(data, _("jobcode"), "plugins/capture/camera/import/jobcode");
  gtk_box_pack_start(GTK_BOX(data->import.page), GTK_WIDGET(data->import.jobname->widget), FALSE, FALSE, 0);


  // Create the treview with list model data store
  data->import.treeview = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(data->import.treeview), GTK_POLICY_NEVER,
                                 GTK_POLICY_ALWAYS);

  gtk_container_add(GTK_CONTAINER(data->import.treeview), gtk_tree_view_new());
  GtkTreeView *treeview = GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(data->import.treeview)));

  GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
  GtkTreeViewColumn *column
      = gtk_tree_view_column_new_with_attributes(_("thumbnail"), renderer, "pixbuf", 0, (char *)NULL);
  gtk_tree_view_append_column(treeview, column);

  renderer = gtk_cell_renderer_text_new();
  column = gtk_tree_view_column_new_with_attributes(_("storage file"), renderer, "text", 1, (char *)NULL);
  gtk_tree_view_append_column(treeview, column);
  gtk_tree_view_column_set_expand(column, TRUE);


  GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);

  gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(data->store));
  gtk_tree_view_set_headers_visible(treeview, FALSE);

  gtk_box_pack_start(GTK_BOX(data->import.page), data->import.treeview, TRUE, TRUE, 0);


  // SETTINGS PAGE
  data->settings.page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
  gtk_container_set_border_width(GTK_CONTAINER(data->settings.page), 5);

  // general settings
  gtk_box_pack_start(GTK_BOX(data->settings.page), gtk_label_new(_("general")), FALSE, FALSE, 0);

  // ignoring of jpegs. hack while we don't handle raw+jpeg in the same directories.
  data->settings.general.ignore_jpeg = gtk_check_button_new_with_label(_("ignore JPEG files"));
  g_object_set(data->settings.general.ignore_jpeg, "tooltip-text",
               _("do not load files with an extension of .jpg or .jpeg. this can be useful when there are "
                 "raw+JPEG in a directory."),
               NULL);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->settings.general.ignore_jpeg),
                               dt_conf_get_bool("ui_last/import_ignore_jpegs"));
  gtk_box_pack_start(GTK_BOX(data->settings.page), data->settings.general.ignore_jpeg, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(data->settings.general.ignore_jpeg), "clicked",
                   G_CALLBACK(_check_button_callback), data);

  GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
  data->settings.general.date_override = gtk_check_button_new_with_label(_("override today's date"));
  gtk_box_pack_start(GTK_BOX(hbox), data->settings.general.date_override, FALSE, FALSE, 0);
  g_object_set(data->settings.general.date_override, "tooltip-text",
               _("check this, if you want to override the timestamp used when expanding variables:\n$(YEAR), "
                 "$(MONTH), $(DAY),\n$(HOUR), $(MINUTE), $(SECONDS)"),
               (char *)NULL);

  data->settings.general.date_entry = gtk_entry_new();
  gtk_widget_set_sensitive(data->settings.general.date_entry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
                                                                  data->settings.general.date_override)));
  gtk_box_pack_start(GTK_BOX(hbox), data->settings.general.date_entry, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->settings.general.date_override), "clicked",
                   G_CALLBACK(_check_button_callback), data);

  gtk_box_pack_start(GTK_BOX(data->settings.page), hbox, FALSE, FALSE, 0);


  // THE NOTEBOOK
  data->notebook = gtk_notebook_new();
  gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook), data->import.page, gtk_label_new(_("images")));
  gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook), data->settings.page, gtk_label_new(_("settings")));

  // end
  gtk_box_pack_start(GTK_BOX(content), data->notebook, TRUE, TRUE, 0);
//.........这里部分代码省略.........
开发者ID:SenorNaddy,项目名称:darktable,代码行数:101,代码来源:camera_import_dialog.c

示例5: library_window_constructor

static GObject *
library_window_constructor (GType type,
			    guint n_construct_properties,
			    GObjectConstructParam * construct_params)
{
  GObject *object;
  GhidLibraryWindow *library_window;

  GtkWidget *hpaned, *notebook;
  GtkWidget *libview;
  GtkWidget *preview;
  GtkWidget *alignment, *frame;

  /* chain up to constructor of parent class */
  object = G_OBJECT_CLASS (library_window_parent_class)->
    constructor (type, n_construct_properties, construct_params);
  library_window = GHID_LIBRARY_WINDOW (object);

  /* dialog initialization */
  g_object_set (object,
		/* GtkWindow */
		"type", GTK_WINDOW_TOPLEVEL,
		"title", _("Select Footprint..."),
		"default-height", 300,
		"default-width", 400,
		"modal", FALSE, "window-position", GTK_WIN_POS_NONE,
		/* GtkDialog */
		"has-separator", TRUE, NULL);
  g_object_set (GTK_DIALOG (library_window)->vbox,
		"homogeneous", FALSE, NULL);

  /* horizontal pane containing selection and preview */
  hpaned = GTK_WIDGET (g_object_new (GTK_TYPE_HPANED,
				     /* GtkContainer */
				     "border-width", 5, NULL));
  library_window->hpaned = hpaned;

  /* notebook for library views */
  notebook = GTK_WIDGET (g_object_new (GTK_TYPE_NOTEBOOK,
				       "show-tabs", FALSE, NULL));
  library_window->viewtabs = GTK_NOTEBOOK (notebook);

  libview = create_lib_treeview (library_window);
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), libview,
			    gtk_label_new (_("Libraries")));

  /* include the vertical box in horizontal box */
  gtk_paned_pack1 (GTK_PANED (hpaned), notebook, TRUE, FALSE);


  /* -- preview area -- */
  frame = GTK_WIDGET (g_object_new (GTK_TYPE_FRAME,
				    /* GtkFrame */
				    "label", _("Preview"), NULL));
  alignment = GTK_WIDGET (g_object_new (GTK_TYPE_ALIGNMENT,
					/* GtkAlignment */
					"left-padding", 5,
					"right-padding", 5,
					"top-padding", 5,
					"bottom-padding", 5,
					"xscale", 1.0,
					"yscale", 1.0,
					"xalign", 0.5, "yalign", 0.5, NULL));
  preview = (GtkWidget *)g_object_new (GHID_TYPE_PINOUT_PREVIEW,
			  /* GhidPinoutPreview */
			  "element-data", NULL,
			  /* GtkWidget */
			  "width-request", 150, "height-request", 150, NULL);
  gtk_container_add (GTK_CONTAINER (alignment), preview);
  gtk_container_add (GTK_CONTAINER (frame), alignment);
  /* set preview of library_window */
  library_window->preview = preview;

  gtk_paned_pack2 (GTK_PANED (hpaned), frame, FALSE, FALSE);

  /* add the hpaned to the dialog vbox */
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (library_window)->vbox), hpaned,
		      TRUE, TRUE, 0);
  gtk_widget_show_all (hpaned);


  /* now add buttons in the action area */
  gtk_dialog_add_buttons (GTK_DIALOG (library_window),
			  /*  - close button */
			  GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);

  return object;
}
开发者ID:thequux,项目名称:pcb,代码行数:88,代码来源:gui-library-window.c

示例6: wxCHECK_MSG

int wxNotebook::GetSelection() const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );

    return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) );
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:6,代码来源:notebook.cpp

示例7: xkb_layout_choose

void
xkb_layout_choose (GtkBuilder * dialog)
{
	GtkBuilder *chooser_dialog;

	chooser_dialog = gtk_builder_new ();
	gtk_builder_add_from_file (chooser_dialog, MATECC_UI_DIR
				   "/mate-keyboard-properties-layout-chooser.ui",
				   NULL);
	GtkWidget *chooser = CWID ("xkb_layout_chooser");
	GtkWidget *lang_chooser = CWID ("xkb_languages_available");
	GtkWidget *notebook = CWID ("choosers_nb");
	GtkWidget *kbdraw = NULL;
	GtkWidget *toplevel = NULL;

	gtk_window_set_transient_for (GTK_WINDOW (chooser),
				      GTK_WINDOW (WID
						  ("keyboard_dialog")));

	xkb_layout_chooser_available_layouts_fill (chooser_dialog,
						   "xkb_countries_available",
						   "xkb_country_variants_available",
						   xkl_config_registry_foreach_country,
						   (ConfigItemProcessFunc)
						   xkb_layout_chooser_add_country_to_available_countries,
						   G_CALLBACK
						   (xkb_layout_chooser_available_country_changed));
	xkb_layout_chooser_available_layouts_fill (chooser_dialog,
						   "xkb_languages_available",
						   "xkb_language_variants_available",
						   xkl_config_registry_foreach_language,
						   (ConfigItemProcessFunc)
						   xkb_layout_chooser_add_language_to_available_languages,
						   G_CALLBACK
						   (xkb_layout_chooser_available_language_changed));

	g_signal_connect_after (G_OBJECT (notebook), "switch_page",
				G_CALLBACK
				(xkb_layout_chooser_page_changed),
				chooser_dialog);

	gtk_combo_box_set_active (GTK_COMBO_BOX
				  (CWID ("xkb_countries_available")),
				  FALSE);

	if (gtk_tree_model_iter_n_children
	    (gtk_combo_box_get_model (GTK_COMBO_BOX (lang_chooser)),
	     NULL)) {
		gtk_combo_box_set_active (GTK_COMBO_BOX
					  (CWID
					   ("xkb_languages_available")),
					  FALSE);
	} else {
		/* If language info is not available - remove the corresponding tab,
		   pretend there is no notebook at all */
		gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1);
		gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook),
					    FALSE);
		gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook),
					      FALSE);
	}

#ifdef HAVE_X11_EXTENSIONS_XKB_H
	if (!strcmp (xkl_engine_get_backend_name (engine), "XKB")) {
		kbdraw = xkb_layout_preview_create_widget (chooser_dialog);
		g_object_set_data (G_OBJECT (chooser), "kbdraw", kbdraw);
		gtk_container_add (GTK_CONTAINER
				   (CWID ("previewFrame")), kbdraw);
		gtk_widget_show_all (kbdraw);
		gtk_button_box_set_child_secondary (GTK_BUTTON_BOX
						    (CWID
						     ("hbtnBox")),
						    CWID
						    ("btnPrint"), TRUE);
	} else
#endif
	{
		gtk_widget_hide_all (CWID ("vboxPreview"));
		gtk_widget_hide (CWID ("btnPrint"));
	}

	g_signal_connect (G_OBJECT (chooser),
			  "response",
			  G_CALLBACK (xkb_layout_chooser_response),
			  chooser_dialog);

	toplevel = gtk_widget_get_toplevel (chooser);
	if (gtk_widget_is_toplevel (toplevel)) {
		GdkRectangle *rect = matekbd_preview_load_position ();
		if (rect != NULL) {
			gtk_window_move (GTK_WINDOW (toplevel),
					 rect->x, rect->y);
			gtk_window_resize (GTK_WINDOW (toplevel),
					   rect->width, rect->height);
			g_free (rect);
		}
	}

	xkb_layout_preview_update (chooser_dialog);
	gtk_dialog_run (GTK_DIALOG (chooser));
//.........这里部分代码省略.........
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:101,代码来源:mate-keyboard-properties-xkbltadd.c

示例8: gucharmap_charmap_init

static void
gucharmap_charmap_init (GucharmapCharmap *charmap)
{
  GucharmapCharmapPrivate *priv;
  GtkWidget *scrolled_window, *view, *chartable, *textview;
  GtkTreeSelection *selection;
  GtkTextBuffer *buffer;
  int page;

  priv = charmap->priv = G_TYPE_INSTANCE_GET_PRIVATE (charmap, GUCHARMAP_TYPE_CHARMAP, GucharmapCharmapPrivate);

  /* FIXME: move this to realize */
  priv->hand_cursor = gdk_cursor_new (GDK_HAND2);
  priv->regular_cursor = gdk_cursor_new (GDK_XTERM);
  priv->hovering_over_link = FALSE;

  /* Left pane */
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
                                       GTK_SHADOW_ETCHED_IN);

  view = gucharmap_chapters_view_new ();
  priv->chapters_view = GUCHARMAP_CHAPTERS_VIEW (view);
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
  g_signal_connect (selection, "changed",
                    G_CALLBACK (chapters_view_selection_changed_cb), charmap);

  gtk_container_add (GTK_CONTAINER (scrolled_window), view);
  gtk_widget_show (view);
  gtk_paned_pack1 (GTK_PANED (charmap), scrolled_window, FALSE, FALSE);
  gtk_widget_show (scrolled_window);

  /* Right pane */
  priv->notebook = gtk_notebook_new ();

  /* Chartable page */
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
                                       GTK_SHADOW_NONE);
#if GTK_CHECK_VERSION (3, 15, 9)
  gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scrolled_window),
                                             FALSE);
#endif

  chartable = gucharmap_chartable_new ();
  priv->chartable = GUCHARMAP_CHARTABLE (chartable);

  g_signal_connect_swapped (chartable, "status-message",
                            G_CALLBACK (chartable_status_message), charmap);
  g_signal_connect (chartable, "notify::active-character",
                    G_CALLBACK (chartable_sync_active_char), charmap);
  g_signal_connect (chartable, "notify::font-desc",
                    G_CALLBACK (chartable_sync_font_desc), charmap);
  g_signal_connect (chartable, "notify::codepoint-list",
                    G_CALLBACK (chartable_notify_cb), charmap);
  g_signal_connect (chartable, "notify::snap-pow2",
                    G_CALLBACK (chartable_notify_cb), charmap);

  gtk_container_add (GTK_CONTAINER (scrolled_window), chartable);
  gtk_widget_show (chartable);

  page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
                                   scrolled_window,
                                   gtk_label_new_with_mnemonic (_("Characte_r Table")));
  g_assert (page == GUCHARMAP_CHARMAP_PAGE_CHARTABLE);
  gtk_widget_show (scrolled_window);

  /* Details page */
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), 
                                       GTK_SHADOW_NONE);

  textview = gtk_text_view_new ();
  priv->details_view = GTK_TEXT_VIEW (textview);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview),
                               GTK_WRAP_WORD);

  g_signal_connect (textview, "style-set",
                    G_CALLBACK (details_style_set), charmap);
  g_signal_connect (textview, "key-press-event",
                    G_CALLBACK (details_key_press_event), charmap);
  g_signal_connect (textview, "event-after",
                    G_CALLBACK (details_event_after), charmap);
  g_signal_connect (textview, "motion-notify-event",
                    G_CALLBACK (details_motion_notify_event), charmap);
  g_signal_connect (textview, "visibility-notify-event",
                    G_CALLBACK (details_visibility_notify_event), charmap);

  buffer = gtk_text_view_get_buffer (priv->details_view);
  priv->text_tag_gimongous =
    gtk_text_buffer_create_tag (buffer, "gimongous",
                                NULL);
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:gucharmap,代码行数:101,代码来源:gucharmap-charmap.c

示例9: FloatingWindow

WindowMerge::WindowMerge(GtkWidget * parent_layout, GtkAccelGroup *accelerator_group, bool startup):
  FloatingWindow(parent_layout, widMerge, _("Merge"), startup)
// Window for merging changes.  
{
  // Save and initialize variables.
  load_gui_event_id = 0;
  editors_changed_event_id = 0;

  // Build GUI.
  notebook1 = gtk_notebook_new();
  gtk_widget_show(notebook1);
  gtk_container_add(GTK_CONTAINER(vbox_client), notebook1);
  gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook1), FALSE);

  // Build merge GUI.
  vbox1 = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(vbox1);
  gtk_container_add(GTK_CONTAINER(notebook1), vbox1);

  label6 = gtk_label_new_with_mnemonic(_("M_aster project"));
  gtk_widget_show(label6);
  gtk_box_pack_start(GTK_BOX(vbox1), label6, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);

  combobox_master = gtk_combo_box_new_text();
  gtk_widget_show(combobox_master);
  gtk_box_pack_start(GTK_BOX(vbox1), combobox_master, FALSE, FALSE, 0);

  connect_focus_signals (combobox_master);
  
  label7 = gtk_label_new_with_mnemonic(_("E_dited project"));
  gtk_widget_show(label7);
  gtk_box_pack_start(GTK_BOX(vbox1), label7, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label7), 0, 0.5);

  combobox_edited = gtk_combo_box_new_text();
  gtk_widget_show(combobox_edited);
  gtk_box_pack_start(GTK_BOX(vbox1), combobox_edited, FALSE, FALSE, 0);

  connect_focus_signals (combobox_edited);

  label_info = gtk_label_new("");
  gtk_widget_show(label_info);
  gtk_box_pack_start(GTK_BOX(vbox1), label_info, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label_info), 0, 0.5);

  display_changes_gui = new DisplayChangesGui (vbox1);

  connect_focus_signals (display_changes_gui->textview);

  hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox1);
  gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);

  button_previous = gtk_button_new();
  gtk_widget_show(button_previous);
  gtk_box_pack_start(GTK_BOX(hbox1), button_previous, FALSE, FALSE, 0);

  connect_focus_signals (button_previous);
  
  alignment2 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment2);
  gtk_container_add(GTK_CONTAINER(button_previous), alignment2);

  hbox2 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox2);
  gtk_container_add(GTK_CONTAINER(alignment2), hbox2);

  image6 = gtk_image_new_from_stock("gtk-go-back", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image6);
  gtk_box_pack_start(GTK_BOX(hbox2), image6, FALSE, FALSE, 0);

  label9 = gtk_label_new_with_mnemonic(_("_Previous"));
  gtk_widget_show(label9);
  gtk_box_pack_start(GTK_BOX(hbox2), label9, FALSE, FALSE, 0);

  button_merge = gtk_button_new();
  gtk_widget_show(button_merge);
  gtk_box_pack_start(GTK_BOX(hbox1), button_merge, TRUE, TRUE, 0);

  connect_focus_signals (button_merge);
  
  alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment1);
  gtk_container_add(GTK_CONTAINER(button_merge), alignment1);

  hbox4 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox4);
  gtk_container_add(GTK_CONTAINER(alignment1), hbox4);

  image5 = gtk_image_new_from_stock("gtk-refresh", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image5);
  gtk_box_pack_start(GTK_BOX(hbox4), image5, FALSE, FALSE, 0);

  label8 = gtk_label_new_with_mnemonic(_("_Merge"));
  gtk_widget_show(label8);
  gtk_box_pack_start(GTK_BOX(hbox4), label8, FALSE, FALSE, 0);

  button_next = gtk_button_new();
  gtk_widget_show(button_next);
//.........这里部分代码省略.........
开发者ID:alerque,项目名称:bibledit,代码行数:101,代码来源:windowmerge.cpp

示例10: show_about

void show_about()
{
	GtkWidget *window;
	GtkWidget *image;
	GdkPixbuf *pixbuf;
	GtkWidget *vbox;
	GtkWidget *notebook;
	GtkWidget *scroll;
	GtkWidget *textview;
	GtkWidget *tablabel;
	GtkWidget *action_area;
	GtkWidget *button;

	hand_cursor = gdk_cursor_new (GDK_HAND2);
	regular_cursor = gdk_cursor_new (GDK_XTERM);
      

	pixbuf = gdk_pixbuf_new_from_file_at_size(SKIN_DIR"fetion.svg", 40, 40, NULL);
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
	gtk_window_set_icon(GTK_WINDOW(window), pixbuf);
	g_object_unref(pixbuf);
	gtk_window_set_title(GTK_WINDOW(window), _("About OpenFetion"));
	gtk_widget_set_usize(window, 500, 400);

	vbox = gtk_vbox_new(FALSE, 5);
	pixbuf = gdk_pixbuf_new_from_file_at_size(SKIN_DIR"fetion.svg", 98, 98, NULL);
	image = gtk_image_new_from_pixbuf(pixbuf);
	g_object_unref(pixbuf);
	gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0);

	notebook = gtk_notebook_new();
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_LEFT);
	gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 5);

	tablabel = gtk_label_new(_("Introduction"));
	scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
								 GTK_POLICY_NEVER,
								 GTK_POLICY_AUTOMATIC);
	textview = gtk_text_view_new();
	create_intro(GTK_TEXT_VIEW(textview));
	gtk_container_add(GTK_CONTAINER(scroll), textview);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
			scroll, tablabel);

	tablabel = gtk_label_new(_("About the author"));
	scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
								 GTK_POLICY_NEVER,
								 GTK_POLICY_AUTOMATIC);
	textview = gtk_text_view_new();
	create_author(GTK_TEXT_VIEW(textview));
	gtk_container_add(GTK_CONTAINER(scroll), textview);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
			scroll, tablabel);

	tablabel = gtk_label_new(_("Contributor"));
	scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
								 GTK_POLICY_NEVER,
								 GTK_POLICY_AUTOMATIC);
	textview = gtk_text_view_new();
	create_contri(GTK_TEXT_VIEW(textview));
	gtk_container_add(GTK_CONTAINER(scroll), textview);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
			scroll, tablabel);
	
	tablabel = gtk_label_new(_("License"));
	scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
								 GTK_POLICY_AUTOMATIC,
								 GTK_POLICY_AUTOMATIC);
	textview = gtk_text_view_new();
	create_gpl(GTK_TEXT_VIEW(textview));
	gtk_container_add(GTK_CONTAINER(scroll), textview);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
			scroll, tablabel);

	action_area = gtk_hbox_new(FALSE, 10);
	gtk_box_pack_start(GTK_BOX(vbox), action_area, FALSE, FALSE, 5);
	button = gtk_button_new_with_label(_("Close"));
	gtk_widget_set_usize(button, 90, 0);
	gtk_box_pack_end(GTK_BOX(action_area), button, FALSE, FALSE, 5);
	g_signal_connect(button, "clicked", G_CALLBACK(close_about), window);

	gtk_container_add(GTK_CONTAINER(window), vbox);
	gtk_widget_show_all(window);
}
开发者ID:amoblin,项目名称:flyshion,代码行数:89,代码来源:fx_about.c

示例11: GTK_NOTEBOOK

void wxMDIParentFrame::OnInternalIdle()
{
    /* if a MDI child window has just been inserted
       it has to be brought to the top in idle time. we
       simply set the last notebook page active as new
       pages can only be appended at the end */

    if (m_justInserted)
    {
        GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
        gtk_notebook_set_current_page( notebook, g_list_length( notebook->children ) - 1 );

        /* need to set the menubar of the child */
        wxMDIChildFrame *active_child_frame = GetActiveChild();
        if (active_child_frame != NULL)
        {
            wxMenuBar *menu_bar = active_child_frame->m_menuBar;
            if (menu_bar)
            {
                menu_bar->Attach(active_child_frame);
            }
        }
        m_justInserted = false;
        return;
    }

    wxFrame::OnInternalIdle();

    wxMDIChildFrame *active_child_frame = GetActiveChild();
    bool visible_child_menu = false;

    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
    while (node)
    {
        wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );

        if ( child_frame )
        {
            wxMenuBar *menu_bar = child_frame->m_menuBar;
            if ( menu_bar )
            {
                if (child_frame == active_child_frame)
                {
                    if (menu_bar->Show(true))
                    {
                        // Attach() asserts if we call it for an already
                        // attached menu bar so don't do it if we're already
                        // associated with this frame (it would be nice to get
                        // rid of this check and ensure that this doesn't
                        // happen...)
                        if ( menu_bar->GetFrame() != child_frame )
                            menu_bar->Attach( child_frame );
                    }
                    visible_child_menu = true;
                }
                else
                {
                    if (menu_bar->Show(false))
                    {
                        menu_bar->Detach();
                    }
                }
            }
        }

        node = node->GetNext();
    }

    /* show/hide parent menu bar as required */
    if ((m_frameMenuBar) &&
        (m_frameMenuBar->IsShown() == visible_child_menu))
    {
        if (visible_child_menu)
        {
            m_frameMenuBar->Show( false );
            m_frameMenuBar->Detach();
        }
        else
        {
            m_frameMenuBar->Show( true );
            m_frameMenuBar->Attach( this );
        }
    }
}
开发者ID:NullNoname,项目名称:dolphin,代码行数:84,代码来源:mdi.cpp

示例12: save_all_file

void save_all_file(GtkWidget *button, gpointer user_data) {
  /** All files saving callback. **/

  #ifdef DEBUG
    DEBUG_FUNC_MARK
  #endif

  gint number_of_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(gui->editor_notebook)) ;

  int c ;
  for (c=0 ; c < number_of_pages ; c++) {
    /** We iterate over every notebook page. **/

    GtkWidget *notebook_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui->editor_notebook), c) ;
    GtkWidget *notebook_tab  = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui->editor_notebook), notebook_page);

    /** The tab contains an mimetype icon, the filename and the page closing button. **/
    GList *tab_compound_list = gtk_container_get_children(GTK_CONTAINER(notebook_tab)) ;

    tab_compound_list = g_list_first(tab_compound_list) ;

    while (tab_compound_list->data != NULL) {

      if  (g_object_get_data(G_OBJECT(tab_compound_list->data), "tab_filename_widget")) {
        /** We get the filename tab label. **/

        const char *tab_label = gtk_label_get_text(GTK_LABEL(tab_compound_list->data)) ;

        if (tab_label[0] == '*' && g_strcmp0(tab_label,"*New") != 0) {
          /** Check if the file is modified (marked with an'*') and is not the default "New" named file. **/

          GtkWidget     *current_textview        = gtk_bin_get_child(GTK_BIN(notebook_page)) ;
          GtkTextBuffer *current_buffer          = gtk_text_view_get_buffer(GTK_TEXT_VIEW(current_textview)) ;

          gpointer filepath = g_object_get_data(G_OBJECT(current_buffer), "filepath") ;

          if (filepath != NULL) {

            /** Getting current editor content **/
            GtkTextIter iter_start, iter_end ;
            GError *error=NULL               ;

            gtk_text_buffer_get_start_iter(current_buffer, &iter_start);
            gtk_text_buffer_get_end_iter(current_buffer,   &iter_end);

            gchar *file_content = gtk_text_buffer_get_text(current_buffer, &iter_start, &iter_end, FALSE);

            char *back_up_filepath = NULL ;

            if (settings.backup_file) {
              /** backup creation by renaming the ancient (last saved) file (content) by adding an '~' the backup files suffix. **/

              back_up_filepath = g_strdup_printf("%s~", (char *) filepath) ;
              rename(filepath,back_up_filepath) ;

            }

            if ( ! g_file_set_contents(filepath, file_content, -1, &error) ) {
                /** The content saving has failed **/
                rename(back_up_filepath, filepath) ; /** We must reset the renaming because else we lost the correct filename in this error case. **/
  
                char *msg = g_strdup_printf( _("Failed to save file:\n%s"), (gchar *) filepath) ;
  
                display_message_dialog( _("Cannot save file !!!"), msg, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE) ;
  
                free(msg) ;
  
            }

            g_free(file_content)   ;
            g_free(back_up_filepath) ;

            /** setting the base filename in the bottom bar. **/
            gtk_label_set_text(GTK_LABEL(tab_compound_list->data), g_path_get_basename(filepath)) ;

            /** We mark the TextBuffer as not modified since last saving operation. **/
            gtk_text_buffer_set_modified(current_buffer, FALSE) ;

            if (settings.rm_trailing_spaces) {
              /** Deleting trailing spaces. **/

              char *trailing_spaces_deleting ;
              trailing_spaces_deleting = g_strdup_printf("sed -i 's/[[:space:]]$//' '%s'", (char *) filepath) ;
              int ret ;
              if ((ret = system(trailing_spaces_deleting)) == -1) {
                g_warning(_("Removing trailing space failure:\n%s\n"), trailing_spaces_deleting) ;
              }
              free(trailing_spaces_deleting) ;
            }

            #ifdef RELOADING_FUNC
            /** Update Last modification timestamp. **/
            File_Editor *file_editor = (File_Editor *) g_object_get_data(G_OBJECT(current_textview), "file_editor") ;
            g_stat(filepath, &file_editor->file_info) ;
            #endif

          }
        }
        break ;
      }
//.........这里部分代码省略.........
开发者ID:mrcyberfighter,项目名称:it-edit-2.91,代码行数:101,代码来源:files_callbacks.c

示例13: create_dialog

static GtkWidget *
create_dialog (void)
{
  GtkWidget *notebook;
  GtkWidget *hbox;
  GtkWidget *preview_box;

  gimp_ui_init (PLUG_IN_BINARY, TRUE);

  dialog = gimp_dialog_new (_("GIMPressionist"), PLUG_IN_ROLE,
                            NULL, 0,
                            gimp_standard_help_func, PLUG_IN_PROC,

                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                            GTK_STOCK_OK,     GTK_RESPONSE_OK,

                            NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  gimp_window_set_transient (GTK_WINDOW (dialog));

  g_signal_connect (dialog, "response",
                    G_CALLBACK (dialog_response),
                    NULL);
  g_signal_connect (dialog, "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  hbox = gtk_hbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                      hbox, TRUE, TRUE, 0);
  gtk_widget_show (hbox);

  preview_box = create_preview ();
  gtk_box_pack_start (GTK_BOX (hbox), preview_box, FALSE, FALSE, 0);
  gtk_widget_show (preview_box);

  notebook = gtk_notebook_new ();
  gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 5);
  gtk_widget_show (notebook);

  create_presetpage (GTK_NOTEBOOK (notebook));
  create_paperpage (GTK_NOTEBOOK (notebook));
  create_brushpage (GTK_NOTEBOOK (notebook));
  create_orientationpage (GTK_NOTEBOOK (notebook));
  create_sizepage (GTK_NOTEBOOK (notebook));
  create_placementpage (GTK_NOTEBOOK (notebook));
  create_colorpage (GTK_NOTEBOOK (notebook));
  create_generalpage (GTK_NOTEBOOK (notebook));

  updatepreview (NULL, NULL);

  /*
   * This is to make sure the values from the pcvals will be reflected
   * in the GUI here. Otherwise they will be set to the defaults.
   * */
  restore_values ();

  gtk_widget_show (dialog);

  return dialog;
}
开发者ID:WilfR,项目名称:Gimp-Matting,代码行数:67,代码来源:gimpressionist.c

示例14: main

int
main(int argc,
     char **argv)
{
    GtkBuilder *builder;
    GtkWidget *notebook, *xfae_page, *lbl;
    GError *error = NULL;
    XfconfChannel *channel;

    xfce_textdomain(GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");

    if(!gtk_init_with_args (&argc, &argv, "", option_entries,
                            GETTEXT_PACKAGE, &error))
    {
        if(G_LIKELY(error)) {
            g_print("%s: %s.\n", G_LOG_DOMAIN, error->message);
            g_print(_("Type '%s --help' for usage."), G_LOG_DOMAIN);
            g_print("\n");
            g_error_free (error);
        } else
            g_error("Unable to open display.");

        return EXIT_FAILURE;
    }

    if(G_UNLIKELY(opt_version)) {
        g_print("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string ());
        g_print("%s\n", "Copyright (c) 2004-2014");
        g_print("\t%s\n\n", _("The Xfce development team. All rights reserved."));
        g_print(_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
        g_print("\n");

        return EXIT_SUCCESS;
    }

    if(G_UNLIKELY(!xfconf_init(&error))) {
        xfce_dialog_show_error (NULL,
                                error,
                                _("Unable to contact settings server"));
        g_error_free(error);
        return EXIT_FAILURE;
    }

    gtk_window_set_default_icon_name("xfce4-session");

    /* hook to make sure the libxfce4ui library is linked */
    if (xfce_titled_dialog_get_type() == 0)
        return EXIT_FAILURE;

    builder = gtk_builder_new();
    gtk_builder_add_from_string(builder,
                                xfce4_session_settings_ui,
                                xfce4_session_settings_ui_length,
                                &error);

    if(!builder) {
        xfce_dialog_show_error(NULL, error,
                               _("Unable to create user interface from embedded definition data"));
        g_error_free (error);
        return EXIT_FAILURE;
    }

    splash_settings_init(builder);
    session_editor_init(builder);

    /* FIXME: someday, glade-ify this, maybe. */
    xfae_page = xfae_window_new();
    gtk_widget_show(xfae_page);
    notebook = GTK_WIDGET(gtk_builder_get_object(builder, "plug-child"));
    lbl = gtk_label_new_with_mnemonic(_("App_lication Autostart"));
    gtk_widget_show(lbl);
    gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), xfae_page, lbl, 2);

    channel = xfconf_channel_get(SETTINGS_CHANNEL);

    /* bind widgets to xfconf */
    xfconf_g_property_bind(channel, "/chooser/AlwaysDisplay", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_display_chooser"),
                           "active");
    xfconf_g_property_bind(channel, "/general/AutoSave", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_session_autosave"),
                           "active");
    xfconf_g_property_bind(channel, "/general/PromptOnLogout", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_logout_prompt"),
                           "active");
    xfconf_g_property_bind(channel, "/compat/LaunchGNOME", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_compat_gnome"),
                           "active");
    xfconf_g_property_bind(channel, "/compat/LaunchKDE", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_compat_kde"),
                           "active");
    xfconf_g_property_bind(channel, "/security/EnableTcp", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_enable_tcp"),
                           "active");
    xfconf_g_property_bind(channel, "/shutdown/LockScreen", G_TYPE_BOOLEAN,
                           gtk_builder_get_object(builder, "chk_lock_screen"),
                           "active");

    if(G_UNLIKELY(opt_socket_id == 0)) {
        GtkWidget *dialog = GTK_WIDGET(gtk_builder_get_object(builder, "xfce4_session_settings_dialog"));
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:xfce4-session,代码行数:101,代码来源:main.c

示例15: show_properties_dialog

/**
 * show_properties_dialog
 *
 * Description:
 * displays the properties dialog
 **/
void
show_properties_dialog (void)
{
  GtkWidget *notebook;
  GtkWidget *cpage;
  GtkWidget *gpage;
  GtkWidget *kpage;
  GtkWidget *label;
  GtkWidget *hbox;
  GtkWidget *vbox;
  GtkWidget *typemenu;
  GtkWidget *pmapmenu;
  GtkWidget *chkbox;
  GtkWidget *safe_chkbox;
  GtkWidget *grid;
  GtkWidget *dbut;
  GtkWidget *w;
  GtkWidget *controls_list;

  if (propbox)
    return;

  propbox = gtk_dialog_new_with_buttons (_("Preferences"),
					 GTK_WINDOW (window),
					 GTK_DIALOG_USE_HEADER_BAR,
					 NULL);
  gtk_container_set_border_width (GTK_CONTAINER (propbox), 5);
  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (propbox))), 2);
  /* Set up notebook and add it to hbox of the gtk_dialog */
  g_signal_connect (G_OBJECT (propbox), "destroy",
		    G_CALLBACK (gtk_widget_destroyed), &propbox);

  notebook = gtk_notebook_new ();
  gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (propbox))),
              notebook, TRUE, TRUE, 0);

  /* The configuration page */
  cpage = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
  gtk_container_set_border_width (GTK_CONTAINER (cpage), 12);

  grid = gtk_grid_new ();
  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
  gtk_box_pack_start (GTK_BOX (cpage), grid, FALSE, FALSE, 0);

  label = gtk_label_new (_("Game Type"));
  gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);

  typemenu = gtk_combo_box_text_new ();
  fill_typemenu (typemenu);
  gtk_grid_attach (GTK_GRID (grid), typemenu, 1, 0, 1, 1);

  g_signal_connect (G_OBJECT (typemenu), "changed",
		    G_CALLBACK (type_selection), NULL);

  chkbox = gtk_check_button_new_with_mnemonic (_("_Use safe moves"));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox),
				properties.safe_moves);
  gtk_grid_attach (GTK_GRID (grid), chkbox, 0, 1, 2, 1);
  gtk_widget_set_tooltip_text (chkbox,
                               _("Prevent accidental moves that result in getting killed."));
  safe_chkbox = chkbox;

  chkbox = gtk_check_button_new_with_mnemonic (_("U_se super safe moves"));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox),
				properties.super_safe_moves);
  g_signal_connect (G_OBJECT (chkbox), "clicked",
		    (GCallback) super_safe_cb, NULL);
  gtk_grid_attach (GTK_GRID (grid), chkbox, 0, 2, 2, 1);
  gtk_widget_set_tooltip_text (chkbox,
                               _("Prevents all moves that result in getting killed."));
  gtk_widget_set_sensitive (chkbox, properties.safe_moves);

  g_signal_connect (G_OBJECT (safe_chkbox), "clicked",
		    (GCallback) safe_cb, (gpointer) chkbox);

  chkbox = gtk_check_button_new_with_mnemonic (_("_Enable sounds"));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbox), properties.sound);
  g_signal_connect (G_OBJECT (chkbox), "clicked",
		    (GCallback) sound_cb, NULL);
  gtk_grid_attach (GTK_GRID (grid), chkbox, 0, 3, 2, 1);
  gtk_widget_set_tooltip_text (chkbox,
                               _("Play sounds for events like winning a level and dying."));

  label = gtk_label_new_with_mnemonic (_("Game"));
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), cpage, label);


  /* The graphics page */
  gpage = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
  gtk_container_set_border_width (GTK_CONTAINER (gpage), 12);

  grid = gtk_grid_new ();
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:gnome-robots,代码行数:101,代码来源:properties.c


注:本文中的GTK_NOTEBOOK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。