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 ;
    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_editor.current_textview), "file_editor") ;
  g_stat(filepath, &file_editor->file_info) ;
  #endif

  return ;

}
Exemple #2
0
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();
}
Exemple #3
0
void wxMDIParentFrame::ActivateNext()
{
    if (m_clientWindow)
        gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
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);
  // gtk_widget_set_size_request(content, DT_PIXEL_APPLY_DPI(400), DT_PIXEL_APPLY_DPI(400));
}
Exemple #5
0
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;
}
Exemple #6
0
int wxNotebook::GetSelection() const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );

    return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) );
}
Exemple #7
0
bool wxNotebook::InsertPage( size_t position,
                             wxNotebookPage* win,
                             const wxString& text,
                             bool select,
                             int imageId )
{
    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") );

    wxCHECK_MSG( win->GetParent() == this, false,
               wxT("Can't add a page whose parent is not the notebook!") );

    wxCHECK_MSG( position <= GetPageCount(), false,
                 wxT("invalid page index in wxNotebookPage::InsertPage()") );

    // Hack Alert! (Part II): See above in wxNotebook::AddChildGTK
    // why this has to be done.
    gtk_widget_unparent(win->m_widget);

    if (m_themeEnabled)
        win->SetThemeEnabled(true);

    GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);

    wxGtkNotebookPage* pageData = new wxGtkNotebookPage;

    m_pages.insert(m_pages.begin() + position, win);
    m_pagesData.Insert(position, pageData);

    // set the label image and text
    // this must be done before adding the page, as GetPageText
    // and GetPageImage will otherwise return wrong values in
    // the page-changed event that results from inserting the
    // first page.
    pageData->m_imageIndex = imageId;

    pageData->m_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
#ifndef __WXGTK3__
    gtk_container_set_border_width(GTK_CONTAINER(pageData->m_box), 2);
#endif

    pageData->m_image = NULL;
    if (imageId != -1)
    {
        if (HasImageList())
        {
            const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
            pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
            gtk_box_pack_start(GTK_BOX(pageData->m_box),
                pageData->m_image, false, false, m_padding);
        }
        else
        {
            wxFAIL_MSG("invalid notebook imagelist");
        }
    }

    /* set the label text */
    pageData->m_label = gtk_label_new(wxGTK_CONV(wxStripMenuCodes(text)));
    gtk_box_pack_end(GTK_BOX(pageData->m_box),
        pageData->m_label, false, false, m_padding);

    gtk_widget_show_all(pageData->m_box);
    gtk_notebook_insert_page(notebook, win->m_widget, pageData->m_box, position);

    /* apply current style */
#ifdef __WXGTK3__
    GTKApplyStyle(pageData->m_label, NULL);
#else
    GtkRcStyle *style = GTKCreateWidgetStyle();
    if ( style )
    {
        gtk_widget_modify_style(pageData->m_label, style);
        g_object_unref(style);
    }
