Exemple #1
0
static GtkWidget *
notebook_new(GladeXML *xml, GladeWidgetInfo *info)
{
	GtkWidget *notebook = gtk_notebook_new();
	GList *tmp;

	for (tmp = info->attributes; tmp; tmp = tmp->next) {
		GladeAttribute *attr = tmp->data;

		if (!strcmp(attr->name, "popup_enable")) {
			if (attr->value[0] == 'T')
				gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
			else
				gtk_notebook_popup_disable(GTK_NOTEBOOK(notebook));
		} else if (!strcmp(attr->name, "scrollable"))
			gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook),
						    attr->value[0] == 'T');
		else if (!strcmp(attr->name, "show_border"))
			gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook),
						     attr->value[0] == 'T');
		else if (!strcmp(attr->name, "show_tabs"))
			gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook),
						   attr->value[0] == 'T');
		else if (!strcmp(attr->name, "tab_pos"))
			gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),
				glade_enum_from_string(GTK_TYPE_POSITION_TYPE,
						       attr->value));
	}
	return notebook;
}
Exemple #2
0
static GtkWidget *get_results_window(struct gui_entry *ge)
{
	GtkWidget *win, *notebook, *vbox;

	if (ge->results_window)
		return ge->results_notebook;

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(win), "Results");
	gtk_window_set_default_size(GTK_WINDOW(win), 1024, 768);
	g_signal_connect(win, "delete-event", G_CALLBACK(results_window_delete), ge);
	g_signal_connect(win, "destroy", G_CALLBACK(results_window_delete), ge);

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(win), vbox);

	ge->results_menu = get_results_menubar(win, ge);
	gtk_box_pack_start(GTK_BOX(vbox), ge->results_menu, FALSE, FALSE, 0);

	notebook = gtk_notebook_new();
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), 1);
	gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
	gtk_container_add(GTK_CONTAINER(vbox), notebook);

	ge->results_window = win;
	ge->results_notebook = notebook;
	return ge->results_notebook;
}
Exemple #3
0
/**
 * Gets called when the Application is started, creates the main window.
 */
void activate(GtkApplication *app, gpointer user_data)
{
	GtkWidget *window;
	
	window = gtk_application_window_new(app);
	gtk_window_set_title(GTK_WINDOW(window), "PSV Kanu EFB");
	gtk_window_set_default_size(GTK_WINDOW(window), 600, 300);
	g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(on_key_pressed), NULL);
	
	GtkWidget *box_main;
	box_main = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	gtk_container_add(GTK_CONTAINER(window), box_main);
	
	GtkWidget *notebook_main;
	notebook_main = gtk_notebook_new();
	gtk_box_pack_start(GTK_BOX(box_main), notebook_main, TRUE, TRUE, 0);
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook_main), TRUE);
	gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook_main));
	
	//KALENDER
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook_main), calendar_get_instance(), gtk_label_new("Kalender"));
	gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(notebook_main), calendar_get_instance(), TRUE);
	
	//FAHRTENBUCH
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook_main), efb_get_instance(), gtk_label_new("Fahrtenbuch"));
	gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(notebook_main), efb_get_instance(), TRUE);
	
	gtk_widget_show_all(window);
}
Exemple #4
0
/* Enables the popup menu: if the user clicks with the right mouse button
 * on the bookmarks, a menu with all the pages will be popped up. */
int
clip_GTK_NOTEBOOKPOPUPENABLE(ClipMachine * cm)
{
	C_widget      *cntb = _fetch_cw_arg(cm);
	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	gtk_notebook_popup_enable(GTK_NOTEBOOK(cntb->widget));
	return 0;
err:
	return 1;
}
Exemple #5
0
void interface (gint argc, gchar *argv[])
{
  GtkWidget *MenuBar;
  GtkWidget *VBox;
  GtkWidget *HandleBox;

  gtk_set_locale();  
  gtk_init (&argc, &argv);
  Settings = init_settings ();
  MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW(MainWindow), g_strconcat
			(WELCOME_MSG, " ", APP_NAME, " ",
			 VERSION_NUMBER, NULL));
  gtk_window_set_policy (GTK_WINDOW(MainWindow), TRUE, TRUE, FALSE);
  gtk_widget_set_usize (MainWindow, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT);
  gtk_signal_connect (GTK_OBJECT(MainWindow), "delete_event",
		      (GtkSignalFunc) quit, NULL); 
  gtk_signal_connect (GTK_OBJECT(MainWindow), "destroy",
		      (GtkSignalFunc) quit, NULL);
  FileProperties = g_array_new (TRUE, FALSE, sizeof(t_fprops));
  VBox = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER(MainWindow), VBox);
  HandleBox = gtk_handle_box_new();
  gtk_container_set_border_width (GTK_CONTAINER(HandleBox), 2);
  gtk_box_pack_start (GTK_BOX(VBox), HandleBox, FALSE, FALSE, 0);
  init_toolbar (GTK_BOX(VBox));
  MainNotebook = gtk_notebook_new ();
  read_uedit_wordfile (WORDFILE);
  editor_init();
  MenuBar = menubar_new (MainWindow);
  gtk_container_add (GTK_CONTAINER(HandleBox), MenuBar);
  gtk_notebook_popup_enable (GTK_NOTEBOOK(MainNotebook));
  gtk_notebook_set_homogeneous_tabs (GTK_NOTEBOOK(MainNotebook), TRUE);
  gtk_notebook_set_scrollable (GTK_NOTEBOOK(MainNotebook), TRUE);
  gtk_box_pack_start (GTK_BOX(VBox), MainNotebook, TRUE, TRUE, 0);
  gtk_signal_connect (GTK_OBJECT(MainNotebook), "switch_page",
		      (GtkSignalFunc) set_title, NULL);
  init_msgbar (GTK_BOX(VBox));
  print_msg ("You're the welcome...");
  command_line (argc, argv);
  autosave (AUTOSAVE_DELAY);
  gtk_widget_show_all (MainWindow);
  if (!MSGBAR_DISPLAY) hide_msgbar ();
  if (!TOOLBAR_DISPLAY) hide_toolbar ();
  gtk_timeout_add (80, (GtkFunction)display_line_column, NULL);
  gtk_main ();
  set_preferences_to_disk (&Settings, NULL);
  gtk_item_factory_dump_rc (g_strconcat (g_get_home_dir (), PATH_SEP_STRING,
					 CONF_DIR, PATH_SEP_STRING,
					 "AccelRC", NULL), NULL, FALSE);
}
static void
create_sheets(GtkWidget *parent)
{
  GtkWidget *notebook;
  GtkWidget *separator;
  GSList *list;
  Sheet *sheet;
  GtkWidget *child;
  GtkWidget *label;
  GtkWidget *menu_label;

  
  separator = gtk_hseparator_new ();
  gtk_box_pack_start (GTK_BOX (parent), separator, FALSE, TRUE, 3);
  gtk_widget_show(separator);

  notebook = gtk_notebook_new ();
  /*
  gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
		      GTK_SIGNAL_FUNC (page_switch), NULL);
  */
  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
  gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
  gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook));
  gtk_container_set_border_width (GTK_CONTAINER (notebook), 1);
  gtk_box_pack_start (GTK_BOX (parent), notebook, TRUE, TRUE, 0);
  
  list = get_sheets_list();
  while (list != NULL) {
    sheet = (Sheet *) list->data;

    label = gtk_label_new(gettext(sheet->name));
    menu_label = gtk_label_new(gettext(sheet->name));
    gtk_misc_set_alignment(GTK_MISC(menu_label), 0.0, 0.5);
    
    child = create_sheet_page(notebook, sheet);
    
    gtk_widget_show(label);
    gtk_widget_show(menu_label);
    gtk_widget_show_all(child);

    gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook),
				   child, label, menu_label);
    
    list = g_slist_next(list);
  }
  
  gtk_widget_show(notebook);
}
Exemple #7
0
static void
anjuta_docman_instance_init (AnjutaDocman *docman)
{
	docman->priv = g_new0 (AnjutaDocmanPriv, 1);
/*g_new0 NULL's all content
	docman->priv->popup_menu = NULL;
	docman->priv->popup_menu_det = NULL;
	docman->priv->fileselection = NULL;
*/
	gtk_notebook_popup_enable (GTK_NOTEBOOK (docman));
	gtk_notebook_set_scrollable (GTK_NOTEBOOK (docman), TRUE);
	g_signal_connect (G_OBJECT (docman), "switch-page",
					  G_CALLBACK (on_notebook_switch_page), docman);
	/* update pages-list after re-ordering (or deleting) */
	g_signal_connect (G_OBJECT (docman), "page-reordered",
						G_CALLBACK (on_notebook_page_reordered), docman);
}
/**
 * browser_perspective_create_notebook:
 * @perspective: an object implementing the #BrowserPerspective interface
 *
 * Creates a #GtkNotebook to hold #BrowserPage widgets in each page. It handles the customization (header and tool bars)
 * when pages are toggles.
 *
 * Returns: (transfer full):  a new #GtkNotebook
 */