#endif

    if (select && GetPageCount() > 1)
    {
        SetSelection( position );
    }

    InvalidateBestSize();
    return true;
}
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));
	gtk_widget_destroy (chooser);
}
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);
  priv->text_tag_big =
    gtk_text_buffer_create_tag (buffer, "big",
                                NULL);
  gtk_text_buffer_create_tag (buffer, "bold",
                              "weight", PANGO_WEIGHT_BOLD,
                              NULL);
  gtk_text_buffer_create_tag (buffer, "detail-value",
                              NULL);

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

  page = gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
                                   scrolled_window,
                                   gtk_label_new_with_mnemonic (_("Character _Details")));
  g_assert (page == GUCHARMAP_CHARMAP_PAGE_DETAILS);
  gtk_widget_show (scrolled_window);

  priv->active_page = 0;
  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
  g_signal_connect (priv->notebook, "switch-page",
                    G_CALLBACK (notebook_switch_page), charmap);

  gtk_paned_pack2 (GTK_PANED (charmap), priv->notebook, TRUE, FALSE);
  gtk_widget_show (priv->notebook);

  gtk_widget_set_hexpand (GTK_WIDGET (charmap), TRUE);
  gtk_widget_set_vexpand (GTK_WIDGET (charmap), TRUE);
}
Exemple #10
0
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);
  gtk_box_pack_start(GTK_BOX(hbox1), button_next, FALSE, FALSE, 0);

  connect_focus_signals (button_next);
  
  alignment3 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment3);
  gtk_container_add(GTK_CONTAINER(button_next), alignment3);

  hbox3 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox3);
  gtk_container_add(GTK_CONTAINER(alignment3), hbox3);

  label10 = gtk_label_new_with_mnemonic(_("_Next"));
  gtk_widget_show(label10);
  gtk_box_pack_start(GTK_BOX(hbox3), label10, FALSE, FALSE, 0);

  image8 = gtk_image_new_from_stock("gtk-go-forward", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image8);
  gtk_box_pack_start(GTK_BOX(hbox3), image8, FALSE, FALSE, 0);

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

  label_approve = gtk_label_new("");
  gtk_widget_show(label_approve);
  gtk_box_pack_start(GTK_BOX(vbox2), label_approve, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label_approve), 0, 0.5);

  scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_show(scrolledwindow2);
  gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindow2, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_IN);

  textview_approval = gtk_text_view_new();
  gtk_widget_show(textview_approval);
  gtk_container_add(GTK_CONTAINER(scrolledwindow2), textview_approval);
  gtk_text_view_set_editable(GTK_TEXT_VIEW(textview_approval), FALSE);
  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview_approval), GTK_WRAP_WORD);
  gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(textview_approval), FALSE);
  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview_approval), FALSE);

  connect_focus_signals (textview_approval);
  
  approve_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview_approval));

  button_ready = gtk_button_new();
  gtk_widget_show(button_ready);
  gtk_box_pack_start(GTK_BOX(vbox2), button_ready, FALSE, FALSE, 0);

  connect_focus_signals (button_ready);
  
  alignment6 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment6);
  gtk_container_add(GTK_CONTAINER(button_ready), alignment6);

  hbox7 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox7);
  gtk_container_add(GTK_CONTAINER(alignment6), hbox7);

  image11 = gtk_image_new_from_stock("gtk-ok", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image11);
  gtk_box_pack_start(GTK_BOX(hbox7), image11, FALSE, FALSE, 0);

  label19 = gtk_label_new_with_mnemonic(_("_Save"));
  gtk_widget_show(label19);
  gtk_box_pack_start(GTK_BOX(hbox7), label19, FALSE, FALSE, 0);

  gtk_label_set_mnemonic_widget(GTK_LABEL(label6), combobox_master);
  gtk_label_set_mnemonic_widget(GTK_LABEL(label7), combobox_edited);

  g_signal_connect((gpointer) combobox_master, "changed", G_CALLBACK(on_combobox_master_changed), gpointer(this));
  g_signal_connect((gpointer) combobox_edited, "changed", G_CALLBACK(on_combobox_edited_changed), gpointer(this));
  g_signal_connect((gpointer) button_previous, "clicked", G_CALLBACK(on_button_previous_clicked), gpointer(this));
  g_signal_connect((gpointer) button_merge, "clicked", G_CALLBACK(on_button_merge_clicked), gpointer(this));
  g_signal_connect((gpointer) button_next, "clicked", G_CALLBACK(on_button_next_clicked), gpointer(this));
  g_signal_connect((gpointer) button_ready, "clicked", G_CALLBACK(on_button_ready_clicked), gpointer(this));

  // Create signalling buttons.
  editors_get_text_button = gtk_button_new();
  new_reference_button = gtk_button_new();
  save_editors_button = gtk_button_new();
  reload_editors_button = gtk_button_new();

  // Set buttons insensitive.
  gtk_widget_set_sensitive(button_previous, false);
  gtk_widget_set_sensitive(button_merge, false);
  gtk_widget_set_sensitive(button_next, false);

  // Main focused widget.
  last_focused_widget = combobox_master;
  gtk_widget_grab_focus (last_focused_widget);
}
Exemple #11
0
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);
}
Exemple #12
0
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 );
        }
    }
}
Exemple #13
0
GtkWidget*
create_BookkeepingMainwindow (void)
{
  GtkWidget *BookkeepingMainwindow;
  GtkWidget *vbox1;
  GtkWidget *menubar1;
  GtkWidget *file1;
  GtkWidget *file1_menu;
  GtkWidget *choosePrinter1;
  GtkWidget *separator2;
  GtkWidget *quit1;
  GtkWidget *bookkeeping;
  GtkWidget *bookkeeping_menu;
  GtkWidget *new1;
  GtkWidget *edit1;
  GtkWidget *trennlinie1;
  GtkWidget *save1;
  GtkWidget *separator3;
  GtkWidget *print1;
  GtkWidget *separator1;
  GtkWidget *delete1;
  GtkWidget *journal1;
  GtkWidget *journal1_menu;
  GtkWidget *journal_monthly1;
  GtkWidget *journal_all1;
  GtkWidget *toolbar1;
  GtkIconSize tmp_toolbar_icon_size;
  GtkWidget *hbox1;
  GtkWidget *lFindNumber;
  GtkWidget *eFindName;
  GtkWidget *lFindDesignation;
  GtkWidget *eFindCity;
  GtkWidget *bSearch;
  GtkWidget *scrolledwindow1;
  GtkWidget *viewport1;
  GtkWidget *tree1;
  GtkWidget *notebook1;
  GtkWidget *vbox2;
  GtkWidget *hbox2;
  GtkWidget *label1;
  GtkWidget *eDate;
  GtkWidget *label2;
  GtkWidget *eShortKey;
  GtkWidget *cbAutomatic;
  GtkWidget *hbox3;
  GtkWidget *label3;
  GtkWidget *eDesignation;
  GtkWidget *hbox25;
  GtkWidget *hbox26;
  GtkWidget *label13;
  GtkWidget *eDocumentNumber1;
  GtkWidget *hbox27;
  GtkWidget *label14;
  GtkWidget *eDocumentNumber2;
  GtkWidget *hbox4;
  GtkWidget *label11;
  GtkWidget *hbox10;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *hbox17;
  GtkWidget *hbox28;
  GtkWidget *eBookAccount1;
  GtkWidget *eInfo1;
  GtkWidget *hbox18;
  GtkWidget *eDebit1;
  GtkWidget *eCredit1;
  GtkWidget *hbox32;
  GtkWidget *hbox33;
  GtkWidget *eBookAccount2;
  GtkWidget *eInfo2;
  GtkWidget *hbox34;
  GtkWidget *eDebit2;
  GtkWidget *eCredit2;
  GtkWidget *hbox35;
  GtkWidget *hbox36;
  GtkWidget *eBookAccount3;
  GtkWidget *eInfo3;
  GtkWidget *hbox37;
  GtkWidget *eDebit3;
  GtkWidget *eCredit3;
  GtkWidget *hseparator1;
  GtkWidget *hbox9;
  GtkWidget *label12;
  GtkWidget *hbox15;
  GtkWidget *hbox16;
  GtkWidget *hbox19;
  GtkWidget *hbox29;
  GtkWidget *eBookAccount5;
  GtkWidget *eInfo5;
  GtkWidget *hbox21;
  GtkWidget *eDebit5;
  GtkWidget *eCredit5;
  GtkWidget *hbox20;
  GtkWidget *hbox30;
  GtkWidget *eBookAccount6;
  GtkWidget *eInfo6;
  GtkWidget *hbox22;
  GtkWidget *eDebit6;
  GtkWidget *eCredit6;
  GtkWidget *hbox23;
  GtkWidget *hbox31;
  GtkWidget *eBookAccount7;
  GtkWidget *eInfo7;
  GtkWidget *hbox24;
  GtkWidget *eDebit7;
  GtkWidget *eCredit7;
  GtkWidget *bCash;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  BookkeepingMainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (BookkeepingMainwindow), _("Bookkeeping"));

  vbox1 = gtk_vbox_new (FALSE, 17);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (BookkeepingMainwindow), vbox1);

  menubar1 = gtk_menu_bar_new ();
  gtk_widget_show (menubar1);
  gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);

  file1 = gtk_menu_item_new_with_mnemonic (_("_File"));
  gtk_widget_show (file1);
  gtk_container_add (GTK_CONTAINER (menubar1), file1);

  file1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu);

  choosePrinter1 = gtk_menu_item_new_with_mnemonic (_("Print S_etup..."));
  gtk_widget_show (choosePrinter1);
  gtk_container_add (GTK_CONTAINER (file1_menu), choosePrinter1);

  separator2 = gtk_separator_menu_item_new ();
  gtk_widget_show (separator2);
  gtk_container_add (GTK_CONTAINER (file1_menu), separator2);
  gtk_widget_set_sensitive (separator2, FALSE);

  quit1 = gtk_image_menu_item_new_from_stock ("gtk-close", accel_group);
  gtk_widget_show (quit1);
  gtk_container_add (GTK_CONTAINER (file1_menu), quit1);

  bookkeeping = gtk_menu_item_new_with_mnemonic (_("Bookkeeping"));
  gtk_widget_show (bookkeeping);
  gtk_container_add (GTK_CONTAINER (menubar1), bookkeeping);

  bookkeeping_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (bookkeeping), bookkeeping_menu);

  new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
  gtk_widget_show (new1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), new1);

  edit1 = gtk_image_menu_item_new_from_stock ("gtk-edit", accel_group);
  gtk_widget_show (edit1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), edit1);

  trennlinie1 = gtk_separator_menu_item_new ();
  gtk_widget_show (trennlinie1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), trennlinie1);
  gtk_widget_set_sensitive (trennlinie1, FALSE);

  save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
  gtk_widget_show (save1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), save1);

  separator3 = gtk_separator_menu_item_new ();
  gtk_widget_show (separator3);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), separator3);
  gtk_widget_set_sensitive (separator3, FALSE);

  print1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group);
  gtk_widget_show (print1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), print1);

  separator1 = gtk_separator_menu_item_new ();
  gtk_widget_show (separator1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), separator1);
  gtk_widget_set_sensitive (separator1, FALSE);

  delete1 = gtk_image_menu_item_new_from_stock ("gtk-clear", accel_group);
  gtk_widget_show (delete1);
  gtk_container_add (GTK_CONTAINER (bookkeeping_menu), delete1);

  journal1 = gtk_menu_item_new_with_mnemonic (_("Journal"));
  gtk_widget_show (journal1);
  gtk_container_add (GTK_CONTAINER (menubar1), journal1);

  journal1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (journal1), journal1_menu);

  journal_monthly1 = gtk_menu_item_new_with_mnemonic (_("Monthly"));
  gtk_widget_show (journal_monthly1);
  gtk_container_add (GTK_CONTAINER (journal1_menu), journal_monthly1);

  journal_all1 = gtk_menu_item_new_with_mnemonic (_("All"));
  gtk_widget_show (journal_all1);
  gtk_container_add (GTK_CONTAINER (journal1_menu), journal_all1);

  toolbar1 = gtk_toolbar_new ();
  gtk_widget_show (toolbar1);
  gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
  tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));

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

  lFindNumber = gtk_label_new (_("Date"));
  gtk_widget_show (lFindNumber);
  gtk_box_pack_start (GTK_BOX (hbox1), lFindNumber, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (lFindNumber), GTK_JUSTIFY_CENTER);

  eFindName = gtk_entry_new ();
  gtk_widget_show (eFindName);
  gtk_box_pack_start (GTK_BOX (hbox1), eFindName, FALSE, FALSE, 0);

  lFindDesignation = gtk_label_new (_("Designation"));
  gtk_widget_show (lFindDesignation);
  gtk_box_pack_start (GTK_BOX (hbox1), lFindDesignation, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (lFindDesignation), GTK_JUSTIFY_CENTER);

  eFindCity = gtk_entry_new ();
  gtk_widget_show (eFindCity);
  gtk_box_pack_start (GTK_BOX (hbox1), eFindCity, FALSE, FALSE, 0);

  bSearch = gtk_button_new_with_mnemonic (_("Search"));
  gtk_widget_show (bSearch);
  gtk_box_pack_start (GTK_BOX (hbox1), bSearch, FALSE, FALSE, 0);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
  GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS);

  viewport1 = gtk_viewport_new (NULL, NULL);
  gtk_widget_show (viewport1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);

  tree1 = gtk_tree_view_new ();
  gtk_widget_show (tree1);
  gtk_container_add (GTK_CONTAINER (viewport1), tree1);
  GTK_WIDGET_UNSET_FLAGS (tree1, GTK_CAN_FOCUS);

  notebook1 = gtk_notebook_new ();
  gtk_widget_show (notebook1);
  gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox2);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox2);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("date"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox2), label1, FALSE, FALSE, 0);

  eDate = gtk_entry_new ();
  gtk_widget_show (eDate);
  gtk_box_pack_start (GTK_BOX (hbox2), eDate, TRUE, TRUE, 0);
  gtk_entry_set_width_chars (GTK_ENTRY (eDate), 10);

  label2 = gtk_label_new (_("short key"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0);

  eShortKey = gtk_entry_new ();
  gtk_widget_show (eShortKey);
  gtk_box_pack_start (GTK_BOX (hbox2), eShortKey, TRUE, TRUE, 0);
  gtk_entry_set_has_frame (GTK_ENTRY (eShortKey), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eShortKey), 6);

  cbAutomatic = gtk_check_button_new_with_mnemonic (_("Automatic"));
  gtk_widget_show (cbAutomatic);
  gtk_box_pack_start (GTK_BOX (hbox2), cbAutomatic, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cbAutomatic), TRUE);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox3, TRUE, TRUE, 0);

  label3 = gtk_label_new (_("Designation"));
  gtk_widget_show (label3);
  gtk_box_pack_start (GTK_BOX (hbox3), label3, FALSE, FALSE, 0);

  eDesignation = gtk_entry_new ();
  gtk_widget_show (eDesignation);
  gtk_box_pack_start (GTK_BOX (hbox3), eDesignation, TRUE, TRUE, 0);

  hbox25 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox25);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox25, TRUE, TRUE, 0);

  hbox26 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox26);
  gtk_box_pack_start (GTK_BOX (hbox25), hbox26, TRUE, TRUE, 0);

  label13 = gtk_label_new (_("Doc.-Nr. 1"));
  gtk_widget_show (label13);
  gtk_box_pack_start (GTK_BOX (hbox26), label13, FALSE, FALSE, 0);

  eDocumentNumber1 = gtk_entry_new ();
  gtk_widget_show (eDocumentNumber1);
  gtk_box_pack_start (GTK_BOX (hbox26), eDocumentNumber1, TRUE, TRUE, 0);

  hbox27 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox27);
  gtk_box_pack_start (GTK_BOX (hbox25), hbox27, TRUE, TRUE, 0);

  label14 = gtk_label_new (_("Doc-Nr. 2"));
  gtk_widget_show (label14);
  gtk_box_pack_start (GTK_BOX (hbox27), label14, FALSE, FALSE, 0);

  eDocumentNumber2 = gtk_entry_new ();
  gtk_widget_show (eDocumentNumber2);
  gtk_box_pack_start (GTK_BOX (hbox27), eDocumentNumber2, TRUE, TRUE, 0);

  hbox4 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox4, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox4), 3);

  label11 = gtk_label_new (_("account"));
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (hbox4), label11, FALSE, FALSE, 0);

  hbox10 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox10);
  gtk_box_pack_start (GTK_BOX (hbox4), hbox10, TRUE, TRUE, 0);

  label9 = gtk_label_new (_("debit (receipt)"));
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox10), label9, FALSE, FALSE, 0);

  label10 = gtk_label_new (_("credit (cost)"));
  gtk_widget_show (label10);
  gtk_box_pack_start (GTK_BOX (hbox10), label10, FALSE, FALSE, 0);

  hbox17 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox17);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox17, TRUE, TRUE, 0);

  hbox28 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox28);
  gtk_box_pack_start (GTK_BOX (hbox17), hbox28, TRUE, TRUE, 0);

  eBookAccount1 = gtk_entry_new ();
  gtk_widget_show (eBookAccount1);
  gtk_box_pack_start (GTK_BOX (hbox28), eBookAccount1, TRUE, TRUE, 0);
  gtk_widget_add_accelerator (eBookAccount1, "activate", accel_group,
                              GDK_F1, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount1), 10);

  eInfo1 = gtk_entry_new ();
  gtk_widget_show (eInfo1);
  gtk_box_pack_start (GTK_BOX (hbox28), eInfo1, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo1), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo1), 30);

  hbox18 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox18);
  gtk_box_pack_start (GTK_BOX (hbox17), hbox18, TRUE, TRUE, 0);

  eDebit1 = gtk_entry_new ();
  gtk_widget_show (eDebit1);
  gtk_box_pack_start (GTK_BOX (hbox18), eDebit1, TRUE, TRUE, 0);

  eCredit1 = gtk_entry_new ();
  gtk_widget_show (eCredit1);
  gtk_box_pack_start (GTK_BOX (hbox18), eCredit1, TRUE, TRUE, 0);

  hbox32 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox32);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox32, FALSE, FALSE, 0);

  hbox33 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox33);
  gtk_box_pack_start (GTK_BOX (hbox32), hbox33, TRUE, TRUE, 0);

  eBookAccount2 = gtk_entry_new ();
  gtk_widget_show (eBookAccount2);
  gtk_box_pack_start (GTK_BOX (hbox33), eBookAccount2, TRUE, TRUE, 0);
  gtk_widget_add_accelerator (eBookAccount2, "activate", accel_group,
                              GDK_F1, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount2), 10);

  eInfo2 = gtk_entry_new ();
  gtk_widget_show (eInfo2);
  gtk_box_pack_start (GTK_BOX (hbox33), eInfo2, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo2), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo2), 30);

  hbox34 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox34);
  gtk_box_pack_start (GTK_BOX (hbox32), hbox34, TRUE, TRUE, 0);

  eDebit2 = gtk_entry_new ();
  gtk_widget_show (eDebit2);
  gtk_box_pack_start (GTK_BOX (hbox34), eDebit2, TRUE, TRUE, 0);

  eCredit2 = gtk_entry_new ();
  gtk_widget_show (eCredit2);
  gtk_box_pack_start (GTK_BOX (hbox34), eCredit2, TRUE, TRUE, 0);

  hbox35 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox35);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox35, TRUE, TRUE, 0);

  hbox36 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox36);
  gtk_box_pack_start (GTK_BOX (hbox35), hbox36, TRUE, TRUE, 0);

  eBookAccount3 = gtk_entry_new ();
  gtk_widget_show (eBookAccount3);
  gtk_box_pack_start (GTK_BOX (hbox36), eBookAccount3, TRUE, TRUE, 0);
  gtk_widget_add_accelerator (eBookAccount3, "activate", accel_group,
                              GDK_F1, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount3), 10);

  eInfo3 = gtk_entry_new ();
  gtk_widget_show (eInfo3);
  gtk_box_pack_start (GTK_BOX (hbox36), eInfo3, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo3), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo3), 30);

  hbox37 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox37);
  gtk_box_pack_start (GTK_BOX (hbox35), hbox37, TRUE, TRUE, 0);

  eDebit3 = gtk_entry_new ();
  gtk_widget_show (eDebit3);
  gtk_box_pack_start (GTK_BOX (hbox37), eDebit3, TRUE, TRUE, 0);

  eCredit3 = gtk_entry_new ();
  gtk_widget_show (eCredit3);
  gtk_box_pack_start (GTK_BOX (hbox37), eCredit3, TRUE, TRUE, 0);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox2), hseparator1, TRUE, TRUE, 0);
  gtk_widget_set_size_request (hseparator1, -1, 13);

  hbox9 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox9);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox9, TRUE, TRUE, 0);

  label12 = gtk_label_new (_("counter account"));
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (hbox9), label12, FALSE, FALSE, 0);

  hbox15 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox15);
  gtk_box_pack_start (GTK_BOX (hbox9), hbox15, TRUE, TRUE, 0);

  hbox16 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox16);
  gtk_box_pack_start (GTK_BOX (hbox15), hbox16, TRUE, TRUE, 0);

  hbox19 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox19);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox19, TRUE, TRUE, 0);

  hbox29 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox29);
  gtk_box_pack_start (GTK_BOX (hbox19), hbox29, TRUE, TRUE, 0);

  eBookAccount5 = gtk_entry_new ();
  gtk_widget_show (eBookAccount5);
  gtk_box_pack_start (GTK_BOX (hbox29), eBookAccount5, TRUE, TRUE, 0);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount5), 10);

  eInfo5 = gtk_entry_new ();
  gtk_widget_show (eInfo5);
  gtk_box_pack_start (GTK_BOX (hbox29), eInfo5, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo5), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo5), 30);

  hbox21 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox21);
  gtk_box_pack_start (GTK_BOX (hbox19), hbox21, TRUE, TRUE, 0);

  eDebit5 = gtk_entry_new ();
  gtk_widget_show (eDebit5);
  gtk_box_pack_start (GTK_BOX (hbox21), eDebit5, TRUE, TRUE, 0);

  eCredit5 = gtk_entry_new ();
  gtk_widget_show (eCredit5);
  gtk_box_pack_start (GTK_BOX (hbox21), eCredit5, TRUE, TRUE, 0);

  hbox20 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox20);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox20, TRUE, TRUE, 0);

  hbox30 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox30);
  gtk_box_pack_start (GTK_BOX (hbox20), hbox30, TRUE, TRUE, 0);

  eBookAccount6 = gtk_entry_new ();
  gtk_widget_show (eBookAccount6);
  gtk_box_pack_start (GTK_BOX (hbox30), eBookAccount6, TRUE, TRUE, 0);
  gtk_widget_add_accelerator (eBookAccount6, "activate", accel_group,
                              GDK_F1, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount6), 10);

  eInfo6 = gtk_entry_new ();
  gtk_widget_show (eInfo6);
  gtk_box_pack_start (GTK_BOX (hbox30), eInfo6, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo6), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo6), 30);

  hbox22 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox22);
  gtk_box_pack_start (GTK_BOX (hbox20), hbox22, TRUE, TRUE, 0);

  eDebit6 = gtk_entry_new ();
  gtk_widget_show (eDebit6);
  gtk_box_pack_start (GTK_BOX (hbox22), eDebit6, TRUE, TRUE, 0);

  eCredit6 = gtk_entry_new ();
  gtk_widget_show (eCredit6);
  gtk_box_pack_start (GTK_BOX (hbox22), eCredit6, TRUE, TRUE, 0);

  hbox23 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox23);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox23, TRUE, TRUE, 0);

  hbox31 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox31);
  gtk_box_pack_start (GTK_BOX (hbox23), hbox31, TRUE, TRUE, 0);

  eBookAccount7 = gtk_entry_new ();
  gtk_widget_show (eBookAccount7);
  gtk_box_pack_start (GTK_BOX (hbox31), eBookAccount7, TRUE, TRUE, 0);
  gtk_widget_add_accelerator (eBookAccount7, "activate", accel_group,
                              GDK_F1, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  gtk_entry_set_width_chars (GTK_ENTRY (eBookAccount7), 10);

  eInfo7 = gtk_entry_new ();
  gtk_widget_show (eInfo7);
  gtk_box_pack_start (GTK_BOX (hbox31), eInfo7, FALSE, FALSE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (eInfo7), FALSE);
  gtk_entry_set_width_chars (GTK_ENTRY (eInfo7), 30);

  hbox24 = gtk_hbox_new (TRUE, 0);
  gtk_widget_show (hbox24);
  gtk_box_pack_start (GTK_BOX (hbox23), hbox24, TRUE, TRUE, 0);

  eDebit7 = gtk_entry_new ();
  gtk_widget_show (eDebit7);
  gtk_box_pack_start (GTK_BOX (hbox24), eDebit7, TRUE, TRUE, 0);

  eCredit7 = gtk_entry_new ();
  gtk_widget_show (eCredit7);
  gtk_box_pack_start (GTK_BOX (hbox24), eCredit7, TRUE, TRUE, 0);

  bCash = gtk_button_new_with_mnemonic (_("Bookkeeping"));
  gtk_widget_show (bCash);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), bCash);

  g_signal_connect ((gpointer) choosePrinter1, "activate",
                    G_CALLBACK (on_choosePrinter1_activate),
                    NULL);
  g_signal_connect ((gpointer) quit1, "activate",
                    G_CALLBACK (on_quit1_activate),
                    NULL);
  g_signal_connect ((gpointer) new1, "activate",
                    G_CALLBACK (on_new1_activate),
                    NULL);
  g_signal_connect ((gpointer) edit1, "activate",
                    G_CALLBACK (on_edit1_activate),
                    NULL);
  g_signal_connect ((gpointer) save1, "activate",
                    G_CALLBACK (on_save1_activate),
                    NULL);
  g_signal_connect ((gpointer) print1, "activate",
                    G_CALLBACK (on_print1_activate),
                    NULL);
  g_signal_connect ((gpointer) delete1, "activate",
                    G_CALLBACK (on_delete1_activate),
                    NULL);
  g_signal_connect ((gpointer) journal_monthly1, "activate",
                    G_CALLBACK (on_journal_monthly1_activate),
                    NULL);
  g_signal_connect ((gpointer) journal_all1, "activate",
                    G_CALLBACK (on_journal_all1_activate),
                    NULL);
  g_signal_connect ((gpointer) bSearch, "clicked",
                    G_CALLBACK (on_bSearch_clicked),
                    NULL);
  g_signal_connect ((gpointer) eDate, "key_press_event",
                    G_CALLBACK (on_eDate_key_press_event),
                    NULL);
  g_signal_connect ((gpointer) eShortKey, "changed",
                    G_CALLBACK (on_eShortKey_changed),
                    NULL);
  g_signal_connect ((gpointer) eShortKey, "focus_out_event",
                    G_CALLBACK (on_eShortKey_focus_out_event),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount1, "activate",
                    G_CALLBACK (on_eCAB1_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount1, "changed",
                    G_CALLBACK (on_eCAB1_changed),
                    NULL);
  g_signal_connect ((gpointer) eDebit1, "editing_done",
                    G_CALLBACK (on_eDebi1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eCredit1, "editing_done",
                    G_CALLBACK (on_eCredit1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount2, "activate",
                    G_CALLBACK (on_eCAB1_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount2, "changed",
                    G_CALLBACK (on_eCAB1_changed),
                    NULL);
  g_signal_connect ((gpointer) eDebit2, "editing_done",
                    G_CALLBACK (on_eDebi1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eCredit2, "editing_done",
                    G_CALLBACK (on_eCredit1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount3, "activate",
                    G_CALLBACK (on_eCAB1_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount3, "changed",
                    G_CALLBACK (on_eCAB1_changed),
                    NULL);
  g_signal_connect ((gpointer) eDebit3, "editing_done",
                    G_CALLBACK (on_eDebi1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eCredit3, "editing_done",
                    G_CALLBACK (on_eCredit1_editing_done),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount5, "activate",
                    G_CALLBACK (on_eCAB2_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount5, "changed",
                    G_CALLBACK (on_eCAB2_changed),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount6, "activate",
                    G_CALLBACK (on_eCAB3_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount6, "changed",
                    G_CALLBACK (on_eCAB3_changed),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount7, "activate",
                    G_CALLBACK (on_eCAB4_activate),
                    NULL);
  g_signal_connect ((gpointer) eBookAccount7, "changed",
                    G_CALLBACK (on_eCAB4_changed),
                    NULL);
  g_signal_connect ((gpointer) bCash, "clicked",
                    G_CALLBACK (on_bArticle_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (BookkeepingMainwindow, BookkeepingMainwindow, "BookkeepingMainwindow");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, menubar1, "menubar1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, file1, "file1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, file1_menu, "file1_menu");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, choosePrinter1, "choosePrinter1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator2, "separator2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, quit1, "quit1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bookkeeping, "bookkeeping");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bookkeeping_menu, "bookkeeping_menu");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, new1, "new1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, edit1, "edit1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, trennlinie1, "trennlinie1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, save1, "save1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator3, "separator3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, print1, "print1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, separator1, "separator1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, delete1, "delete1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal1, "journal1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal1_menu, "journal1_menu");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal_monthly1, "journal_monthly1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, journal_all1, "journal_all1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, toolbar1, "toolbar1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, lFindNumber, "lFindNumber");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eFindName, "eFindName");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, lFindDesignation, "lFindDesignation");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eFindCity, "eFindCity");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bSearch, "bSearch");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, viewport1, "viewport1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, tree1, "tree1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, notebook1, "notebook1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label1, "label1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDate, "eDate");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label2, "label2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eShortKey, "eShortKey");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, cbAutomatic, "cbAutomatic");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label3, "label3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDesignation, "eDesignation");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox25, "hbox25");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox26, "hbox26");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label13, "label13");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDocumentNumber1, "eDocumentNumber1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox27, "hbox27");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label14, "label14");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDocumentNumber2, "eDocumentNumber2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox4, "hbox4");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label11, "label11");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox10, "hbox10");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label9, "label9");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label10, "label10");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox17, "hbox17");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox28, "hbox28");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount1, "eBookAccount1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo1, "eInfo1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox18, "hbox18");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit1, "eDebit1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit1, "eCredit1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox32, "hbox32");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox33, "hbox33");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount2, "eBookAccount2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo2, "eInfo2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox34, "hbox34");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit2, "eDebit2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit2, "eCredit2");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox35, "hbox35");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox36, "hbox36");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount3, "eBookAccount3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo3, "eInfo3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox37, "hbox37");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit3, "eDebit3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit3, "eCredit3");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hseparator1, "hseparator1");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox9, "hbox9");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, label12, "label12");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox15, "hbox15");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox16, "hbox16");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox19, "hbox19");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox29, "hbox29");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount5, "eBookAccount5");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo5, "eInfo5");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox21, "hbox21");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit5, "eDebit5");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit5, "eCredit5");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox20, "hbox20");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox30, "hbox30");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount6, "eBookAccount6");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo6, "eInfo6");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox22, "hbox22");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit6, "eDebit6");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit6, "eCredit6");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox23, "hbox23");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox31, "hbox31");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eBookAccount7, "eBookAccount7");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eInfo7, "eInfo7");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, hbox24, "hbox24");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eDebit7, "eDebit7");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, eCredit7, "eCredit7");
  GLADE_HOOKUP_OBJECT (BookkeepingMainwindow, bCash, "bCash");

  gtk_window_add_accel_group (GTK_WINDOW (BookkeepingMainwindow), accel_group);

  return BookkeepingMainwindow;
}
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 ;
      }

      tab_compound_list = tab_compound_list->next ;
    }


  }

  return ;
}
Exemple #15
0
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;
}
Exemple #16
0
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"));

        g_signal_connect(dialog, "response", G_CALLBACK(xfce4_session_settings_dialog_response), NULL);
        g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_main_quit), NULL);

        gtk_widget_show(dialog);

        /* To prevent the settings dialog to be saved in the session */
        gdk_set_sm_client_id ("FAKE ID");

        gtk_main();
    } else {
        GtkWidget *plug, *plug_child;

        plug = gtk_plug_new(opt_socket_id);
        gtk_widget_show(plug);
        g_signal_connect(plug, "delete-event",
                         G_CALLBACK(gtk_main_quit), NULL);

        plug_child = GTK_WIDGET(gtk_builder_get_object(builder, "plug-child"));
        gtk_widget_reparent(plug_child, plug);
        gtk_widget_show(plug_child);

        /* Stop startup notification */
        gdk_notify_startup_complete();

        gtk_main();
    }

    g_object_unref(builder);

    return EXIT_SUCCESS;
}
Exemple #17
0
/**
 * 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 ();
  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
  gtk_box_pack_start (GTK_BOX (gpage), grid, FALSE, FALSE, 0);

  label = gtk_label_new_with_mnemonic (_("_Image theme:"));
  gtk_widget_set_hexpand (label, TRUE);
  gtk_widget_set_halign (label, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);

  pmapmenu = make_theme_menu ();
  g_signal_connect (G_OBJECT (pmapmenu), "changed",
		    G_CALLBACK (pmap_selection), NULL);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), pmapmenu);

  gtk_grid_attach (GTK_GRID (grid), pmapmenu, 1, 0, 1, 1);

  label = gtk_label_new_with_mnemonic (_("_Background color:"));
  gtk_widget_set_halign (label, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);

  w = gtk_color_button_new ();
  gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (w), &properties.bgcolour);
  g_signal_connect (G_OBJECT (w), "color_set",
		    G_CALLBACK (bg_color_callback), NULL);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), w);

  gtk_grid_attach (GTK_GRID (grid), w, 1, 1, 1, 1);

  label = gtk_label_new_with_mnemonic (_("Appearance"));
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gpage, label);

  /* The keyboard page */
  kpage = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
  gtk_container_set_border_width (GTK_CONTAINER (kpage), 12);

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
  gtk_box_pack_start (GTK_BOX (kpage), vbox, TRUE, TRUE, 0);

  controls_list = games_controls_list_new (settings);
  games_controls_list_add_controls (GAMES_CONTROLS_LIST (controls_list),
				    "key00", _("Key to move NW"), g_settings_get_default_value (settings, "key00"),
				    "key01", _("Key to move N"), g_settings_get_default_value (settings, "key01"),
				    "key02", _("Key to move NE"), g_settings_get_default_value (settings, "key02"),
				    "key03", _("Key to move W"), g_settings_get_default_value (settings, "key03"),
				    "key04", _("Key to hold"), g_settings_get_default_value (settings, "key04"),
				    "key05", _("Key to move E"), g_settings_get_default_value (settings, "key05"),
				    "key06", _("Key to move SW"), g_settings_get_default_value (settings, "key06"),
				    "key07", _("Key to move S"), g_settings_get_default_value (settings, "key07"),
				    "key08", _("Key to move SE"), g_settings_get_default_value (settings, "key08"),
                                    NULL);

  gtk_box_pack_start (GTK_BOX (vbox), controls_list, TRUE, TRUE, 0);

  hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_START);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  dbut = gtk_button_new_with_mnemonic (_("_Restore Defaults"));
  g_signal_connect (G_OBJECT (dbut), "clicked",
		    G_CALLBACK (defkey_cb), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), dbut, FALSE, FALSE, 0);

  label = gtk_label_new_with_mnemonic (_("Keyboard"));
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), kpage, label);


  g_signal_connect (G_OBJECT (propbox), "delete_event",
		    G_CALLBACK (delete_cb), NULL);
  g_signal_connect (G_OBJECT (propbox), "response",
		    G_CALLBACK (apply_cb), NULL);

  gtk_widget_show_all (propbox);
}
Exemple #18
0
static void
display_prefs_dialog (GtkAction       *action,
                      WinPickerApp *applet)
{
  GtkWidget *window, *box, *vbox, *nb, *hbox, *label, *check, *button;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), _("Preferences"));
  gtk_window_set_icon_name (GTK_WINDOW (window), "preferences-system-windows");
  gtk_window_set_type_hint (GTK_WINDOW (window),
                            GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_container_set_border_width (GTK_CONTAINER (window), 12);

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
  gtk_container_add (GTK_CONTAINER (window), box);

  nb = gtk_notebook_new ();
  g_object_set (nb, "show-tabs", FALSE, "show-border", TRUE, NULL);
  gtk_box_pack_start (GTK_BOX (box), nb, TRUE, TRUE, 0);

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
  gtk_notebook_append_page (GTK_NOTEBOOK (nb), vbox, NULL);

  check = gtk_check_button_new_with_label (_("Show all windows"));
  gtk_widget_set_tooltip_text (GTK_WIDGET (check),
                               _("Show windows from all workspaces."));
  gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
                                g_settings_get_boolean (mainapp->settings, SHOW_WIN_KEY));
  g_signal_connect (check, "toggled",
                    G_CALLBACK (on_show_win_key_checkbox_toggled), NULL);

  check = gtk_check_button_new_with_label (_("Show desktop title and logout button"));
  gtk_widget_set_tooltip_text (GTK_WIDGET (check),
                               _("Show a title for the desktop when no window is selected, and append a logout button."));
  gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
                                g_settings_get_boolean (mainapp->settings, SHOW_HOME_TITLE_KEY));
  g_signal_connect (check, "toggled",
                    G_CALLBACK (on_show_home_title_checkbox_toggled), NULL);

  check = gtk_check_button_new_with_label (_("Bold windows title"));
  gtk_widget_set_tooltip_text (GTK_WIDGET (check),
                               _("Show windows title with a bold face."));
  gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
                                g_settings_get_boolean (mainapp->settings, BOLD_WINDOW_TITLE_KEY));
  g_signal_connect (check, "toggled",
                    G_CALLBACK (on_bold_window_title_checkbox_toggled), NULL);

  check = gtk_label_new (" ");
  gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);

  gtk_widget_set_size_request (nb, -1, 100);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);

  label = gtk_label_new (" ");
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);

  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);

  gtk_widget_show_all (window);

  g_signal_connect (window, "delete-event",
                    G_CALLBACK (gtk_widget_destroy), window);

  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_widget_destroy), window);
  g_signal_connect_swapped (button, "clicked",
                            G_CALLBACK (gtk_widget_destroy), window);

  gtk_window_present (GTK_WINDOW (window));
}
Exemple #19
0
void wxNotebook::GTKOnPageChanged()
{
    m_selection = gtk_notebook_get_current_page(GTK_NOTEBOOK(m_widget));

    SendPageChangedEvent(m_oldSelection);
}
GtkWidget *
empathy_preferences_show (GtkWindow *parent)
{
	static EmpathyPreferences *preferences;
	GladeXML                 *glade;
	gchar                    *filename;

	if (preferences) {
		gtk_window_present (GTK_WINDOW (preferences->dialog));
		return preferences->dialog;
	}

	preferences = g_new0 (EmpathyPreferences, 1);

	filename = empathy_file_lookup ("empathy-preferences.glade", "src");
	glade = empathy_glade_get_file (filename,
		"preferences_dialog",
		NULL,
		"preferences_dialog", &preferences->dialog,
		"notebook", &preferences->notebook,
		"checkbutton_show_avatars", &preferences->checkbutton_show_avatars,
		"checkbutton_compact_contact_list", &preferences->checkbutton_compact_contact_list,
		"checkbutton_show_smileys", &preferences->checkbutton_show_smileys,
		"combobox_chat_theme", &preferences->combobox_chat_theme,
		"checkbutton_separate_chat_windows", &preferences->checkbutton_separate_chat_windows,
		"checkbutton_autoconnect", &preferences->checkbutton_autoconnect,
		"radiobutton_contact_list_sort_by_name", &preferences->radiobutton_contact_list_sort_by_name,
		"radiobutton_contact_list_sort_by_state", &preferences->radiobutton_contact_list_sort_by_state,
		"checkbutton_sounds_for_messages", &preferences->checkbutton_sounds_for_messages,
		"checkbutton_sounds_when_busy", &preferences->checkbutton_sounds_when_busy,
		"checkbutton_sounds_when_away", &preferences->checkbutton_sounds_when_away,
		"checkbutton_popups_when_available", &preferences->checkbutton_popups_when_available,
		"treeview_spell_checker", &preferences->treeview_spell_checker,
		NULL);
	g_free (filename);

	empathy_glade_connect (glade,
			      preferences,
			      "preferences_dialog", "destroy", preferences_destroy_cb,
			      "preferences_dialog", "response", preferences_response_cb,
			      NULL);

	g_object_unref (glade);

	g_object_add_weak_pointer (G_OBJECT (preferences->dialog), (gpointer) &preferences);

	preferences_themes_setup (preferences);

	preferences_setup_widgets (preferences);

	preferences_languages_setup (preferences);
	preferences_languages_add (preferences);
	preferences_languages_load (preferences);

	if (empathy_spell_supported ()) {
		GtkWidget *page;

		page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (preferences->notebook), 2);
		gtk_widget_show (page);
	}

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (preferences->dialog),
					      GTK_WINDOW (parent));
	}

	gtk_widget_show (preferences->dialog);

	return preferences->dialog;
}
Exemple #21
0
int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
{
    GtkAllocation a;
    gtk_widget_get_allocation(m_widget, &a);
    const int x = a.x;
    const int y = a.y;

    const size_t count = GetPageCount();
    size_t i = 0;

#ifndef __WXGTK3__
    GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
    if (gtk_notebook_get_scrollable(notebook))
        i = g_list_position( notebook->children, notebook->first_tab );
#endif

    for ( ; i < count; i++ )
    {
        wxGtkNotebookPage* pageData = GetNotebookPage(i);
        GtkWidget* box = pageData->m_box;

        const gint border = gtk_container_get_border_width(GTK_CONTAINER(box));

        if ( IsPointInsideWidget(pt, box, x, y, border) )
        {
            // ok, we're inside this tab -- now find out where, if needed
            if ( flags )
            {
                if (pageData->m_image && IsPointInsideWidget(pt, pageData->m_image, x, y))
                {
                    *flags = wxBK_HITTEST_ONICON;
                }
                else if (IsPointInsideWidget(pt, pageData->m_label, x, y))
                {
                    *flags = wxBK_HITTEST_ONLABEL;
                }
                else
                {
                    *flags = wxBK_HITTEST_ONITEM;
                }
            }

            return i;
        }
    }

    if ( flags )
    {
        *flags = wxBK_HITTEST_NOWHERE;
        wxWindowBase * page = GetCurrentPage();
        if ( page )
        {
            // rect origin is in notebook's parent coordinates
            wxRect rect = page->GetRect();

            // adjust it to the notebook's coordinates
            wxPoint pos = GetPosition();
            rect.x -= pos.x;
            rect.y -= pos.y;
            if ( rect.Contains( pt ) )
                *flags |= wxBK_HITTEST_ONPAGE;
        }
    }

    return wxNOT_FOUND;
}
bool RunLinuxDialog()
{
	GtkWidget *dialog;
	int return_value;

	/* Create the widgets */
	dialog = gtk_dialog_new_with_buttons (
		"GSdx Config",
		NULL, /* parent window*/
		(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
		"OK", GTK_RESPONSE_ACCEPT,
		// "Cancel", GTK_RESPONSE_REJECT, // Drop because it is too annoying to support call back this way
		NULL);

	// The main area for the whole dialog box.
	GtkWidget* main_box     = gtk_vbox_new(false, 5);
	GtkWidget* central_box  = gtk_vbox_new(false, 5);
	GtkWidget* advanced_box = gtk_vbox_new(false, 5);
	GtkWidget* debug_box    = gtk_vbox_new(false, 5);

	// Grab a logo, to make things look nice.
	GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL);
	GtkWidget* logo_image  = gtk_image_new_from_pixbuf(logo_pixmap);
	gtk_box_pack_start(GTK_BOX(main_box), logo_image, true, true, 0);

	GtkWidget* main_table   = CreateTableInBox(main_box    , NULL                                   , 2  , 2);

	GtkWidget* shader_table = CreateTableInBox(central_box , "Custom Shader Settings"               , 9  , 2);
	GtkWidget* hw_table     = CreateTableInBox(central_box , "Hardware Mode Settings"               , 7  , 2);
	GtkWidget* sw_table     = CreateTableInBox(central_box , "Software Mode Settings"               , 2  , 2);

	GtkWidget* hack_table   = CreateTableInBox(advanced_box, "Hacks"                                , 7 , 2);
	GtkWidget* gl_table     = CreateTableInBox(advanced_box, "OpenGL Very Advanced Custom Settings" , 6 , 2);

	GtkWidget* record_table = CreateTableInBox(debug_box   , "Recording Settings"                   , 4  , 3);
	GtkWidget* debug_table  = CreateTableInBox(debug_box   , "OpenGL / GSdx Debug Settings"         , 6  , 3);

	// Populate all the tables
	populate_main_table(main_table);

	populate_shader_table(shader_table);
	populate_hw_table(hw_table);
	populate_sw_table(sw_table);

	populate_hack_table(hack_table);
	populate_gl_table(gl_table);

	populate_debug_table(debug_table);
	populate_record_table(record_table);

	// Handle some nice tab
	GtkWidget* notebook = gtk_notebook_new();
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), central_box , gtk_label_new("Global Settings"));
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced_box, gtk_label_new("Advanced Settings"));
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), debug_box   , gtk_label_new("Debug/Recording Settings"));

	// Put everything in the big box.
	gtk_container_add(GTK_CONTAINER(main_box), notebook);

	// Put the box in the dialog and show it to the world.
	gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_box);
	gtk_widget_show_all (dialog);
	return_value = gtk_dialog_run (GTK_DIALOG (dialog));

	// Compatibility & not supported option
	int mode_width = theApp.GetConfig("ModeWidth", 640);
	int mode_height = theApp.GetConfig("ModeHeight", 480);
	theApp.SetConfig("ModeHeight", mode_height);
	theApp.SetConfig("ModeWidth", mode_width);
	theApp.SetConfig("msaa", 0);
	theApp.SetConfig("windowed", 1);

	gtk_widget_destroy (dialog);

	return (return_value == GTK_RESPONSE_ACCEPT);
}
Exemple #23
0
static void
saa_main_window_init (SaaMainWindow * w) {
	GtkWidget * vbox_win;

	// Barre de menu ----------------------------------------------------------
	GtkWidget *menubar;
	GtkWidget *image;

	GtkWidget *mit_fichier;
	GtkWidget *mit_fichier_menu;
		GtkWidget *it_charger_xml;
		GtkWidget *it_enregistrer_xml;

		GtkWidget *mit_exporter;
		GtkWidget *mit_exporter_menu;
			GtkWidget *it_exporter;
			GtkWidget *it_exporter_rb;

		GtkWidget *it_sep_fichier;
		GtkWidget *it_quitter;

	GtkWidget *mit_aide;
	GtkWidget *mit_aide_menu;
		GtkWidget *it_a_propos;


	GtkWidget *hbox_win;
	GtkWidget *vbox_prop;

	// Onglets ----------------------------------------------------------------
	GtkWidget *notebook;

	GtkWidget *label_page1;
	GtkWidget *page1;

	GtkWidget *f_uniform;
	GtkWidget *lbl_uniform;

	GtkWidget *f_traitement;
	GtkWidget *lbl_traitement;

	GtkWidget *label_page2;
	GtkWidget *page2;

	GtkWidget *sw;

	GtkWidget *label_page3;
	GtkWidget *page3;

	// Barre d'état -----------------------------------------------------------
	GtkWidget *hbox_status;
	GtkWidget *statusbar;
	GtkWidget *progressbar;

	GtkAccelGroup *accel_group;

	int i;
	const gchar* const * dirs = g_get_system_data_dirs();
	gchar * path;

	// TODO init_files();
	saa_init_files();

	g_set_application_name (PACKAGE_NAME);

	w->icon = NULL;
	for(i=0; dirs[i] && !w->icon; i++) {
		path = g_build_filename(dirs[i], "images", "gsolaar-logo.png", NULL);
		if(g_file_test(path, G_FILE_TEST_EXISTS)) {
			w->icon = gdk_pixbuf_new_from_file(path, NULL);
			gtk_window_set_default_icon (w->icon);
		}
		g_free(path);
	}
	w->visuel = saa_visuel_creer();

	accel_group = gtk_accel_group_new ();

	gtk_window_set_title (GTK_WINDOW (w), "GSolaar");

	vbox_win = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_win);
	gtk_container_add (GTK_CONTAINER (w), vbox_win);

	menubar = gtk_menu_bar_new ();
	gtk_widget_show (menubar);
	gtk_box_pack_start (GTK_BOX (vbox_win), menubar, FALSE, FALSE, 0);

	mit_fichier = gtk_menu_item_new_with_mnemonic(_("_File"));
	gtk_widget_show (mit_fichier);
	gtk_container_add (GTK_CONTAINER (menubar), mit_fichier);

	mit_fichier_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_fichier), mit_fichier_menu);

	// Chargement -------------------------------------------------------------
	it_charger_xml = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, accel_group);
	gtk_widget_show (it_charger_xml);
	gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_charger_xml);

	// Sauvegarde -------------------------------------------------------------
	it_enregistrer_xml = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, accel_group);
	gtk_widget_show (it_enregistrer_xml);
	gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_enregistrer_xml);

	// Patron -----------------------------------------------------------------
	mit_exporter = gtk_image_menu_item_new_with_mnemonic(_("_Export"));
	gtk_widget_show(mit_exporter);
	gtk_container_add (GTK_CONTAINER (mit_fichier_menu), mit_exporter);

	image = gtk_image_new_from_stock (GTK_STOCK_CONVERT, GTK_ICON_SIZE_MENU);
	gtk_widget_show (image);
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mit_exporter), image);

	mit_exporter_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_exporter), mit_exporter_menu);

	it_exporter = gtk_image_menu_item_new_with_label (_("Pattern ..."));
	gtk_widget_show (it_exporter);
	gtk_container_add (GTK_CONTAINER (mit_exporter_menu), it_exporter);

	it_exporter_rb = gtk_image_menu_item_new_with_label (_("Ruby script for SketchUp ..."));
	gtk_widget_show (it_exporter_rb);
	gtk_container_add (GTK_CONTAINER (mit_exporter_menu), it_exporter_rb);

	//-------------------------------------------------------------------------
	it_sep_fichier = gtk_menu_item_new ();
	gtk_widget_show (it_sep_fichier);
	gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_sep_fichier);
	gtk_widget_set_sensitive (it_sep_fichier, FALSE);

	it_quitter = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, accel_group);
	gtk_widget_show (it_quitter);
	gtk_container_add (GTK_CONTAINER (mit_fichier_menu), it_quitter);

	mit_aide = gtk_menu_item_new_with_mnemonic ("_?");
	gtk_widget_show (mit_aide);
	gtk_container_add (GTK_CONTAINER (menubar), mit_aide);

	mit_aide_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (mit_aide), mit_aide_menu);

	it_a_propos = gtk_image_menu_item_new_from_stock ( GTK_STOCK_ABOUT, accel_group);
	gtk_widget_show (it_a_propos);
	gtk_container_add (GTK_CONTAINER (mit_aide_menu), it_a_propos);

	//-------------------------------------------------------------------------
	hbox_win = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox_win);
	gtk_box_pack_start (GTK_BOX (vbox_win), hbox_win, TRUE, TRUE, 0);

	vbox_prop = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_prop);
	gtk_box_pack_start (GTK_BOX (hbox_win), vbox_prop, TRUE, TRUE, 0);
	gtk_widget_set_size_request (vbox_prop, 500, 400);

	// Drawing Area
	w->area = saa_drawing_area_new_with_visuel (w->visuel);
	gtk_widget_show (w->area);
	gtk_box_pack_start (GTK_BOX (vbox_prop), w->area, TRUE, TRUE, 0);
	gtk_widget_set_size_request (w->area, 600, 400);

	notebook = gtk_notebook_new();
	gtk_widget_show(notebook);
	gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
	gtk_box_pack_start (GTK_BOX (hbox_win), notebook, FALSE, FALSE, 0);

	label_page1 = gtk_label_new (_("Polyhedron"));
	gtk_widget_show (label_page1);

	page1 = gtk_vbox_new (FALSE, 5);
	gtk_widget_show (page1);
	gtk_container_set_border_width (GTK_CONTAINER (page1), 5);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page1, label_page1);

	f_uniform = gtk_frame_new (NULL);
	gtk_widget_show (f_uniform);
	gtk_box_pack_start (GTK_BOX (page1), f_uniform, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (f_uniform), 5);
	gtk_frame_set_label_align (GTK_FRAME (f_uniform), 0.5, 0.5);

	lbl_uniform = gtk_label_new (_("Uniform polyhedra"));
	gtk_widget_show (lbl_uniform);
	gtk_frame_set_label_widget (GTK_FRAME (f_uniform), lbl_uniform);
	gtk_label_set_justify (GTK_LABEL (lbl_uniform), GTK_JUSTIFY_LEFT);

	// Solid manager
	w->manager = saa_solid_manager_new_with_visuel(w->visuel);
	gtk_widget_show(w->manager);
	gtk_container_add (GTK_CONTAINER (f_uniform), w->manager);

	f_traitement = gtk_frame_new (NULL);
	gtk_widget_show (f_traitement);
	gtk_box_pack_start (GTK_BOX (page1), f_traitement, TRUE, TRUE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (f_traitement), 5);
	gtk_frame_set_label_align (GTK_FRAME (f_traitement), 0.5, 0.5);

	lbl_traitement = gtk_label_new (_("Treatment"));
	gtk_widget_show (lbl_traitement);
	gtk_frame_set_label_widget (GTK_FRAME (f_traitement), lbl_traitement);
	gtk_label_set_justify (GTK_LABEL (lbl_traitement), GTK_JUSTIFY_LEFT);

	// Solid Handler
	w->handler = saa_solid_handler_new_with_visuel(w->visuel);
	gtk_widget_show(w->handler);
	gtk_container_add (GTK_CONTAINER (f_traitement), w->handler);

	label_page2 = gtk_label_new (_("Navigation"));
	gtk_widget_show (label_page2);

	page2 = gtk_vbox_new (FALSE, 5);
	gtk_widget_show (page2);
	gtk_container_set_border_width (GTK_CONTAINER (page2), 5);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page2, label_page2);

    sw = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show(sw);
    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_AUTOMATIC);
    gtk_box_pack_start (GTK_BOX (page2), sw, TRUE, TRUE, 0);

    // Treeview navigator
	w->explorer = saa_tree_view_new_with_visuel(w->visuel);
	gtk_widget_show(w->explorer);
	gtk_container_add (GTK_CONTAINER (sw), w->explorer);

	// TODO a deplacer dans window realize
	saa_tree_view_update(SAA_TREE_VIEW(w->explorer));

	label_page3 = gtk_label_new (_("Display"));
	gtk_widget_show (label_page3);

	page3 = gtk_vbox_new (FALSE, 5);
	gtk_widget_show (page3);
	gtk_container_set_border_width (GTK_CONTAINER (page3), 5);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page3, label_page3);

	// Solid display
	w->display = saa_solid_display_new_with_visuel(w->visuel);
	gtk_widget_show (w->display);
	gtk_box_pack_start(GTK_BOX(page3), w->display, TRUE, TRUE, 0);


	hbox_status = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox_status);
	gtk_box_pack_start (GTK_BOX (vbox_win), hbox_status, FALSE, FALSE, 0);

	statusbar = gtk_statusbar_new ();
	gtk_widget_show (statusbar);
	gtk_box_pack_start (GTK_BOX (hbox_status), statusbar, TRUE, TRUE, 0);

	progressbar = gtk_progress_bar_new ();
	gtk_widget_show (progressbar);
	gtk_box_pack_start (GTK_BOX (hbox_status), progressbar, FALSE, FALSE, 0);

	g_signal_connect_swapped ((gpointer)w->manager, "solid-changed",
			G_CALLBACK (saa_tree_view_update),
			w->explorer);
	g_signal_connect_swapped ((gpointer)w->manager, "solid-changed",
			G_CALLBACK (gtk_widget_queue_draw),
			w->area);

	g_signal_connect_swapped ((gpointer)w->display, "solid-changed",
			G_CALLBACK (gtk_widget_queue_draw),
			w->area);

	g_signal_connect_swapped ((gpointer)w->handler, "solid-changed",
			G_CALLBACK (saa_tree_view_update),
			w->explorer);
	g_signal_connect_swapped ((gpointer)w->handler, "solid-changed",
			G_CALLBACK (gtk_widget_queue_draw),
			w->area);

	g_signal_connect_swapped ((gpointer)w->area, "vertex-selected",
			G_CALLBACK (saa_tree_view_select_vertex),
			w->explorer);
	g_signal_connect_swapped ((gpointer)w->area, "edge-selected",
			G_CALLBACK (saa_tree_view_select_edge),
			w->explorer);
	g_signal_connect_swapped ((gpointer)w->area, "wing-selected",
			G_CALLBACK (saa_tree_view_select_wing),
			w->explorer);

	g_signal_connect_swapped ((gpointer)w->explorer, "vertex-selected",
			G_CALLBACK (saa_drawing_area_select_vertex),
			w->area);
	g_signal_connect_swapped ((gpointer)w->explorer, "edge-selected",
			G_CALLBACK (saa_drawing_area_select_edge),
			w->area);
	g_signal_connect_swapped ((gpointer)w->explorer, "wing-selected",
			G_CALLBACK (saa_drawing_area_select_wing),
			w->area);

	g_signal_connect_swapped((gpointer)it_charger_xml, "activate",
			G_CALLBACK (saa_main_window_charger_xml_clicked),
			w);
	g_signal_connect_swapped((gpointer)it_enregistrer_xml, "activate",
			G_CALLBACK (saa_main_window_sauver_xml_activate),
			w);
	g_signal_connect_swapped((gpointer)it_exporter, "activate",
			G_CALLBACK (saa_main_window_exporter_activate),
			w);
	g_signal_connect_swapped((gpointer)it_exporter_rb, "activate",
			G_CALLBACK (saa_main_window_exporter_rb_activate),
			w);

	g_signal_connect_swapped ((gpointer)it_quitter, "activate",
			G_CALLBACK (saa_main_window_quitter_activate),
			w);
	g_signal_connect (G_OBJECT(w), "destroy",
			G_CALLBACK (saa_main_window_quitter_activate),
			NULL);

	g_signal_connect_swapped ((gpointer)it_a_propos, "activate",
			G_CALLBACK (saa_main_window_a_propos_activate),
			w);

	gtk_window_add_accel_group (GTK_WINDOW (w), accel_group);
}
Exemple #24
0
void create_PreferencesDialog(void)
{
  GtkWidget *PreferencesDialog;
  GtkWidget *dialog_vbox9;
  GtkWidget *notebook1;
  GtkWidget *GenericTable;
  GtkWidget *label173;
  GtkObject *LogLevelSpinner_adj;
  GtkWidget *LogLevelSpinner;
  GtkWidget *DebugCheckButton;
  GtkWidget *label174;
  GtkWidget *StreamDirectoryHbox;
  GtkWidget *StreamDirectory;
  GtkWidget *StreamDirectoryButton;
  GtkWidget *alignment24;
  GtkWidget *hbox84;
  GtkWidget *image24;
  GtkWidget *label175;
  GtkWidget *label176;
  GtkWidget *ProfileDirectoryHbox;
  GtkWidget *ProfileDirectory;
  GtkWidget *ProfileDirectoryButton;
  GtkWidget *alignment25;
  GtkWidget *hbox86;
  GtkWidget *image25;
  GtkWidget *label177;
  GtkWidget *label169;
  GtkWidget *NetworkVbox;
  GtkWidget *NetworkTable;
  GtkWidget *label178;
  GtkWidget *label179;
  GtkWidget *MulticastTtlMenu;
  GtkWidget *menu16;
  GtkWidget *ttl_lan;
  GtkWidget *ttl_organization;
  GtkWidget *ttl_regional;
  GtkWidget *ttl_worldwide;
  GtkObject *MtuSpinButton_adj;
  GtkWidget *MtuSpinButton;
  GtkWidget *vbox39;
  GtkWidget *hbox89;
  GtkWidget *AllowRtcpCheck;
  GtkWidget *hbox87;
  GtkWidget *AllowSSMCheck;
  GtkWidget *label170;
  GtkWidget *MP4FileSettingsVbox;
  GtkWidget *FileStatusFrame;
  GtkWidget *FileStatusVbox;
  GtkWidget *hbox90;
  GtkWidget *FileStatus1;
  GSList *FileStatus1_group = NULL;
  GtkWidget *hbox91;
  GtkWidget *FileStatus2;
  GtkWidget *hbox92;
  GtkWidget *FileStatus3;
  GtkWidget *label180;
  GtkWidget *hbox93;
  GtkWidget *RecordHintTrackButton;
  GtkWidget *hbox94;
  GtkWidget *OptimizeMP4FileButton;
  GtkWidget *hbox95;
  GtkWidget *RecordRawDataButton;
  GtkWidget *RawFileName;
  GtkWidget *RawFileNameBrowse;
  GtkWidget *alignment26;
  GtkWidget *hbox96;
  GtkWidget *image26;
  GtkWidget *label181;
  GtkWidget *label171;
  GtkWidget *dialog_action_area8;
  GtkWidget *cancelbutton6;
  GtkWidget *okbutton8;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new();

  PreferencesDialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(PreferencesDialog), _("Preferences"));
  gtk_window_set_modal(GTK_WINDOW(PreferencesDialog), TRUE);
  gtk_window_set_resizable(GTK_WINDOW(PreferencesDialog), FALSE);
  gtk_window_set_transient_for(GTK_WINDOW(PreferencesDialog), 
			       GTK_WINDOW(MainWindow));

  dialog_vbox9 = GTK_DIALOG(PreferencesDialog)->vbox;
  gtk_widget_show(dialog_vbox9);

  notebook1 = gtk_notebook_new();
  gtk_widget_show(notebook1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox9), notebook1, TRUE, TRUE, 0);

  GenericTable = gtk_table_new(4, 2, FALSE);
  gtk_widget_show(GenericTable);
  gtk_container_add(GTK_CONTAINER(notebook1), GenericTable);
  gtk_table_set_row_spacings(GTK_TABLE(GenericTable), 9);
  gtk_table_set_col_spacings(GTK_TABLE(GenericTable), 36);

  label173 = gtk_label_new(_("Log Level"));
  gtk_widget_show(label173);
  gtk_table_attach(GTK_TABLE(GenericTable), label173, 0, 1, 1, 2,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(label173), 0, 0.5);

  LogLevelSpinner_adj = gtk_adjustment_new(MyConfig->GetIntegerValue(CONFIG_APP_LOGLEVEL),
					    0, 7, 1, 10, 10);
  LogLevelSpinner = gtk_spin_button_new(GTK_ADJUSTMENT(LogLevelSpinner_adj), 1, 0);
  gtk_widget_show(LogLevelSpinner);
  gtk_table_attach(GTK_TABLE(GenericTable), LogLevelSpinner, 1, 2, 1, 2,
                   (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);

  DebugCheckButton = gtk_check_button_new_with_mnemonic(_("Debug"));
  gtk_widget_show(DebugCheckButton);
  gtk_table_attach(GTK_TABLE(GenericTable), DebugCheckButton, 0, 2, 0, 1,
                   (GtkAttachOptions)(0),
                   (GtkAttachOptions)(0), 0, 0);

  label174 = gtk_label_new(_("Stream Directory"));
  gtk_widget_show(label174);
  gtk_table_attach(GTK_TABLE(GenericTable), label174, 0, 1, 2, 3,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(label174), 0, 0.5);

  StreamDirectoryHbox = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(StreamDirectoryHbox);
  gtk_table_attach(GTK_TABLE(GenericTable), StreamDirectoryHbox, 1, 2, 2, 3,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(GTK_FILL), 0, 0);

  StreamDirectory = gtk_entry_new();
  gtk_widget_show(StreamDirectory);
  gtk_box_pack_start(GTK_BOX(StreamDirectoryHbox), StreamDirectory, TRUE, TRUE, 0);

  StreamDirectoryButton = gtk_button_new();
  gtk_widget_show(StreamDirectoryButton);
  gtk_box_pack_start(GTK_BOX(StreamDirectoryHbox), StreamDirectoryButton, FALSE, FALSE, 0);

  alignment24 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment24);
  gtk_container_add(GTK_CONTAINER(StreamDirectoryButton), alignment24);

  hbox84 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox84);
  gtk_container_add(GTK_CONTAINER(alignment24), hbox84);

  image24 = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image24);
  gtk_box_pack_start(GTK_BOX(hbox84), image24, FALSE, FALSE, 0);

  label175 = gtk_label_new_with_mnemonic(_("Browse"));
  gtk_widget_show(label175);
  gtk_box_pack_start(GTK_BOX(hbox84), label175, FALSE, FALSE, 0);

  label176 = gtk_label_new(_("Profiles Directory"));
  gtk_widget_show(label176);
  gtk_table_attach(GTK_TABLE(GenericTable), label176, 0, 1, 3, 4,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(label176), 0, 0.5);

  ProfileDirectoryHbox = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(ProfileDirectoryHbox);
  gtk_table_attach(GTK_TABLE(GenericTable), ProfileDirectoryHbox, 1, 2, 3, 4,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(GTK_FILL), 0, 0);

  ProfileDirectory = gtk_entry_new();
  gtk_widget_show(ProfileDirectory);
  gtk_box_pack_start(GTK_BOX(ProfileDirectoryHbox), ProfileDirectory, TRUE, TRUE, 0);

  ProfileDirectoryButton = gtk_button_new();
  gtk_widget_show(ProfileDirectoryButton);
  gtk_box_pack_start(GTK_BOX(ProfileDirectoryHbox), ProfileDirectoryButton, FALSE, FALSE, 0);

  alignment25 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment25);
  gtk_container_add(GTK_CONTAINER(ProfileDirectoryButton), alignment25);

  hbox86 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox86);
  gtk_container_add(GTK_CONTAINER(alignment25), hbox86);

  image25 = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image25);
  gtk_box_pack_start(GTK_BOX(hbox86), image25, FALSE, FALSE, 0);

  label177 = gtk_label_new_with_mnemonic(_("Browse"));
  gtk_widget_show(label177);
  gtk_box_pack_start(GTK_BOX(hbox86), label177, FALSE, FALSE, 0);

  label169 = gtk_label_new(_("Generic"));
  gtk_widget_show(label169);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 0), label169);

  NetworkVbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(NetworkVbox);
  gtk_container_add(GTK_CONTAINER(notebook1), NetworkVbox);

  NetworkTable = gtk_table_new(2, 2, TRUE);
  gtk_widget_show(NetworkTable);
  gtk_box_pack_start(GTK_BOX(NetworkVbox), NetworkTable, FALSE, TRUE, 6);
  gtk_table_set_row_spacings(GTK_TABLE(NetworkTable), 7);

  label178 = gtk_label_new(_("Multicast TTL"));
  gtk_widget_show(label178);
  gtk_table_attach(GTK_TABLE(NetworkTable), label178, 0, 1, 0, 1,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(label178), 0, 0.5);

  label179 = gtk_label_new(_("MTU"));
  gtk_widget_show(label179);
  gtk_table_attach(GTK_TABLE(NetworkTable), label179, 0, 1, 1, 2,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(label179), 0, 0.5);

  MulticastTtlMenu = gtk_option_menu_new();
  gtk_widget_show(MulticastTtlMenu);
  gtk_table_attach(GTK_TABLE(NetworkTable), MulticastTtlMenu, 1, 2, 0, 1,
                   (GtkAttachOptions)(GTK_FILL),
                   (GtkAttachOptions)(0), 0, 0);

  menu16 = gtk_menu_new();

  ttl_lan = gtk_menu_item_new_with_mnemonic(_("LAN - 1"));
  gtk_widget_show(ttl_lan);
  gtk_container_add(GTK_CONTAINER(menu16), ttl_lan);

  ttl_organization = gtk_menu_item_new_with_mnemonic(_("Organization - 15"));
  gtk_widget_show(ttl_organization);
  gtk_container_add(GTK_CONTAINER(menu16), ttl_organization);

  ttl_regional = gtk_menu_item_new_with_mnemonic(_("Regional - 63"));
  gtk_widget_show(ttl_regional);
  gtk_container_add(GTK_CONTAINER(menu16), ttl_regional);

  ttl_worldwide = gtk_menu_item_new_with_mnemonic(_("Worldwide -127"));
  gtk_widget_show(ttl_worldwide);
  gtk_container_add(GTK_CONTAINER(menu16), ttl_worldwide);

  gtk_option_menu_set_menu(GTK_OPTION_MENU(MulticastTtlMenu), menu16);

  MtuSpinButton_adj = 
    gtk_adjustment_new(MyConfig->GetIntegerValue(CONFIG_RTP_PAYLOAD_SIZE), 
		       256, 65535, 1, 100, 100);
  MtuSpinButton = gtk_spin_button_new(GTK_ADJUSTMENT (MtuSpinButton_adj), 1, 0);
  gtk_widget_show(MtuSpinButton);
  gtk_table_attach(GTK_TABLE (NetworkTable), MtuSpinButton, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON (MtuSpinButton), TRUE);

  vbox39 = gtk_vbox_new(FALSE, 4);
  gtk_widget_show(vbox39);
  gtk_box_pack_start(GTK_BOX(NetworkVbox), vbox39, FALSE, FALSE, 5);

  hbox89 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox89);
  gtk_box_pack_start(GTK_BOX(vbox39), hbox89, TRUE, TRUE, 4);

  AllowRtcpCheck = gtk_check_button_new_with_mnemonic(_("Allow Clients to Send RTCP"));
  gtk_widget_show(AllowRtcpCheck);
  gtk_box_pack_start(GTK_BOX(hbox89), AllowRtcpCheck, FALSE, FALSE, 94);
  gtk_tooltips_set_tip(tooltips, AllowRtcpCheck, _("Allow clients to send RTCP - default off"), NULL);

  hbox87 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox87);
  gtk_box_pack_start(GTK_BOX(vbox39), hbox87, TRUE, TRUE, 0);

  AllowSSMCheck = gtk_check_button_new_with_mnemonic(_("Use Single Source Multicast"));
  gtk_widget_show(AllowSSMCheck);
  gtk_box_pack_start(GTK_BOX(hbox87), AllowSSMCheck, TRUE, FALSE, 0);
  gtk_widget_set_sensitive(AllowSSMCheck, FALSE);

  label170 = gtk_label_new(_("Network Settings"));
  gtk_widget_show(label170);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 1), label170);

  MP4FileSettingsVbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(MP4FileSettingsVbox);
  gtk_container_add(GTK_CONTAINER(notebook1), MP4FileSettingsVbox);
  gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(notebook1), MP4FileSettingsVbox,
                                      FALSE, FALSE, GTK_PACK_START);

  FileStatusFrame = gtk_frame_new(NULL);
  gtk_widget_show(FileStatusFrame);
  gtk_box_pack_start(GTK_BOX(MP4FileSettingsVbox), FileStatusFrame, TRUE, TRUE, 0);

  FileStatusVbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(FileStatusVbox);
  gtk_container_add(GTK_CONTAINER(FileStatusFrame), FileStatusVbox);

  hbox90 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox90);
  gtk_box_pack_start(GTK_BOX(FileStatusVbox), hbox90, TRUE, TRUE, 0);

  FileStatus1 = gtk_radio_button_new_with_mnemonic(NULL, _("Always overwrite existing file"));
  gtk_widget_show(FileStatus1);
  gtk_box_pack_start(GTK_BOX(hbox90), FileStatus1, TRUE, TRUE, 46);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(FileStatus1), FileStatus1_group);
  FileStatus1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileStatus1));

  hbox91 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox91);
  gtk_box_pack_start(GTK_BOX(FileStatusVbox), hbox91, FALSE, FALSE, 0);

  FileStatus2 = gtk_radio_button_new_with_mnemonic(NULL, _("Append to file"));
  gtk_widget_show(FileStatus2);
  gtk_box_pack_start(GTK_BOX(hbox91), FileStatus2, TRUE, TRUE, 46);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(FileStatus2), FileStatus1_group);
  FileStatus1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileStatus2));

  hbox92 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox92);
  gtk_box_pack_start(GTK_BOX(FileStatusVbox), hbox92, FALSE, FALSE, 0);

  FileStatus3 = gtk_radio_button_new_with_mnemonic(NULL, _("Create new file based on name"));
  gtk_widget_show(FileStatus3);
  gtk_box_pack_start(GTK_BOX(hbox92), FileStatus3, FALSE, FALSE, 46);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(FileStatus3), FileStatus1_group);
  FileStatus1_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileStatus3));

  label180 = gtk_label_new(_("File Status"));
  gtk_widget_show(label180);
  gtk_frame_set_label_widget(GTK_FRAME(FileStatusFrame), label180);

  hbox93 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox93);
  gtk_box_pack_start(GTK_BOX(MP4FileSettingsVbox), hbox93, TRUE, TRUE, 4);

  RecordHintTrackButton = gtk_check_button_new_with_mnemonic(_("Record Hint Tracks when Finished"));
  gtk_widget_show(RecordHintTrackButton);
  gtk_box_pack_start(GTK_BOX(hbox93), RecordHintTrackButton, TRUE, FALSE, 0);
  gtk_tooltips_set_tip(tooltips, RecordHintTrackButton, _("If set, this can cause application to appear to freeze when finished"), NULL);

  hbox94 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox94);
  gtk_box_pack_start(GTK_BOX(MP4FileSettingsVbox), hbox94, TRUE, TRUE, 4);

  OptimizeMP4FileButton = gtk_check_button_new_with_mnemonic(_("Optimize When Finished"));
  gtk_widget_show(OptimizeMP4FileButton);
  gtk_box_pack_start(GTK_BOX(hbox94), OptimizeMP4FileButton, FALSE, FALSE, 79);

  hbox95 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox95);
  gtk_box_pack_start(GTK_BOX(MP4FileSettingsVbox), hbox95, TRUE, TRUE, 0);

  RecordRawDataButton = gtk_check_button_new_with_mnemonic(_("Record Raw Data "));
  gtk_widget_show(RecordRawDataButton);
  gtk_box_pack_start(GTK_BOX(hbox95), RecordRawDataButton, FALSE, FALSE, 0);

  RawFileName = gtk_entry_new();
  gtk_widget_show(RawFileName);
  gtk_box_pack_start(GTK_BOX(hbox95), RawFileName, TRUE, TRUE, 0);
  gtk_tooltips_set_tip(tooltips, RawFileName, _("Raw Data MP4 File Name"), NULL);

  RawFileNameBrowse = gtk_button_new();
  gtk_widget_show(RawFileNameBrowse);
  gtk_box_pack_start(GTK_BOX(hbox95), RawFileNameBrowse, FALSE, FALSE, 0);

  alignment26 = gtk_alignment_new(0.5, 0.5, 0, 0);
  gtk_widget_show(alignment26);
  gtk_container_add(GTK_CONTAINER(RawFileNameBrowse), alignment26);

  hbox96 = gtk_hbox_new(FALSE, 2);
  gtk_widget_show(hbox96);
  gtk_container_add(GTK_CONTAINER(alignment26), hbox96);

  image26 = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show(image26);
  gtk_box_pack_start(GTK_BOX(hbox96), image26, FALSE, FALSE, 0);

  label181 = gtk_label_new_with_mnemonic(_("Browse"));
  gtk_widget_show(label181);
  gtk_box_pack_start(GTK_BOX(hbox96), label181, FALSE, FALSE, 0);

  label171 = gtk_label_new(_("MP4 File Settings"));
  gtk_widget_show(label171);
  gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook1), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook1), 2), label171);

  dialog_action_area8 = GTK_DIALOG(PreferencesDialog)->action_area;
  gtk_widget_show(dialog_action_area8);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area8), GTK_BUTTONBOX_END);

  cancelbutton6 = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton6);
  gtk_dialog_add_action_widget(GTK_DIALOG(PreferencesDialog), cancelbutton6, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS(cancelbutton6, GTK_CAN_DEFAULT);

  okbutton8 = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton8);
  gtk_dialog_add_action_widget(GTK_DIALOG(PreferencesDialog), okbutton8, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS(okbutton8, GTK_CAN_DEFAULT);

  g_signal_connect((gpointer) PreferencesDialog, "response",
                    G_CALLBACK(on_PreferencesDialog_response),
                    NULL);
  g_signal_connect((gpointer)StreamDirectoryButton, "clicked",
		   G_CALLBACK(on_stream_directory_clicked), 
		   PreferencesDialog);
  g_signal_connect((gpointer)ProfileDirectoryButton, "clicked",
		   G_CALLBACK(on_profile_directory_clicked), 
		   PreferencesDialog);

  g_signal_connect((gpointer)RawFileNameBrowse, "clicked",
		   G_CALLBACK(on_raw_file_clicked),
		   PreferencesDialog);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF(PreferencesDialog, PreferencesDialog, "PreferencesDialog");
  GLADE_HOOKUP_OBJECT_NO_REF(PreferencesDialog, dialog_vbox9, "dialog_vbox9");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, notebook1, "notebook1");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, GenericTable, "GenericTable");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label173, "label173");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, LogLevelSpinner, "LogLevelSpinner");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, DebugCheckButton, "DebugCheckButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label174, "label174");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, StreamDirectoryHbox, "StreamDirectoryHbox");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, StreamDirectory, "StreamDirectory");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, StreamDirectoryButton, "StreamDirectoryButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, alignment24, "alignment24");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox84, "hbox84");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, image24, "image24");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label175, "label175");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label176, "label176");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ProfileDirectoryHbox, "ProfileDirectoryHbox");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ProfileDirectory, "ProfileDirectory");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ProfileDirectoryButton, "ProfileDirectoryButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, alignment25, "alignment25");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox86, "hbox86");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, image25, "image25");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label177, "label177");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label169, "label169");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, NetworkVbox, "NetworkVbox");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, NetworkTable, "NetworkTable");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label178, "label178");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label179, "label179");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, MulticastTtlMenu, "MulticastTtlMenu");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, menu16, "menu16");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ttl_lan, "ttl_lan");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ttl_organization, "ttl_organization");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ttl_regional, "ttl_regional");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, ttl_worldwide, "ttl_worldwide");
  GLADE_HOOKUP_OBJECT (PreferencesDialog, MtuSpinButton, "MtuSpinButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, vbox39, "vbox39");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox89, "hbox89");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, AllowRtcpCheck, "AllowRtcpCheck");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox87, "hbox87");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, AllowSSMCheck, "AllowSSMCheck");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label170, "label170");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, MP4FileSettingsVbox, "MP4FileSettingsVbox");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, FileStatusFrame, "FileStatusFrame");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, FileStatusVbox, "FileStatusVbox");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox90, "hbox90");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, FileStatus1, "FileStatus1");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox91, "hbox91");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, FileStatus2, "FileStatus2");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox92, "hbox92");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, FileStatus3, "FileStatus3");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label180, "label180");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox93, "hbox93");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, RecordHintTrackButton, "RecordHintTrackButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox94, "hbox94");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, OptimizeMP4FileButton, "OptimizeMP4FileButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox95, "hbox95");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, RecordRawDataButton, "RecordRawDataButton");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, RawFileName, "RawFileName");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, RawFileNameBrowse, "RawFileNameBrowse");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, alignment26, "alignment26");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, hbox96, "hbox96");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, image26, "image26");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label181, "label181");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, label171, "label171");
  GLADE_HOOKUP_OBJECT_NO_REF(PreferencesDialog, dialog_action_area8, "dialog_action_area8");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, cancelbutton6, "cancelbutton6");
  GLADE_HOOKUP_OBJECT(PreferencesDialog, okbutton8, "okbutton8");
  GLADE_HOOKUP_OBJECT_NO_REF(PreferencesDialog, tooltips, "tooltips");

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(DebugCheckButton),
			       MyConfig->GetBoolValue(CONFIG_APP_DEBUG));

  const char *dir;
  char dirname[PATH_MAX];
  dir = MyConfig->GetStringValue(CONFIG_APP_STREAM_DIRECTORY);
  if (dir != NULL) {
    gtk_entry_set_text(GTK_ENTRY(StreamDirectory), dir);
  } else {
    GetHomeDirectory(dirname);
    strcat(dirname, ".mp4live_d/Streams/");
    gtk_entry_set_text(GTK_ENTRY(StreamDirectory), dirname);
  }
  dir = MyConfig->GetStringValue(CONFIG_APP_PROFILE_DIRECTORY);
  if (dir != NULL) {
    gtk_entry_set_text(GTK_ENTRY(ProfileDirectory), dir);
  } else {
    GetHomeDirectory(dirname);
    strcat(dirname, ".mp4live_d/");
    gtk_entry_set_text(GTK_ENTRY(ProfileDirectory), dirname);
  }

  uint ttl = MyConfig->GetIntegerValue(CONFIG_RTP_MCAST_TTL);
  uint index;
  if (ttl <= 1) {
    index = 0;
  } else if (ttl <= 15) {
    index = 1;
  } else if (ttl <= 64) {
    index = 2;
  } else 
    index = 3;
  gtk_option_menu_set_history(GTK_OPTION_MENU(MulticastTtlMenu), index);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(AllowRtcpCheck),
			       MyConfig->GetBoolValue(CONFIG_RTP_NO_B_RR_0));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(AllowSSMCheck),
			       MyConfig->GetBoolValue(CONFIG_RTP_USE_SSM));

  uint fstatus = MyConfig->GetIntegerValue(CONFIG_RECORD_MP4_FILE_STATUS);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileStatus1),
			       fstatus == FILE_MP4_OVERWRITE);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileStatus2),
			       fstatus == FILE_MP4_APPEND);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileStatus3),
			       fstatus == FILE_MP4_CREATE_NEW);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(RecordHintTrackButton),
			       MyConfig->GetBoolValue(CONFIG_RECORD_MP4_HINT_TRACKS));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(OptimizeMP4FileButton),
			       MyConfig->GetBoolValue(CONFIG_RECORD_MP4_OPTIMIZE));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(RecordRawDataButton),
			       MyConfig->GetBoolValue(CONFIG_RECORD_RAW_IN_MP4));
  gtk_entry_set_text(GTK_ENTRY(RawFileName), 
		     MyConfig->GetStringValue(CONFIG_RECORD_RAW_MP4_FILE_NAME));

  gtk_widget_show(PreferencesDialog);
}
Exemple #25
0
GtkWidget *
build_main_frame(ASFileBrowserMainFrame *data)
{
	GtkWidget *h_paned ; 
	GtkWidget *v_paned ; 
	GtkWidget *view_tabs ;
	GtkWidget *view_image, *view_xml ;
	GtkWidget *view_text ;
	GtkWidget *view_hex ;
	GtkWidget *dirlist ;
	GtkWidget *filelist ;
	GtkWidget *frame = gtk_frame_new( NULL );
	
	h_paned = gtk_hpaned_new();
	gtk_container_add (GTK_CONTAINER (frame), h_paned);
	
	v_paned = gtk_vpaned_new();
	gtk_paned_add1 (GTK_PANED (h_paned), v_paned);

	view_tabs = gtk_notebook_new();
	gtk_paned_add2 (GTK_PANED (h_paned), view_tabs);
	
	view_image = asgtk_image_view_new();
	gtk_widget_set_size_request (view_image, PREVIEW_WIDTH, PREVIEW_HEIGHT);
	asgtk_image_view_set_resize ( ASGTK_IMAGE_VIEW(view_image), 0/*ASGTK_IMAGE_VIEW_SCALE_TO_VIEW*/, ASGTK_IMAGE_VIEW_RESIZE_ALL );
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_image, gtk_label_new("AS image"));
	

	view_xml = asgtk_xml_view_new();
	gtk_widget_set_size_request (view_xml, PREVIEW_WIDTH, PREVIEW_HEIGHT);
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_xml, gtk_label_new("AS XML"));

	view_text = asgtk_text_view_new(data);
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_text, gtk_label_new("AS text"));

	view_hex = asgtk_hex_view_new(data );
	gtk_notebook_append_page (GTK_NOTEBOOK (view_tabs), view_hex, gtk_label_new("AS hex"));

	gtk_widget_show_all (view_tabs);

	dirlist = asgtk_dir_tree_new();
	gtk_widget_set_size_request (dirlist, DIR_TREE_WIDTH, DIR_TREE_HEIGHT);
	gtk_paned_add1 (GTK_PANED (v_paned), dirlist);

	filelist = asgtk_image_dir_new();
	asgtk_image_dir_set_columns( ASGTK_IMAGE_DIR(filelist), 
									ASGTK_ImageDir_Col_Name|
									ASGTK_ImageDir_Col_Type|
									ASGTK_ImageDir_Col_Size|
									ASGTK_ImageDir_Col_Date );
	asgtk_image_dir_set_list_all( ASGTK_IMAGE_DIR(filelist), True );
	gtk_widget_set_size_request (filelist, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
	gtk_paned_add2 (GTK_PANED (v_paned), filelist);

	gtk_widget_show_all (v_paned);
	gtk_widget_show_all (h_paned);
	gtk_widget_show (h_paned);
	
	colorize_gtk_widget( frame, get_colorschemed_style_normal() );
	
	data->view_tabs = view_tabs ;
	data->view_image= view_image ;
	data->view_xml  = view_xml ;
	data->view_hex  = view_hex ;
	data->dirlist   = dirlist ;
	data->filelist  = filelist ;
	
	asgtk_dir_tree_set_sel_handler(ASGTK_DIR_TREE(dirlist), dir_tree_sel_handler, data);
	asgtk_image_dir_set_sel_handler( ASGTK_IMAGE_DIR(filelist), filelist_sel_handler, data);

	data->text_buffer = gtk_text_buffer_new(NULL); 
 

	return frame;
}
int
main (int argc, char **argv)
{
    GdkScreen *screen;
    GtkWidget *nb;
    GtkWidget *general_vbox;
    GtkWidget *behaviour_vbox;
    GtkWidget *placement_vbox;
    GtkWidget *widget;
    GtkWidget *vbox;
    GtkWidget *vbox1;
    GtkWidget *hbox;
    GtkWidget *hbox1;
    GtkWidget *hbox2;
    GtkWidget *hbox3;
    GtkWidget *content_area;
    gchar *str;
    const char *current_wm;
    int i;

    bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);

    gtk_init (&argc, &argv);

    screen = gdk_display_get_default_screen (gdk_display_get_default ());
    current_wm = gdk_x11_screen_get_window_manager_name (screen);

    if (g_strcmp0 (current_wm, WM_COMMON_METACITY) == 0) {
        mate_metacity_config_tool ();
        return 0;
    }

    if (g_strcmp0 (current_wm, WM_COMMON_MARCO) != 0) {
        wm_unsupported ();
        return 1;
    }

    marco_settings = g_settings_new (MARCO_SCHEMA);

    /* Window */
    dialog_win = gtk_dialog_new_with_buttons (_("Window Preferences"),
                                              NULL,
                                              GTK_DIALOG_MODAL,
                                              GTK_STOCK_HELP,
                                              GTK_RESPONSE_HELP,
                                              GTK_STOCK_CLOSE,
                                              GTK_RESPONSE_CLOSE,
                                              NULL);
    //gtk_window_set_resizable (GTK_WINDOW (dialog_win), FALSE);
    gtk_window_set_icon_name (GTK_WINDOW (dialog_win), "preferences-system-windows");
    gtk_container_set_border_width (GTK_CONTAINER (dialog_win), 10);

    nb = gtk_notebook_new ();

    general_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    behaviour_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    placement_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

    widget = gtk_label_new (_("General"));
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_pack_start (GTK_BOX (hbox), general_vbox, FALSE, FALSE, 6);
    gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);

    widget = gtk_label_new (_("Behaviour"));
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_pack_start (GTK_BOX (hbox), behaviour_vbox, FALSE, FALSE, 6);
    gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);

    widget = gtk_label_new (_("Placement"));
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_pack_start (GTK_BOX (hbox), placement_vbox, FALSE, FALSE, 6);
    gtk_notebook_append_page (GTK_NOTEBOOK (nb), hbox, widget);

    /* Compositing manager */
    widget = title_label_new (N_("Compositing Manager"));
    gtk_box_pack_start (GTK_BOX (general_vbox), widget, FALSE, FALSE, 6);

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    compositing_checkbutton = gtk_check_button_new_with_mnemonic (_("Enable software _compositing window manager"));
    compositing_fast_alt_tab_checkbutton = gtk_check_button_new_with_mnemonic (_("Disable _thumbnails in Alt-Tab"));
    gtk_box_pack_start (GTK_BOX (vbox), compositing_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (hbox1), compositing_fast_alt_tab_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (vbox), hbox1, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (general_vbox), hbox, FALSE, FALSE, 6);

    /* Titlebar buttons */
    widget = title_label_new (N_("Titlebar Buttons"));
    gtk_box_pack_start (GTK_BOX (general_vbox), widget, FALSE, FALSE, 6);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    widget = gtk_label_new (_("Position:"));
    gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
    titlebar_layout_optionmenu = gtk_combo_box_text_new ();
    gtk_box_pack_start (GTK_BOX (hbox), titlebar_layout_optionmenu, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (general_vbox), hbox, FALSE, FALSE, 6);

    /* New Windows */
    widget = title_label_new (N_("New Windows"));
    gtk_box_pack_start (GTK_BOX (placement_vbox), widget, FALSE, FALSE, 6);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    center_new_windows_checkbutton = gtk_check_button_new_with_mnemonic (_("Center _new windows"));
    gtk_box_pack_start (GTK_BOX (hbox), center_new_windows_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (placement_vbox), hbox, FALSE, FALSE, 6);

    /* Window Snapping */
    widget = title_label_new (N_("Window Snapping"));
    gtk_box_pack_start (GTK_BOX (placement_vbox), widget, FALSE, FALSE, 6);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    side_by_side_tiling_checkbutton = gtk_check_button_new_with_mnemonic (_("Enable side by side _tiling"));
    gtk_box_pack_start (GTK_BOX (hbox), side_by_side_tiling_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (placement_vbox), hbox, FALSE, FALSE, 6);

    /* Window Selection */
    widget = title_label_new (N_("Window Selection"));
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    hbox3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    focus_mode_checkbutton = gtk_check_button_new_with_mnemonic (_("_Select windows when the mouse moves over them"));
    gtk_box_pack_start (GTK_BOX (vbox), focus_mode_checkbutton, FALSE, FALSE, 6);

    focus_mode_mouse_checkbutton = gtk_check_button_new_with_mnemonic (_("U_nselect windows when the mouse leaves them"));
    gtk_box_pack_start (GTK_BOX (hbox1), focus_mode_mouse_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 6);

    autoraise_checkbutton = gtk_check_button_new_with_mnemonic (_("_Raise selected windows after an interval"));
    gtk_box_pack_start (GTK_BOX (hbox2), autoraise_checkbutton, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 6);

    autoraise_delay_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    autoraise_delay_slider = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 10, 0.2);

    widget = gtk_label_new_with_mnemonic (_("_Interval before raising:"));
    gtk_box_pack_start (GTK_BOX (autoraise_delay_hbox), widget, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (autoraise_delay_hbox), autoraise_delay_slider, TRUE, TRUE, 6);
    gtk_label_set_mnemonic_widget (GTK_LABEL (widget), autoraise_delay_slider);
    widget = gtk_label_new (_("seconds"));
    gtk_range_set_increments (GTK_RANGE (autoraise_delay_slider), 0.2, 1.0);
    gtk_box_pack_start (GTK_BOX (autoraise_delay_hbox), widget, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (vbox1), autoraise_delay_hbox, FALSE, FALSE, 6);

    gtk_box_pack_start (GTK_BOX (hbox3), vbox1, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (vbox), hbox3, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), hbox, FALSE, FALSE, 6);

    /* Titlebar Action */
    widget = title_label_new (N_("Titlebar Action"));
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    widget = gtk_label_new_with_mnemonic (_("_Double-click titlebar to perform this action:"));
    gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 6);
    double_click_titlebar_optionmenu = gtk_combo_box_text_new ();
    gtk_label_set_mnemonic_widget (GTK_LABEL (widget), double_click_titlebar_optionmenu);
    gtk_box_pack_start (GTK_BOX (hbox), double_click_titlebar_optionmenu, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), hbox, FALSE, FALSE, 6);

    /* Movement Key */
    widget = title_label_new (N_("Movement Key"));
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), widget, FALSE, FALSE, 6);

    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

    widget = gtk_label_new_with_mnemonic (_("To move a window, press-and-hold this key then grab the window:"));