GtkWidget *
browser_perspective_create_notebook (BrowserPerspective *perspective)
{
	g_return_val_if_fail (IS_BROWSER_PERSPECTIVE (perspective), NULL);

	GtkWidget *nb;
	nb = gtk_notebook_new ();
	gtk_notebook_set_scrollable (GTK_NOTEBOOK (nb), TRUE);
	gtk_notebook_popup_enable (GTK_NOTEBOOK (nb));

	g_signal_connect (nb, "destroy",
			  G_CALLBACK (notebook_destroy_cb), perspective);
	g_signal_connect (nb, "switch-page",
			  G_CALLBACK (notebook_switch_page_cb), perspective);
	g_signal_connect (nb, "page-removed",
			  G_CALLBACK (notebook_remove_page_cb), perspective);

	return nb;
}
static void
gimp_color_notebook_init (GimpColorNotebook *notebook)
{
  GType *selector_types;
  guint  n_selector_types;
  guint  i;

  notebook->notebook = gtk_notebook_new ();
  gtk_box_pack_start (GTK_BOX (notebook), notebook->notebook, TRUE, TRUE, 0);
  gtk_widget_show (notebook->notebook);

  gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook->notebook));

  g_signal_connect (notebook->notebook, "switch-page",
                    G_CALLBACK (gimp_color_notebook_switch_page),
                    notebook);

  selector_types = g_type_children (GIMP_TYPE_COLOR_SELECTOR,
                                    &n_selector_types);

  if (n_selector_types == 2)
    {
      gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook->notebook), FALSE);
      gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook->notebook), FALSE);
    }

  for (i = 0; i < n_selector_types; i++)
    {
      /*  skip ourselves  */
      if (g_type_is_a (selector_types[i], GIMP_TYPE_COLOR_NOTEBOOK))
        continue;

      /*  skip the "Scales" color selector  */
      if (g_type_is_a (selector_types[i], GIMP_TYPE_COLOR_SCALES))
        continue;

      gimp_color_notebook_add_page (notebook, selector_types[i]);
    }

  g_free (selector_types);
}
Exemple #10
0
static GtkWidget*
create_notebook_with_notebooks (gchar           **labels,
                                const gchar      *group,
                                GtkPositionType   pos)
{
  GtkWidget *notebook, *title, *page;
  gint count = 0;

  notebook = gtk_notebook_new ();
  g_signal_connect (notebook, "create-window",
                    G_CALLBACK (window_creation_function), NULL);

  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), pos);
  gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
  gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
  gtk_notebook_set_group_name (GTK_NOTEBOOK (notebook), group);

  while (*labels)
    {
      page = create_notebook (labels, group, pos);
      gtk_notebook_popup_enable (GTK_NOTEBOOK (page));

      title = gtk_label_new (*labels);

      gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, title);
      gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook), page, TRUE);
      gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), page, TRUE);

      count++;
      labels++;
    }

  g_signal_connect (GTK_NOTEBOOK (notebook), "page-reordered",
                    G_CALLBACK (on_page_reordered), NULL);
  g_signal_connect_after (G_OBJECT (notebook), "drag-begin",
                          G_CALLBACK (on_notebook_drag_begin), NULL);
  return notebook;
}
Exemple #11
0
static void page_added_callback (GtkNotebook *notebook,
				 GtkWidget *child,
				 gint pgnum,
				 gpointer data)
{
    int i, np = gtk_notebook_get_n_pages(notebook);
    GtkWidget *tab;

    if (np >= 5) {
	gtk_notebook_popup_enable(notebook);
    }

    if (np > 1) {
	for (i=0; i<np; i++) {
	    tab = gtk_notebook_get_nth_page(notebook, i);
	    gtk_notebook_set_tab_detachable(notebook, tab, TRUE);
	    viewer_tab_show_closer(notebook, tab, TRUE);
	}
    } else {
	tab = gtk_notebook_get_nth_page(notebook, 0);
	viewer_tab_show_closer(notebook, tab, FALSE);
    }
}
Exemple #12
0
/*
	Display memory window
*/
GtkWidget* dbgmem_create_window(void)
{
	GladeXML *xml = NULL;
	GtkWidget *dbox;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_mem-2.glade"), "dbgmem_window",
		 PACKAGE);
	if (!xml)
		g_error("GUI loading failed !\n");
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgmem_window");
	if(options3.transient)
		gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

    notebook = glade_xml_get_widget(xml, "notebook1");
    gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
    
	notebook_add_page(notebook, "0x000000");

	return dbox;
}
Exemple #13
0
static int gtkTabsMapMethod(Ihandle* ih)
{
  ih->handle = gtk_notebook_new();
  if (!ih->handle)
    return IUP_ERROR;

  gtk_notebook_set_scrollable((GtkNotebook*)ih->handle, TRUE);
  gtk_notebook_popup_enable((GtkNotebook*)ih->handle);

  gtkTabsUpdateTabType(ih);

  /* add to the parent, all GTK controls must call this. */
  iupgtkBaseAddToParent(ih);

  gtk_widget_add_events(ih->handle, GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_NOTIFY_MASK);

  g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event",  G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event",  G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",      G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",     G_CALLBACK(iupgtkKeyPressEvent),   ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",           G_CALLBACK(iupgtkShowHelp),        ih);

  g_signal_connect(G_OBJECT(ih->handle), "switch-page",         G_CALLBACK(gtkTabSwitchPage), ih);

  gtk_widget_realize(ih->handle);

  /* Create pages and tabs */
  if (ih->firstchild)
  {
    Ihandle* child;
    for (child = ih->firstchild; child; child = child->brother)
      gtkTabsChildAddedMethod(ih, child);
  }

  return IUP_NOERROR;
}
Exemple #14
0
void
setup_toplevel_win(struct Gtkabber *gtkabber, UniqueApp *app)
{
	/* FIXME - create setup_signals() */
	gtkabber->toplevel.toplevel_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(gtkabber->toplevel.toplevel_win, "delete-event",
			gtk_main_quit, NULL);
	gtk_window_set_default_size(
			GTK_WINDOW(gtkabber->toplevel.toplevel_win),
			800, 600);

	gtkabber->toplevel.notebook = gtk_notebook_new();

	/* GtkNotebook options. */
	gtk_notebook_popup_enable(GTK_NOTEBOOK(
				gtkabber->toplevel.notebook));
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(
				gtkabber->toplevel.notebook), TRUE);
	gtk_notebook_set_tab_border(GTK_NOTEBOOK(
				gtkabber->toplevel.notebook), 1);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK(
				gtkabber->toplevel.notebook),
			GTK_POS_LEFT);

	gtk_container_add(GTK_CONTAINER(gtkabber->toplevel.toplevel_win),
			gtkabber->toplevel.notebook);

	gtk_widget_show_all(gtkabber->toplevel.toplevel_win);

	unique_app_watch_window (app, GTK_WINDOW(gtkabber->toplevel.toplevel_win));
	g_signal_connect(G_OBJECT(app), "message-received",
			G_CALLBACK(message_received_cb), (gpointer)gtkabber);

	g_signal_connect(gtkabber->toplevel.notebook, "page-removed",
			G_CALLBACK(page_removed_cb), (gpointer)gtkabber);
}
void create_mainwindow(void)
{
	char *imagename;
	GtkWidget *vbox_gs;
	GtkWidget *menu;
	GtkWidget *hbox25;
	GtkWidget *tab_button_icon;
	GtkWidget *label;
#ifndef USE_WEBKIT2
	GtkWidget *scrolledwindow;
#endif
	GtkWidget *box_book;
	GdkPixbuf *pixbuf;
	/*
	   GTK_SHADOW_NONE
	   GTK_SHADOW_IN
	   GTK_SHADOW_OUT
	   GTK_SHADOW_ETCHED_IN
	   GTK_SHADOW_ETCHED_OUT
	 */
	settings.shadow_type = GTK_SHADOW_IN;

	XI_print(("%s xiphos-%s\n", "Starting", VERSION));
	XI_print(("%s\n\n", "Building Xiphos interface"));

	widgets.studypad_dialog = NULL;

	/* A rough scektch of the main window (widgets.app) and it's children
	 *                widgets.app
	 *                     |
	 *                  vbox_gs
	 *                     |
	 *                  +--|----+
	 *                  |       |
	 *                 menu   hbox25
	 *                           |
	 *                     widgets.epaned
	 *                         |
	 *                 widgets.vboxMain
	 *                 |              |
	 *           widgets.hboxtb   widgets.page
	 *                            |         |
	 *                     widgets.hpaned  nav_toolbar
	 *                     |            |
	 *              widgets.vpaned---+  +----------------------------widgets.vpaned2---------------+
	 *               |               |                                      |                      |
	 * widgets.vbox_previewer   widgets.vbox_text              widgets.notebook_comm_book   widgets.box_dict
	 *                               |                         |                       |
	 *                widgets.notebook_bible_parallel   widgets.box_comm            box_book
	 *                               |
	 *                     widgets.notebook_text
	 *
	 */

	// The toplevel Xiphos window
	widgets.app = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(widgets.app), _("Xiphos - Bible Study Software"));
	g_object_set_data(G_OBJECT(widgets.app), "widgets.app", widgets.app);
	gtk_widget_set_size_request(widgets.app, 680, 425);
	gtk_widget_set_can_focus(widgets.app, 1);
	gtk_window_set_resizable(GTK_WINDOW(widgets.app), TRUE);

	// The app icon.
	// FIXME:: This should be a big copy of the logo because GTK does the scaling (GTK 3.16?)
	imagename = image_locator("gs2-48x48.png");
	pixbuf = gdk_pixbuf_new_from_file(imagename, NULL);
	g_free(imagename);
	gtk_window_set_icon(GTK_WINDOW(widgets.app), pixbuf);

	// The main box for our toplevel window.
	UI_VBOX(vbox_gs, FALSE, 0);
	gtk_widget_show(vbox_gs);
	gtk_container_add(GTK_CONTAINER(widgets.app), vbox_gs);

	// Add the main menu.
	menu = gui_create_main_menu();
	gtk_box_pack_start(GTK_BOX(vbox_gs), menu, FALSE, TRUE, 0);

	// Another box
	UI_HBOX(hbox25, FALSE, 0);
	gtk_widget_show(hbox25);
	gtk_box_pack_start(GTK_BOX(vbox_gs), hbox25, TRUE, TRUE, 0);

	// widgets.epaned
	widgets.epaned = UI_HPANE();
	gtk_widget_show(widgets.epaned);