#if GTK_CHECK_VERSION (3, 16, 0)
    gtk_label_set_xalign (GTK_LABEL (widget), 0.0);
    gtk_label_set_yalign (GTK_LABEL (widget), 0.0);
#else
    gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0);
#endif
    gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 6);

    alt_click_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    gtk_label_set_mnemonic_widget (GTK_LABEL (widget), alt_click_vbox);
    gtk_box_pack_start (GTK_BOX (vbox), alt_click_vbox, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 6);
    gtk_box_pack_start (GTK_BOX (behaviour_vbox), hbox, FALSE, FALSE, 6);

    reload_mouse_modifiers ();

    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (titlebar_layout_optionmenu), _("Right"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (titlebar_layout_optionmenu), _("Left"));
    str = g_settings_get_string (marco_settings, MARCO_BUTTON_LAYOUT_KEY);
    gtk_combo_box_set_active (GTK_COMBO_BOX (titlebar_layout_optionmenu),
                              g_strcmp0 (str, MARCO_BUTTON_LAYOUT_RIGHT) == 0 ? 0 : 1);
    g_free (str);

    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("Roll up"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("Maximize"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("Maximize Horizontally"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("Maximize Vertically"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("Minimize"));
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (double_click_titlebar_optionmenu), _("None"));
    gtk_combo_box_set_active (GTK_COMBO_BOX (double_click_titlebar_optionmenu),
                              g_settings_get_enum (marco_settings, MARCO_DOUBLE_CLICK_TITLEBAR_KEY));

    set_alt_click_value ();
    gtk_range_set_value (GTK_RANGE (autoraise_delay_slider),
                         g_settings_get_int (marco_settings, MARCO_AUTORAISE_DELAY_KEY) / 1000.0);
    gtk_combo_box_set_active (GTK_COMBO_BOX (double_click_titlebar_optionmenu),
                              g_settings_get_enum (marco_settings, MARCO_DOUBLE_CLICK_TITLEBAR_KEY));

    g_signal_connect (G_OBJECT (dialog_win), "response",
                      G_CALLBACK (response_cb), NULL);

    g_signal_connect (G_OBJECT (dialog_win), "destroy",
                      G_CALLBACK (gtk_main_quit), NULL);

    g_signal_connect (marco_settings, "changed",
                      G_CALLBACK (marco_settings_changed_callback), NULL);

    g_settings_bind (marco_settings,
                     MARCO_COMPOSITING_MANAGER_KEY,
                     compositing_checkbutton,
                     "active",
                     G_SETTINGS_BIND_DEFAULT);

    g_settings_bind (marco_settings,
                     MARCO_COMPOSITING_FAST_ALT_TAB_KEY,
                     compositing_fast_alt_tab_checkbutton,
                     "active",
                     G_SETTINGS_BIND_DEFAULT);

    g_settings_bind (marco_settings,
                     MARCO_SIDE_BY_SIDE_TILING_KEY,
                     side_by_side_tiling_checkbutton,
                     "active",
                     G_SETTINGS_BIND_DEFAULT);

    g_settings_bind (marco_settings,
                     MARCO_CENTER_NEW_WINDOWS_KEY,
                     center_new_windows_checkbutton,
                     "active",
                     G_SETTINGS_BIND_DEFAULT);

    g_signal_connect (marco_settings, "changed::" MARCO_FOCUS_KEY,
                      G_CALLBACK (mouse_focus_changed_callback), NULL);
    /* Initialize the checkbox state appropriately */
    mouse_focus_changed_callback(marco_settings, MARCO_FOCUS_KEY, NULL);

    g_signal_connect (focus_mode_checkbutton, "toggled",
                      G_CALLBACK (mouse_focus_toggled_callback), NULL);
    g_signal_connect (focus_mode_mouse_checkbutton, "toggled",
                      G_CALLBACK (mouse_focus_toggled_callback), NULL);

    g_settings_bind (marco_settings,
                     MARCO_AUTORAISE_KEY,
                     autoraise_checkbutton,
                     "active",
                     G_SETTINGS_BIND_DEFAULT);

    g_signal_connect (autoraise_delay_slider, "value_changed",
                      G_CALLBACK (autoraise_delay_value_changed_callback), NULL);

    g_signal_connect (double_click_titlebar_optionmenu, "changed",
                      G_CALLBACK (double_click_titlebar_changed_callback), NULL);

    g_signal_connect (titlebar_layout_optionmenu, "changed",
                      G_CALLBACK (titlebar_layout_changed_callback), NULL);

    g_signal_connect (G_OBJECT (screen), "window_manager_changed",
                      G_CALLBACK (wm_changed_callback), NULL);

    i = 0;
    while (i < n_mouse_modifiers) {
        g_signal_connect (G_OBJECT (mouse_modifiers[i].radio), "toggled",
                          G_CALLBACK (alt_click_radio_toggled_callback),
                          &mouse_modifiers[i]);
        ++i;
    }

    /* update sensitivity */
    update_sensitivity ();

    capplet_set_icon (dialog_win, "preferences-system-windows");
    content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog_win));
    gtk_box_pack_start (GTK_BOX (content_area), nb, TRUE, TRUE, 0);
    gtk_widget_show_all (dialog_win);

    gtk_main ();

    g_object_unref (marco_settings);

    return 0;
}
Exemple #27
0
void wxMDIParentFrame::OnInternalIdle()
{
    /* if a an 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_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->m_width = m_width;
                menu_bar->m_height = wxMENU_HEIGHT;
                gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
                                    menu_bar->m_widget,
                                    0, 0, m_width, wxMENU_HEIGHT );
                menu_bar->SetInvokingWindow(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))
                    {
                        menu_bar->m_width = m_width;
                        menu_bar->m_height = wxMENU_HEIGHT;
                        gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
                                            menu_bar->m_widget,
                                            0, 0, m_width, wxMENU_HEIGHT );
                        menu_bar->SetInvokingWindow( child_frame );
                    }
                    visible_child_menu = true;
                }
                else
                {
                    if (menu_bar->Show(false))
                    {
                        menu_bar->UnsetInvokingWindow( child_frame );
                    }
                }
            }
        }

        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->UnsetInvokingWindow( this );
        }
        else
        {
            m_frameMenuBar->Show( true );
            m_frameMenuBar->SetInvokingWindow( this );

            m_frameMenuBar->m_width = m_width;
            m_frameMenuBar->m_height = wxMENU_HEIGHT;
            gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
                                m_frameMenuBar->m_widget,
                                0, 0, m_width, wxMENU_HEIGHT );
        }
    }
}
Exemple #28
0
//main takes arguments from the commandline
int main(int argc,char*argv[])
{
  GtkWidget*window;
  GtkWidget*button1,*button3,*button4,*button5,*button6,*button7,*button8,*button9,*handle;
  GtkWidget*picture1,*picture2,*label3,*label4,*label5,*label6,*label7,*label8,*label9,*label10,*label11,*label1,*label2;
  GtkWidget*box1,*box2,*box3,*box4,*box5,*box6,*box7,*box8,*box9,*picture;
  GtkWidget*image1,*image2,*image3,*image4,*image5,*image6,*image7,*image8,*image9,*lab1,*lab2,*lab3,*lab4;
  GtkWidget*hbox1,*hbox2,*hbox3,*hbox4,*hbox5,*hbox6,*hbox7,*hbox8,*hbox9,*hbox11;
  GtkWidget*vbox,*vbox1,*notebook,*fbox1,*fbox2,*fbox3,*fbox4,*pict1,*pict2,*pict3,*pict4;
  GdkColor color1,color2,color3;
  GtkWidget*but1,*but2,*but3,*but4;
  GtkWidget*img1,*img2,*img3,*img4;
   gtk_init(&argc,&argv);

   if(!gtk_init_check(&argc,&argv))
     {
       handle_err("FAILED TO INITIALIZE THE GTK LIBRARIES");
     }

    //the following creats a window
     window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
            gtk_window_set_resizable(GTK_WINDOW(window),TRUE);
            gtk_window_set_title(GTK_WINDOW(window),"GOSPEL BROWSER");
            gtk_window_maximize(GTK_WINDOW(window));
            gtk_window_present(GTK_WINDOW(window));
           gtk_container_set_border_width(GTK_CONTAINER(window),0);
      gtk_window_set_icon_from_file(GTK_WINDOW(window),"icon.jpg",NULL);
       g_signal_connect(GTK_OBJECT(window),"destroy",G_CALLBACK(Close_Window),NULL);
 //the following creats entry boxes
  entry1=gtk_entry_new();
  entry2=gtk_entry_new();
  entry3=gtk_entry_new();
  //reading a picture from the desktop
  picture1=gtk_image_new_from_file("picture.jpg");
  picture2=gtk_image_new_from_file("ogo.jpg");
 gtk_widget_set_size_request(picture1,300,100);
//creating entry boxes

  gtk_entry_set_text(GTK_ENTRY(entry1),"http//:");
  gtk_entry_set_text(GTK_ENTRY(entry2),"search");
  gtk_entry_set_text(GTK_ENTRY(entry3),"www.emmanuelTV.com");
 //the lines of code below creats images from stock
 image1=gtk_image_new_from_stock(GTK_STOCK_ADD,GTK_ICON_SIZE_MENU);
 image2=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU);
 image3=gtk_image_new_from_stock(GTK_STOCK_GO_BACK,GTK_ICON_SIZE_BUTTON);
 image4=gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD,GTK_ICON_SIZE_BUTTON);
 image5=gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_BUTTON);
 image6=gtk_image_new_from_stock(GTK_STOCK_HOME,GTK_ICON_SIZE_BUTTON);
 image7=gtk_image_new_from_file("search.jpg");
 image8=gtk_image_new_from_stock(GTK_STOCK_GO_DOWN,GTK_ICON_SIZE_BUTTON);
 image9=gtk_image_new_from_stock(GTK_STOCK_EXECUTE,GTK_ICON_SIZE_BUTTON);
//creates buttons
 button1=gtk_button_new();
 button2=gtk_button_new();
 button3=gtk_button_new();
 button4=gtk_button_new();
 button5=gtk_button_new();
 button6=gtk_button_new();
 button7=gtk_button_new();
 button8=gtk_button_new();
 button9=gtk_button_new();
 but1=gtk_button_new();
 but2=gtk_button_new();
 but3=gtk_button_new();
 but4=gtk_button_new();

//box creation
 box1=gtk_hbox_new(TRUE,0);
 box2=gtk_hbox_new(TRUE,0);
 box3=gtk_hbox_new(TRUE,0);
 box4=gtk_hbox_new(TRUE,0);
 box5=gtk_hbox_new(TRUE,0);
 box6=gtk_hbox_new(TRUE,0);
 box7=gtk_hbox_new(TRUE,0);
 box8=gtk_hbox_new(TRUE,0);
 box9=gtk_hbox_new(TRUE,0);
//the next lines adds the images to the buttons

  gtk_box_pack_start_defaults(GTK_BOX(box1),image1);
  gtk_container_add(GTK_CONTAINER(button1),box1);
  gtk_widget_show_all(button1);

  gtk_box_pack_start_defaults(GTK_BOX(box2),image2);
  gtk_widget_set_size_request(box2,10,10);
  gtk_container_add(GTK_CONTAINER(button2),box2);
  gtk_widget_show_all(button2);

  gtk_box_pack_start_defaults(GTK_BOX(box3),image3);
    gtk_widget_set_size_request(box3,5,5);
  gtk_container_add(GTK_CONTAINER(button3),box3);
  gtk_widget_show_all(button3);

  gtk_box_pack_start_defaults(GTK_BOX(box4),image4);
  gtk_widget_set_size_request(box4,5,5);
  gtk_container_add(GTK_CONTAINER(button4),box4);
  gtk_widget_show_all(button4);

  gtk_box_pack_start_defaults(GTK_BOX(box5),image5);
  gtk_widget_set_size_request(box5,5,5);
  gtk_container_add(GTK_CONTAINER(button5),box5);
  gtk_widget_show_all(button5);

  gtk_box_pack_start_defaults(GTK_BOX(box6),image6);
  gtk_widget_set_size_request(box6,5,5);

  gtk_container_add(GTK_CONTAINER(button6),box6);
  gtk_widget_show_all(button6);

  gtk_box_pack_start_defaults(GTK_BOX(box7),image7);
   gtk_widget_set_size_request(box7,5,2);

  gtk_container_add(GTK_CONTAINER(button7),box7);
  gtk_widget_show_all(button7);

  gtk_box_pack_start_defaults(GTK_BOX(box8),image8);
   gtk_widget_set_size_request(box8,5,5);

  gtk_container_add(GTK_CONTAINER(button8),box8);
  gtk_widget_show_all(button8);
 
  gtk_box_pack_start_defaults(GTK_BOX(box9),image9);
  gtk_widget_set_size_request(box9,5,5);
  gtk_container_add(GTK_CONTAINER(button9),box9);
  gtk_widget_show_all(button9);
//this creats labels to be added in to the hboxes
 label1=gtk_label_new(" ");
 label2=gtk_label_new(" ");
 label3=gtk_label_new("Gospel");
 label4=gtk_label_new("");
 label5=gtk_label_new(" ");
 label6=gtk_label_new("");
 label7=gtk_label_new(" ");
 label8=gtk_label_new(" ");
 label9=gtk_label_new(" ");
 label10=gtk_label_new(" ");
 label11=gtk_label_new(" ");
 lab1=gtk_label_new(" ");
 lab2=gtk_label_new(" ");
 lab3=gtk_label_new(" ");
 lab4=gtk_label_new(" ");



//color addiotion
 gdk_color_parse("#CA29EF",&color1);
 gdk_color_parse("#29EF2F",&color2);
 gdk_color_parse("#2951EF",&color3);
//the function below changes the color of the labels specified
 gtk_widget_modify_fg(label3,GTK_STATE_NORMAL,&color3);
/*creats hboxes abd vboxes to be added to the window*/
 
 hbox1=gtk_hbox_new(FALSE,0);
 hbox2=gtk_hbox_new(FALSE,0);
 hbox3=gtk_hbox_new(FALSE,0);
 hbox4=gtk_hbox_new(FALSE,3);
 hbox5=gtk_hbox_new(TRUE,0);
 hbox6=gtk_hbox_new(TRUE,0);
 hbox7=gtk_hbox_new(TRUE,0);
 hbox8=gtk_hbox_new(TRUE,0);
 hbox9=gtk_hbox_new(TRUE,0);
 hbox10=gtk_hbox_new(FALSE,0);
 hbox11=gtk_hbox_new(TRUE,0);

 
//vertical boxes
 vbox=gtk_vbox_new(FALSE,0);
 vbox1=gtk_vbox_new(TRUE,0);
//creating event boxes
   fbox1=gtk_hbox_new(TRUE,0);
   fbox2=gtk_hbox_new(TRUE,0);
   fbox3=gtk_hbox_new(TRUE,0);
   fbox4=gtk_hbox_new(TRUE,0);
//crating picutres
pict1=gtk_image_new_from_file("joshua.jpg");
pict2=gtk_image_new_from_file("johnson.jpg");
pict3=gtk_image_new_from_file("chris.jpg");
pict4=gtk_image_new_from_file("Duncan.jpg");
//packing the images into the the event boxes
 
 gtk_box_pack_start_defaults(GTK_BOX(fbox1),pict1);
 gtk_widget_set_size_request(fbox1,65,30);
 gtk_container_add(GTK_CONTAINER(but1),fbox1);
   gtk_widget_show_all(but1);
 gtk_box_pack_start_defaults(GTK_BOX(fbox2),pict2);
  gtk_widget_set_size_request(fbox2,65,30);

 gtk_container_add(GTK_CONTAINER(but2),fbox2);
  gtk_widget_show_all(but2);

 gtk_box_pack_start_defaults(GTK_BOX(fbox3),pict3);
  gtk_widget_set_size_request(fbox3,100,30);
 gtk_container_add(GTK_CONTAINER(but3),fbox3);
   gtk_widget_show_all(but3);

 gtk_box_pack_start_defaults(GTK_BOX(fbox4),pict4);
  gtk_widget_set_size_request(fbox4,100,30);
 gtk_container_add(GTK_CONTAINER(but4),fbox4);
    gtk_widget_show_all(but4);

//the following uses box pack function to add buttons to the hboxes

 gtk_box_pack_start_defaults(GTK_BOX(hbox1),button3);
 g_object_set(button3,"relief",GTK_RELIEF_NONE,NULL);
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),button4);
  g_object_set(button4,"relief",GTK_RELIEF_NONE,NULL);
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),entry1);
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),button5);
  g_object_set(button5,"relief",GTK_RELIEF_NONE,NULL);
  g_signal_connect(GTK_OBJECT(button5),"clicked",G_CALLBACK(button_clicked),"button5");
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),entry2);
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),button6);
  g_object_set(button6,"relief",GTK_RELIEF_NONE,NULL);
   gtk_box_pack_start_defaults(GTK_BOX(hbox1),button9);
  g_object_set(button9,"relief",GTK_RELIEF_NONE,NULL);
 g_signal_connect(GTK_OBJECT(button9),"clicked",GTK_SIGNAL_FUNC(upload_logo),"men_of_God");
 gtk_box_pack_start_defaults(GTK_BOX(hbox1),button8);
 g_object_set(button8,"relief",GTK_RELIEF_NONE,NULL);
  g_signal_connect(GTK_OBJECT(button8),"clicked",GTK_SIGNAL_FUNC(file_chooser),"download");


 gtk_widget_set_size_request(hbox1,800,1);

 gtk_box_pack_start_defaults(GTK_BOX(vbox),hbox1);


  gtk_box_pack_start_defaults(GTK_BOX(hbox9),label11);
 gtk_box_pack_start_defaults(GTK_BOX(vbox),hbox9);

 gtk_box_pack_start_defaults(GTK_BOX(hbox2),label4);
 gtk_box_pack_start_defaults(GTK_BOX(hbox2),picture1);
 gtk_box_pack_start_defaults(GTK_BOX(hbox2),label5);

  
 gtk_box_pack_start_defaults(GTK_BOX(vbox),hbox2);

 gtk_box_pack_start_defaults(GTK_BOX(hbox3),label1);
 gtk_box_pack_start_defaults(GTK_BOX(hbox3),picture2);
 gtk_box_pack_start_defaults(GTK_BOX(hbox3),entry3);
 gtk_box_pack_start_defaults(GTK_BOX(hbox3),button7);
 gtk_box_pack_start_defaults(GTK_BOX(hbox3),label2);
 gtk_box_pack_start_defaults(GTK_BOX(hbox3),label8);
 
 gtk_widget_set_size_request(button7,10,3);
 gtk_widget_set_size_request(hbox3,100,20); 
  g_object_set(button7,"relief",GTK_RELIEF_NONE,NULL);
   g_signal_connect(GTK_OBJECT(button7),"clicked",GTK_SIGNAL_FUNC(button_clicked),"button7");
 gtk_widget_set_size_request(hbox4,100,10);

 gtk_box_pack_start_defaults(GTK_BOX(vbox),hbox3);

 gtk_box_pack_start_defaults(GTK_BOX(hbox4),lab1);
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),lab3);
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),but1);
 g_object_set(but1,"relief",GTK_RELIEF_NONE,NULL);
 g_signal_connect(GTK_OBJECT(but1),"clicked",G_CALLBACK(generals_func),"Joshua");
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),but2);
   g_object_set(but2,"relief",GTK_RELIEF_NONE,NULL);
 g_signal_connect(GTK_OBJECT(but2),"clicked",G_CALLBACK(generals_func),"Johnson");
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),but3);
    g_object_set(but3,"relief",GTK_RELIEF_NONE,NULL);
 g_signal_connect(GTK_OBJECT(but3),"clicked",G_CALLBACK(generals_func),"Chris");
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),but4);
       g_object_set(but4,"relief",GTK_RELIEF_NONE,NULL);
 g_signal_connect(GTK_OBJECT(but4),"clicked",G_CALLBACK(generals_func),"Duncan");
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),lab2);
 gtk_box_pack_start_defaults(GTK_BOX(hbox4),lab4);
 
 gtk_widget_set_size_request(hbox4,100,150);