#ifndef HAVE_GTK_314
	gtk_container_set_border_width(GTK_CONTAINER(widgets.epaned), 4);
#endif
	gtk_box_pack_start(GTK_BOX(hbox25), widgets.epaned, TRUE, TRUE, 0);
	// Another box
	UI_VBOX(widgets.vboxMain, FALSE, 0);
	gtk_widget_show(widgets.vboxMain);
	gtk_paned_pack2(GTK_PANED(widgets.epaned), widgets.vboxMain, TRUE, TRUE);
#ifndef HAVE_GTK_314
	gtk_container_set_border_width(GTK_CONTAINER(widgets.vboxMain), 2);
#endif

	/*
	 * Notebook to have separate passages opened at once the passages are not
	 * actually open but are switched between similar to bookmarks
	 */
	UI_HBOX(widgets.hboxtb, FALSE, 0);
	if (settings.browsing)
		gtk_widget_show(widgets.hboxtb);
	gtk_box_pack_start(GTK_BOX(widgets.vboxMain), widgets.hboxtb, FALSE, FALSE, 0);

	widgets.button_new_tab = gtk_button_new();
	// Don't show button here in case !settings.browsing

#ifdef HAVE_GTK_310
	tab_button_icon = gtk_image_new_from_icon_name("tab-new-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
#else
	tab_button_icon = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR);