gtk_box_pack_start_defaults(GTK_BOX(vbox),hbox4);
//the following creats a notebook
 notebook=gtk_notebook_new();
 
           gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook),TRUE);
           gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_TOP);

             gtk_box_pack_start_defaults(GTK_BOX(hbox10),button2);
             g_object_set(button2,"relief",GTK_RELIEF_NONE,NULL);
                          

             gtk_box_pack_start_defaults(GTK_BOX(hbox10),label3);

             gtk_box_pack_start_defaults(GTK_BOX(hbox10),button1);
             g_object_set(button1,"relief",GTK_RELIEF_NONE,NULL);
            
               gtk_widget_show_all(hbox10);
           gtk_widget_set_size_request(hbox10,150,35);
             gtk_notebook_append_page(GTK_NOTEBOOK(notebook),vbox,hbox10);
            g_signal_connect(GTK_OBJECT(button1),"clicked",G_CALLBACK(switch_page),(gpointer)notebook);
            g_signal_connect(GTK_OBJECT(button2),"clicked",G_CALLBACK(CloseApp),(gpointer)notebook);
            

      
 gtk_rc_parse("gosple.gtkrc");

//changes the sizes of some widgets
 gtk_widget_set_size_request(entry1,750,27);
 gtk_widget_set_size_request(button3,20,10);
 gtk_widget_set_size_request(button4,20,10);
 gtk_widget_set_size_request(button5,20,10);
 gtk_widget_set_size_request(button6,20,10);
  gtk_widget_set_size_request(button8,20,10);
 gtk_widget_set_size_request(entry3,400,27);
 gtk_widget_set_size_request(entry2,200,27);

 