#endif

	gtk_widget_show(tab_button_icon);
	gtk_container_add(GTK_CONTAINER(widgets.button_new_tab), tab_button_icon);
	gtk_button_set_relief(GTK_BUTTON(widgets.button_new_tab), GTK_RELIEF_NONE);
	gtk_box_pack_start(GTK_BOX(widgets.hboxtb), widgets.button_new_tab, FALSE, FALSE, 0);
	gtk_widget_set_tooltip_text(widgets.button_new_tab, _("Open a new tab"));

	widgets.notebook_main = gtk_notebook_new();
	gtk_widget_show(widgets.notebook_main);
	gtk_box_pack_start(GTK_BOX(widgets.hboxtb), widgets.notebook_main, TRUE, TRUE, 0);
	gtk_widget_set_size_request(widgets.notebook_main, -1, 25);
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(widgets.notebook_main), TRUE);
	gtk_notebook_popup_enable(GTK_NOTEBOOK(widgets.notebook_main));
	gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_main), FALSE);
	// Main passage tabbed notebook end

	// Another box
	UI_VBOX(widgets.page, FALSE, 0);
	gtk_widget_show(widgets.page);
	gtk_box_pack_start(GTK_BOX(widgets.vboxMain), widgets.page, TRUE, TRUE, 0);

	//nav toolbar
	nav_toolbar = gui_navbar_versekey_new();
	gtk_box_pack_start(GTK_BOX(widgets.page), nav_toolbar, FALSE, FALSE, 0);

	// widgets.hpaned
	widgets.hpaned = UI_HPANE();
	gtk_widget_show(widgets.hpaned);
	gtk_box_pack_start(GTK_BOX(widgets.page), widgets.hpaned, TRUE, TRUE, 0);

	// widgets.vpaned
	widgets.vpaned = UI_VPANE();
	gtk_widget_show(widgets.vpaned);
	gtk_widget_set_size_request(widgets.vpaned, 50, -1);
	gtk_paned_pack1(GTK_PANED(widgets.hpaned), widgets.vpaned, TRUE, FALSE);

	// widgets.vpaned2
	widgets.vpaned2 = UI_VPANE();
	gtk_widget_show(widgets.vpaned2);
	gtk_widget_set_size_request(widgets.vpaned2, 50, -1);
	gtk_paned_pack2(GTK_PANED(widgets.hpaned), widgets.vpaned2, TRUE, FALSE);

	// widgets.vbox_text
	UI_VBOX(widgets.vbox_text, FALSE, 0);
	gtk_widget_show(widgets.vbox_text);
	gtk_paned_pack1(GTK_PANED(widgets.vpaned), widgets.vbox_text, TRUE, TRUE);

	// Bible/parallel notebook
	widgets.notebook_bible_parallel = gtk_notebook_new();
	gtk_widget_show(widgets.notebook_bible_parallel);
	gtk_box_pack_start(GTK_BOX(widgets.vbox_text), widgets.notebook_bible_parallel, TRUE, TRUE, 0);
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(widgets.notebook_bible_parallel), GTK_POS_BOTTOM);
	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets.notebook_bible_parallel), TRUE);
	gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_bible_parallel), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(widgets.notebook_bible_parallel), 1);

	g_signal_connect(G_OBJECT(widgets.notebook_bible_parallel), "change-current-page", G_CALLBACK(on_notebook_bible_parallel_switch_page), NULL);

	// Text notebook (The bible text show in the standard view)
	widgets.notebook_text = gui_create_bible_pane();
	gtk_container_add(GTK_CONTAINER(widgets.notebook_bible_parallel), widgets.notebook_text);

	label = gtk_label_new(_("Standard View"));
	gtk_widget_show(label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_bible_parallel), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_bible_parallel), 0), label);

	// Another box (For the previewer?)
	UI_VBOX(widgets.vbox_previewer, FALSE, 0);
	gtk_widget_show(widgets.vbox_previewer);
	gtk_paned_pack2(GTK_PANED(widgets.vpaned), widgets.vbox_previewer, TRUE, TRUE);
	gtk_container_set_border_width(GTK_CONTAINER(widgets.vbox_previewer), 2);

#ifndef USE_WEBKIT2
	scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scrolledwindow);
	gtk_box_pack_start(GTK_BOX(widgets.vbox_previewer), scrolledwindow, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *) scrolledwindow, settings.shadow_type);
#endif
	widgets.html_previewer_text = GTK_WIDGET(XIPHOS_HTML_NEW(NULL, FALSE, VIEWER_TYPE));
	gtk_widget_show(widgets.html_previewer_text);
#ifdef USE_WEBKIT2
	gtk_box_pack_start(GTK_BOX(widgets.vbox_previewer), widgets.html_previewer_text, TRUE, TRUE, 0);