//adds the notebook to a contiainer
gtk_container_add(GTK_CONTAINER(window),notebook);

gtk_widget_show_all(window);
 gtk_main();
return 0;
}
Exemple #29
0
void wxMDIParentFrame::ActivatePrevious()
{
    if (m_clientWindow)
        gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
void save_as_file(GtkButton *button) {
  /** Save the current editor content as the choosen file. **/

  #ifdef DEBUG
    DEBUG_FUNC_MARK
  #endif





  GtkWidget *file_chooser = gtk_file_chooser_dialog_new( _("Save as file"),
                                                        GTK_WINDOW(gui->main_window),
                                                        GTK_FILE_CHOOSER_ACTION_SAVE,
                                                        _("Cancel"),  GTK_RESPONSE_CANCEL,
                                                        _("Save as"), GTK_RESPONSE_ACCEPT,
                                                        NULL) ;


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

  /** Storing last opened file folder. **/
  if (open_file_dirname != NULL) {
    g_free(open_file_dirname) ;
  }
  open_file_dirname = g_strdup(g_path_get_dirname(stored_filepath)) ;

  gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(file_chooser), open_file_dirname );

  gint res;

  GtkFileChooser *chooser;
  chooser = GTK_FILE_CHOOSER(file_chooser);


  gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);

  res = gtk_dialog_run(GTK_DIALOG(file_chooser)) ;

  if (res == GTK_RESPONSE_ACCEPT) {

    char *filepath ;
    filepath = gtk_file_chooser_get_filename(chooser);

    /** 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) ;


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

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

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

      free(msg) ;

      return ;

    }

    /** Mark the TextBuffer as not modfied. **/
    gtk_text_buffer_set_modified(current_editor.current_buffer, FALSE) ;

    /** Only useful if the content type has changed like a new file saved as a *.c file. **/
    GtkSourceLanguage        *source_language         = NULL ;
    GtkSourceLanguageManager *source_language_manager = gtk_source_language_manager_get_default();

    gboolean result_uncertain ;
    gchar *content_type ;

    content_type = g_content_type_guess( g_path_get_basename(filepath), (const guchar *) file_content, strlen(file_content), &result_uncertain) ;

    if (content_type && source_language_manager) {

      source_language = gtk_source_language_manager_guess_language(source_language_manager, g_path_get_basename(filepath), content_type);

      if (source_language) {

        set_syntax_highlight_radio(gtk_source_language_get_id(source_language)) ;

        gtk_source_buffer_set_language(GTK_SOURCE_BUFFER(current_editor.current_buffer), source_language) ;

        g_object_set_data(G_OBJECT(current_editor.current_textview), "lang_id", (char *) gtk_source_language_get_id(source_language)) ;
      }

      g_free(content_type) ;
    }



    /** 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 **/
        if  (g_object_get_data(G_OBJECT(tab_compound_list->data), "tab_filename_widget")) {
          /** Set the new filename in the tab. **/
          gtk_label_set_text(GTK_LABEL(tab_compound_list->data), g_path_get_basename(filepath)) ;
        }

        if  (g_object_get_data(G_OBJECT(tab_compound_list->data), "tab_icon") && source_language) {


          uint8_t c ;
          for ( c=0 ; ; c++) {
    
              if (gtk_source_language_get_mime_types(source_language) == NULL) {
     
                break ;
              }
    
              char *mimetype = gtk_source_language_get_mime_types(source_language)[c] ;

              if (mimetype == NULL) {
                  /** don't find an specific mimetype for this new file extension use default icon. **/
                  g_object_set(G_OBJECT(tab_compound_list->data),"file", PATH_TO_MIMETYPE_ICON "unknown.png", NULL) ;
                  break ;
              }

              /** We search for an image filename ending with the corresponding mimetype: **/
              char *ptr = strchr(mimetype, '/') ;

              if (ptr != NULL) {

                /** Simply pointer arithmetic to exchange the '/' (used in mimetypes) and the '-' (used in the images names) character **/
                mimetype[ptr - mimetype] = '-' ;


                gchar *filepath = g_strdup_printf("%s%s.png", PATH_TO_MIMETYPE_ICON, mimetype) ;

                if ( g_file_test(filepath, G_FILE_TEST_EXISTS) ) {
                  /** We found an corresponding image for this mimetype. **/
                  g_object_set(G_OBJECT(tab_compound_list->data),"file", filepath, NULL) ;
                  free(filepath) ;
                  break ;
                }

                free(filepath) ;

              }

          }
        }

        if (tab_compound_list->next == NULL) {
          break ;
        }

        tab_compound_list = tab_compound_list->next ;
    }

    g_free(file_content)   ;

    /** Storing filepath for further saving operations. **/
    g_object_set_data(G_OBJECT(current_editor.current_buffer), "filepath", filepath) ;

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


    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) ;
    }
   
    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) ) ;
   
    #ifdef RELOADING_FUNC
    /** Update Last modification timestamp. **/
    File_Editor *file_editor = (File_Editor *) g_object_get_data(G_OBJECT(current_editor.current_textview), "file_editor") ;
    g_stat(filepath, &file_editor->file_info) ;
    #endif
   
   

  }

  /** @NOTE: the filepath must not be free because it is set as data from the file_editor->buffer for further use. **/

  gtk_widget_destroy(file_chooser);
}