#else
	gtk_container_add(GTK_CONTAINER(scrolledwindow), widgets.html_previewer_text);
#endif

	// Commentary/book notebook
	widgets.notebook_comm_book = gtk_notebook_new();
	gtk_widget_show(widgets.notebook_comm_book);

	gtk_paned_pack1(GTK_PANED(widgets.vpaned2), widgets.notebook_comm_book, TRUE, TRUE);
	gtk_container_set_border_width(GTK_CONTAINER(widgets.notebook_comm_book), 1);

	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(widgets.notebook_comm_book), GTK_POS_BOTTOM);
	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets.notebook_comm_book), TRUE);
	gtk_notebook_set_show_border(GTK_NOTEBOOK(widgets.notebook_comm_book), FALSE);

	// Commentary pane
	widgets.box_comm = gui_create_commentary_pane();
	gtk_container_add(GTK_CONTAINER(widgets.notebook_comm_book), widgets.box_comm);

	label = gtk_label_new(_("Commentary View"));
	gtk_widget_show(label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_comm_book), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 0), label);

	// Book pane
	box_book = gui_create_book_pane();
	gtk_container_add(GTK_CONTAINER(widgets.notebook_comm_book), box_book);

	label = gtk_label_new(_("Book View"));
	gtk_widget_show(label);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(widgets.notebook_comm_book), gtk_notebook_get_nth_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 1), label);

	// Dict/lex
	widgets.box_dict = gui_create_dictionary_pane();
	gtk_paned_pack2(GTK_PANED(widgets.vpaned2), widgets.box_dict, TRUE, TRUE);

	// Statusbar
	widgets.appbar = gtk_statusbar_new();
	if (settings.statusbar) {
		gtk_widget_show(widgets.appbar);
	}

#ifndef USE_GTK_3
	gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(widgets.appbar), TRUE);
#endif
	gtk_box_pack_start(GTK_BOX(vbox_gs), widgets.appbar, FALSE, TRUE, 0);
	gui_set_statusbar(_("Welcome to Xiphos"));

	g_signal_connect((gpointer)vbox_gs, "key_press_event", G_CALLBACK(on_vbox1_key_press_event), NULL);
	g_signal_connect((gpointer)vbox_gs, "key_release_event", G_CALLBACK(on_vbox1_key_release_event), NULL);

	g_signal_connect(G_OBJECT(widgets.notebook_comm_book), "switch_page", G_CALLBACK(on_notebook_comm_book_switch_page), NULL);

	g_signal_connect(G_OBJECT(widgets.app), "delete_event", G_CALLBACK(delete_event), NULL);

	g_signal_connect((gpointer)widgets.app, "configure_event", G_CALLBACK(on_configure_event), NULL);
	g_signal_connect(G_OBJECT(widgets.epaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"epaned");
	g_signal_connect(G_OBJECT(widgets.vpaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"vpaned");
	g_signal_connect(G_OBJECT(widgets.vpaned2), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"vpaned2");
	g_signal_connect(G_OBJECT(widgets.hpaned), "button_release_event", G_CALLBACK(epaned_button_release_event), (gchar *)"hpaned1");

	gtk_widget_grab_focus(navbar_versekey.lookup_entry);

	gtk_window_set_default_size((GtkWindow *)widgets.app, settings.gs_width, settings.gs_height);
	main_window_created = TRUE;
}
Exemple #16
0
static gboolean
callback_button_box_click (GtkWidget * widget, GdkEvent * event,
    gpointer user_data)
{
  GList *list, *header_list;
  GList *hlist = NULL, *slist = NULL;
  GtkWidget *notebook = NULL;
  GtkWidget *textview = NULL;
  GFile *hexfile;
  GtkWidget *sc_window, *tree_view;
  gboolean is_header, is_slice, is_hexval;

  CodecComponents component = (CodecComponents) user_data;

  char *xml_name = ui->current_xml;
  char *hex_name = ui->current_hex;

  switch (component) {
    case COMPONENTS_HEADERS_GENERAL:
      is_header = TRUE;
      is_slice = FALSE;
      is_hexval = FALSE;
      break;
    case COMPONENTS_HEADERS_SLICE:
      is_slice = TRUE;
      is_header = FALSE;
      is_hexval = FALSE;
      break;
    case COMPONENTS_HEXVAL:
      is_hexval = TRUE;
      is_header = FALSE;
      is_slice = FALSE;
      break;
    default:
      break;
  }

  if (ui->prev_page)
    gtk_widget_destroy (GTK_WIDGET (ui->prev_page));
  if (ui->notebook_hash)
    g_hash_table_destroy (ui->notebook_hash);
  ui->notebook_hash = g_hash_table_new (g_str_hash, g_str_equal);

  if (!is_hexval) {
    header_list = analyzer_get_list_header_strings (xml_name);

    while (header_list) {
      if (strcmp (header_list->data, "comment")) {
        if (is_header && !g_str_has_prefix (header_list->data, "slice"))
          hlist = g_list_append (hlist, header_list->data);
        else if (is_slice && g_str_has_prefix (header_list->data, "slice"))
          hlist = g_list_append (hlist, header_list->data);
      }
      header_list = header_list->next;
    }

    notebook = gtk_notebook_new ();
    g_object_set (G_OBJECT (notebook), "expand", TRUE, NULL);
    gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
    gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook));
    gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), TRUE);

    g_list_foreach (hlist, (GFunc) populate_notebook, (gpointer) notebook);

    while (hlist) {
      sc_window = g_hash_table_lookup (ui->notebook_hash, hlist->data);
      if (sc_window && GTK_IS_BIN (sc_window))
        tree_view = gtk_bin_get_child (GTK_BIN (sc_window));

      if (tree_view) {
        list = analyzer_get_list_analyzer_node_from_xml (xml_name, hlist->data);
        if (list) {
          GtkTreeStore *treestore;
          GtkTreeModel *model;

          treestore = gtk_tree_store_new (NUM_COLS,
              G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

          g_list_foreach (list, (GFunc) fill_tree_store, treestore);
          analyzer_node_list_free (list);
          list = NULL;

          model = GTK_TREE_MODEL (treestore);
          gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
          g_object_unref (model);
        }
      }
      hlist = hlist->next;
    }
    ui->prev_page = notebook;
    gtk_container_add (GTK_CONTAINER (ui->parsed_info_vbox), notebook);
  } else {
    /*Display the hex dump of the frame */
    GtkWidget *scrolled_window;
    GtkTextBuffer *buffer;
    gchar *contents;
    gsize length;

    textview = gtk_text_view_new ();
    gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 20);
    g_object_set (G_OBJECT (textview), "expand", TRUE, "editable", FALSE, NULL);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_container_add (GTK_CONTAINER (scrolled_window), textview);

    hexfile = g_file_new_for_path (hex_name);
    if (hexfile) {
      if (g_file_load_contents (hexfile, NULL, &contents, &length, NULL, NULL)) {
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
        gtk_text_buffer_set_text (buffer, contents, length);
        g_free (contents);
        g_object_unref (G_OBJECT (hexfile));
      }
    }
    ui->prev_page = scrolled_window;
    gtk_container_add (GTK_CONTAINER (ui->parsed_info_vbox), scrolled_window);
  }

  gtk_widget_show_all (ui->main_window);

  return TRUE;
}
Exemple #17
0
int main(int argc, char **argv)
{
	GtkWidget *menubar = NULL;
	GtkWidget *table = NULL;
	GtkWidget *combo = NULL;
	GtkBin *bin = NULL;
	GtkViewport *view = NULL;
	int i=0;
	log_options_t lopts = LOG_OPTS_STDERR_ONLY;

	if (!getenv("SLURM_BITSTR_LEN"))
		setenv("SLURM_BITSTR_LEN", "128", 1);	/* More array info */
	slurm_conf_init(NULL);
	log_init(argv[0], lopts, SYSLOG_FACILITY_USER, NULL);
	load_defaults();
	cluster_flags = slurmdb_setup_cluster_flags();
	cluster_dims = slurmdb_setup_cluster_dims();

	_init_pages();
	sview_thread_init(NULL);
	gdk_threads_init();
	gdk_threads_enter();
	/* Initialize GTK */
	gtk_init (&argc, &argv);
	sview_mutex_new(&sview_mutex);
	sview_mutex_new(&grid_mutex);
	sview_cond_new(&grid_cond);
	/* make sure the system is up */
	grid_window = GTK_WIDGET(create_scrolled_window());
	bin = GTK_BIN(&GTK_SCROLLED_WINDOW(grid_window)->container);
	view = GTK_VIEWPORT(bin->child);
	bin = GTK_BIN(&view->bin);
	main_grid_table = GTK_TABLE(bin->child);
	gtk_table_set_homogeneous(main_grid_table, true);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(grid_window),
				       GTK_POLICY_NEVER,
				       GTK_POLICY_AUTOMATIC);

	/* fill in all static info for pages */
	/* Make a window */
	main_window = gtk_dialog_new();
	g_signal_connect(G_OBJECT(main_window), "delete_event",
			 G_CALLBACK(_delete), NULL);

	gtk_window_set_title(GTK_WINDOW(main_window), "Sview");
	gtk_window_set_default_size(GTK_WINDOW(main_window),
				    working_sview_config.main_width,
				    working_sview_config.main_height);
	gtk_container_set_border_width(
		GTK_CONTAINER(GTK_DIALOG(main_window)->vbox), 1);
	/* Create the main notebook, place the position of the tabs */
	main_notebook = gtk_notebook_new();
	g_signal_connect(G_OBJECT(main_notebook), "switch_page",
			 G_CALLBACK(_page_switched),
			 NULL);
	table = gtk_table_new(1, 3, false);
	gtk_table_set_homogeneous(GTK_TABLE(table), false);
	gtk_container_set_border_width(GTK_CONTAINER(table), 1);
	/* Create a menu */
	menubar = _get_menubar_menu(main_window, main_notebook);
	gtk_table_attach_defaults(GTK_TABLE(table), menubar, 0, 1, 0, 1);

	if ((combo = _create_cluster_combo())) {
		GtkWidget *label = gtk_label_new("Cluster ");
		gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1,
				 GTK_FILL, GTK_SHRINK, 0, 0);
		gtk_table_attach(GTK_TABLE(table), combo, 2, 3, 0, 1,
				 GTK_FILL, GTK_SHRINK, 0, 0);
	}
	gtk_notebook_popup_enable(GTK_NOTEBOOK(main_notebook));
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(main_notebook), true);
	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_notebook),
				 working_sview_config.tab_pos);

	main_statusbar = gtk_statusbar_new();
	gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(main_statusbar),
					  false);
	/* Pack it all together */
	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(main_window)->vbox),
			   table, false, false, 0);
	table = gtk_table_new(1, 2, false);

	gtk_table_attach(GTK_TABLE(table), grid_window, 0, 1, 0, 1,
			 GTK_SHRINK, GTK_EXPAND | GTK_FILL,
			 0, 0);
	gtk_table_attach_defaults(GTK_TABLE(table), main_notebook, 1, 2, 0, 1);

	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(main_window)->vbox),
			   table, true, true, 0);
	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(main_window)->vbox),
			   main_statusbar, false, false, 0);

	in_process_cursor = gdk_cursor_new(GDK_WATCH);

	for(i=0; i<PAGE_CNT; i++) {
		if (main_display_data[i].id == -1)
			break;

		create_page(GTK_NOTEBOOK(main_notebook),
			    &main_display_data[i]);
	}

	/* tell signal we are done adding */

	popup_list = list_create(destroy_popup_info);
	signal_params_list = list_create(destroy_signal_params);

	gtk_widget_show_all(main_window);

	adding = 0;
	/* apply default settings */
	if (!working_sview_config.show_grid)
		gtk_widget_hide(grid_window);

	for(i=0; i<PAGE_CNT; i++) {
		GtkWidget *visible_tab = NULL;

		if (main_display_data[i].id == -1)
			break;

		visible_tab = gtk_notebook_get_nth_page(
			GTK_NOTEBOOK(main_notebook), i);
		if (working_sview_config.page_visible[i]
		    || (i == working_sview_config.default_page)
		    || (i == TAB_PAGE))
			gtk_widget_show(visible_tab);
		else
			gtk_widget_hide(visible_tab);
	}
	/* Set the default page.  This has to be done after the
	 * gtk_widget_show_all since it, for some reason always sets
	 * 0 to be the default page and will just overwrite this. */
	/* Also if we already are set at the current page we need to
	   start up the page thread, so just call the _page_switched
	   function.  If we aren't already there, then set the current
	   page which will inturn call the _page_switched.  If the
	   pages is already this the signal doesn't happen so handle
	   it here.
	*/
	if (gtk_notebook_get_current_page(GTK_NOTEBOOK(main_notebook))
	    == working_sview_config.default_page)
		_page_switched(GTK_NOTEBOOK(main_notebook), NULL,
			       working_sview_config.default_page, NULL);
	else
		gtk_notebook_set_current_page(GTK_NOTEBOOK(main_notebook),
					      working_sview_config.
					      default_page);

	/* Finished! */
	gtk_main ();
	gdk_threads_leave();
	return 0;
}
Exemple #18
0
/**
 * Create a new Hybrid Conversation Dialog.
 */
static HybridConversation*
hybrid_conv_create()
{
    GtkWidget *vbox;
    GtkWidget *action_area;
    GtkWidget *halign;
    GtkWidget *button;
    gint       tab_pos;
    gchar     *chat_theme = NULL;

    theme_list[0].func();

    if ((chat_theme = hybrid_pref_get_string(NULL, "chat_theme")) != NULL) {
        gint i;
        for (i = 0; theme_list[i].name; i ++) {
            if (g_strcmp0(theme_list[i].name, chat_theme) == 0) {
                theme_list[i].func();
            }
        }
    }

    HybridConversation *imconv;

    imconv = g_new0(HybridConversation, 1);

    /* create window */
    imconv->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(imconv->window), 485, 500);
    gtk_container_set_border_width(GTK_CONTAINER(imconv->window), 1);
    g_signal_connect(imconv->window, "destroy", G_CALLBACK(conv_destroy_cb),
                     imconv);
    g_signal_connect(imconv->window, "key-press-event",
                     G_CALLBACK(key_press_func), imconv);

    /* create vbox */
    vbox = gtk_vbox_new(FALSE, 2);
    gtk_container_add(GTK_CONTAINER(imconv->window), vbox);

    /* create notebook */
    imconv->notebook = gtk_notebook_new();

    if ((tab_pos = hybrid_pref_get_int(NULL, "tab_pos")) != -1) {
        gtk_notebook_set_tab_pos(GTK_NOTEBOOK(imconv->notebook), tab_pos);

    } else {
        gtk_notebook_set_tab_pos(GTK_NOTEBOOK(imconv->notebook), GTK_POS_TOP);
    }
    gtk_notebook_set_scrollable(GTK_NOTEBOOK(imconv->notebook), TRUE);
    gtk_notebook_popup_enable(GTK_NOTEBOOK(imconv->notebook));
    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(imconv->notebook), TRUE);
    gtk_notebook_set_show_border(GTK_NOTEBOOK(imconv->notebook), TRUE);
    gtk_box_pack_start(GTK_BOX(vbox), imconv->notebook, TRUE, TRUE, 0);
    g_signal_connect(imconv->notebook, "switch-page",
                     G_CALLBACK(switch_page_cb), imconv);

    if (!hybrid_pref_get_boolean(NULL, "hide_chat_buttons")) {
        /* create action area, "Close" button and "Send" button */
        action_area = gtk_hbox_new(FALSE, 0);

        halign = gtk_alignment_new(1, 0, 0, 0);
        gtk_container_add(GTK_CONTAINER(halign), action_area);
        gtk_box_pack_start(GTK_BOX(vbox), halign, FALSE, FALSE, 1);

        button = gtk_button_new_with_label(_("Close"));
        gtk_widget_set_size_request(button, 100, 30);
        gtk_box_pack_start(GTK_BOX(action_area), button, FALSE, FALSE, 2);
        g_signal_connect(button, "clicked", G_CALLBACK(conv_close_cb), imconv);

        button = gtk_button_new_with_label(_("Send"));
        gtk_widget_set_size_request(button, 100, 30);
        gtk_box_pack_start(GTK_BOX(action_area), button, FALSE, FALSE, 1);
        g_signal_connect(button, "clicked", G_CALLBACK(conv_send_cb), imconv);

    }

    gtk_widget_show_all(imconv->window);

    return imconv;
}
Exemple #19
0
int
main(int argc, char **argv)
{
	GtkWidget *menubar,
			  *pri_vbox,
			  *tabla,
			  *scroll;
	GtkAccelGroup *accel_group;
	GtkUIManager *ui_manager;
	GtkAction *action;

	LIBXML_TEST_VERSION

	karakter_betoltes("ruin.xml");
	//return 0;

	gtk_init(&argc, &argv);

	action_group = gtk_action_group_new("main_menu");

	action = gtk_action_new("uj-karakter", "Új karakter", "Új karakter létrehozása", GTK_STOCK_NEW);
	gtk_action_group_add_action_with_accel(action_group, action, "<Control>N");

	action = gtk_action_new("karakter-megnyitas", "Karakter megnyitása", "Elmentett karakter megnyitása", GTK_STOCK_OPEN);
	gtk_action_group_add_action_with_accel(action_group, action, "<Control>O");

	action = gtk_action_new("karakter-mentes", "Karakter mentése", "Karakter adatainak mentése", GTK_STOCK_SAVE);
	gtk_action_group_add_action_with_accel(action_group, action, "<Control>S");

	action = gtk_action_new("kilepes", "Kilépés", "Kilépés a programból", GTK_STOCK_QUIT);
	gtk_action_group_add_action_with_accel(action_group, action, "<Control>Q");
	g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(kilepes_func), NULL);

	action = gtk_action_new("karakter-menu", "Karakter", "Karakter", NULL);
	gtk_action_group_add_action(action_group, action);

	gtk_action_group_add_radio_actions(action_group, menu_items, nezet_menu_szama, 0, G_CALLBACK(nezet_menu), NULL);
	action = gtk_action_new("nezet-menu", "Nézet", "Nézet", NULL);
	gtk_action_group_add_action(action_group, action);

	ui_manager = gtk_ui_manager_new();
	gtk_ui_manager_set_add_tearoffs(ui_manager, FALSE);
	gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
	gtk_ui_manager_add_ui_from_file(ui_manager, "magus_kargen_res.ui", NULL);

	accel_group = gtk_accel_group_new();

	main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect(G_OBJECT(main_window), "destroy", G_SIGNAL_FUNC(main_window_destroy), NULL);
	gtk_window_add_accel_group(GTK_WINDOW(main_window), accel_group);
	gtk_window_set_title(GTK_WINDOW(main_window), "M.A.G.U.S. - Reneszánsz karakternyilvántartó");

	menubar = gtk_ui_manager_get_widget(ui_manager, "/menu");

	book = gtk_notebook_new();
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(book), TRUE);
	gtk_notebook_popup_enable(GTK_NOTEBOOK(book));
	g_signal_connect(GTK_OBJECT(book), "change-current-page", G_SIGNAL_FUNC(lapvaltas), NULL);

	/* Azonnal látható és hallható dolgok */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(18, 2, FALSE);
	azonnal_lathato_dolgok_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(EGYBOL_LATHATO_HALLHATO_DOLGOK));

	/* A játékos és a karakter adatai */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(4, 2, FALSE);
	jatekos_es_karakter_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(A_JATEKOS_ES_A_KARAKTER_ADATAI));

	/* Képességek */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(10, 2, FALSE);
	kepessegek_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(KEPESSEGEK));

	/* Főbb adatok */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(26, 4, FALSE);
	fobb_adatok_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(A_KARAKTER_FOBB_ADATAI));

	/* Megjelenés */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(10, 4, FALSE);
	megjelenes_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(MEGJELENES));

	/* Állandó érzelmek */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(15, 2, FALSE);
	erzelmek_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(ALLANDO_ERZELMEK));

	/* Szimpatikus viszonyok. Ide majd egy TableView kene */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(SZIMPATIKUS_VISZONYOK));

	/* Kapcsolatok, ismertseg. Ide majd egy TableView kene */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(ISMERTSEG));

	/* Kulonleges kepessegek, hatranyok. Ide is TableView kene */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(KULONLEGES_KEPESSEGEK));

	/* Tapasztalati pontok, átváltás */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(3, 2, FALSE);
	tapasztalat_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(TAPASZTALATI_PONTOK));

	/* Képzettségek. Ide majd egy TableView kell */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(KEPZETTSEGEK));

	/* Nyelvek. Ide is TableView */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(NYELVEK));

	/* Harcértékek */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(5, 4, FALSE);
	harcertekek_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(HARCERTEKEK));

	/* Életerő */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(3, 4, FALSE);
	eletero_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(ELETERO));

	/* Pszi */
	scroll = gtk_scrolled_window_new(NULL, NULL);
	tabla = gtk_table_new(5, 2, FALSE);
	pszi_lap(GTK_TABLE(tabla));
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), tabla);
	gtk_notebook_append_page(GTK_NOTEBOOK(book), scroll, gtk_label_new(PSZI));

	/* Mágia */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(MAGIA));

	/* Fegyverek és pajzsok. Ide két TableView kell. */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(FEGYVEREK_PAJZS));

	/* Állatok, csatlósok, szolgák. Ide sok TableView kell */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(ALLATOK_CSATLOSOK));

	/* Mesterek és tanítók. Ide két TableView kell */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(MESTEREK));

	/* Földbirtokok. Ide is TableView kell */
	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(BIRTOKOK_BEFEKTETESEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(ALAKULATOK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(ISKOLAK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(MUVEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(ERTEKEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(RUHAK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(VARAZSTARGYAK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(FELSZERELES));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(VARAZSLATOK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(TANULAS));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(SEBESULESEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(BETEGSEGEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(VARAZSLAT_KUTATAS));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(KULONLEGES_DOLGOK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(MEGJEGYZESEK));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(TORTENET));

	gtk_notebook_append_page(GTK_NOTEBOOK(book), gtk_table_new(1, 1, FALSE), gtk_label_new(KEPEK));

	pri_vbox = gtk_vbox_new(FALSE, 0);

	gtk_box_pack_start(GTK_BOX(pri_vbox), menubar, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(pri_vbox), book, TRUE, TRUE, 0);

	gtk_container_add(GTK_CONTAINER(main_window), pri_vbox);

	gtk_widget_show_all(main_window);
	gtk_window_maximize(GTK_WINDOW(main_window));

	gtk_main();

	xmlCleanupParser();

	return 0;
}
Exemple #20
0
/** \brief Create and initialise module manger.
 *  \return The main module container widget (GtkNotebook).
 *
 * This function creates and initialises the module manager widget, which
 * consist of a GtkNotebook container. Before returning the container to the
 * caller, the function checks whether any modules should be restored (ie.
 * openend), if yes, it creates them and adds them to the notebook.
 *
 */
GtkWidget *
mod_mgr_create (void)
{
    gchar  *openmods = NULL;
    gchar **mods;
    gint    count,i;
    GtkWidget *module;
    gchar     *modfile;
    gchar     *confdir;

    /* create notebook */
    nbook = gtk_notebook_new ();
    gtk_notebook_set_scrollable (GTK_NOTEBOOK (nbook), TRUE);
    gtk_notebook_popup_enable (GTK_NOTEBOOK (nbook));
    g_object_set (G_OBJECT (nbook), "homogeneous", TRUE, NULL);
    g_signal_connect (G_OBJECT (nbook), "switch-page",
                      G_CALLBACK (switch_page_cb), NULL);

    /* get list of modules which should be open */
    openmods = sat_cfg_get_str (SAT_CFG_STR_OPEN_MODULES);

    if (openmods) {
        mods = g_strsplit (openmods, ";", 0);
        count = g_strv_length (mods);

        for (i = 0; i < count; i++) {

            /* get data file name */
            confdir = get_modules_dir ();
            modfile = g_strconcat (confdir, G_DIR_SEPARATOR_S,
                                   mods[i], ".mod", NULL);
            g_free (confdir);
            
            /* create module */
            module = gtk_sat_module_new (modfile);

            if (IS_GTK_SAT_MODULE (module)) {

                /* if module state was window or user does not want to restore the
                   state of the modules, pack the module into the notebook */
                if ((GTK_SAT_MODULE (module)->state == GTK_SAT_MOD_STATE_DOCKED) ||
                    !sat_cfg_get_bool (SAT_CFG_BOOL_MOD_STATE)) {

                    mod_mgr_add_module (module, TRUE);

                }
                else {
                    mod_mgr_add_module (module, FALSE);
                    create_module_window (module);
                }
            }
            else {
                sat_log_log (SAT_LOG_LEVEL_ERROR,
                             _("%s: Failed to restore %s"),
                             __FUNCTION__, mods[i]);
            }

            g_free (modfile);

        }

        g_strfreev (mods);
        g_free (openmods);

        /* disable tabs if only one page in notebook */
        if ((gtk_notebook_get_n_pages (GTK_NOTEBOOK(nbook))) == 1) {
            gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nbook), FALSE);
        }
        else {
            gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nbook), TRUE);
        }

    }
    else {
        sat_log_log (SAT_LOG_LEVEL_MSG,
                     _("%s: No modules have to be restored."),
                     __FUNCTION__);
    }

    return nbook;
}