Пример #1
0
int
nautilus_notebook_add_tab (NautilusNotebook *notebook,
			   NautilusWindowSlot *slot,
			   int position,
			   gboolean jump_to)
{
	GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);
	GtkWidget *tab_label;

	g_return_val_if_fail (NAUTILUS_IS_NOTEBOOK (notebook), -1);
	g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot), -1);

	tab_label = build_tab_label (notebook, slot);

	position = gtk_notebook_insert_page (GTK_NOTEBOOK (notebook),
					     GTK_WIDGET (slot),
					     tab_label,
					     position);

	gtk_container_child_set (GTK_CONTAINER (notebook),
				 GTK_WIDGET (slot),
				 "tab-expand", TRUE,
				 NULL);

	nautilus_notebook_sync_tab_label (notebook, slot);
	nautilus_notebook_sync_loading (notebook, slot);

	if (jump_to) {
		gtk_notebook_set_current_page (gnotebook, position);
	}

	return position;
}
Пример #2
0
static void notebook_add_page(GtkWidget *notebook, const char* tab_name)
{
	GtkListStore *store;
	GtkWidget *label;
	GtkWidget *child;
	GtkNotebook *nb = GTK_NOTEBOOK(notebook);
	gint page = gtk_notebook_get_current_page(nb);
	uint32_t addr;
	
	label = gtk_label_new(tab_name);
	gtk_widget_show(label);

    child = clist_create(&store);

	// display normal
	sscanf(tab_name, "%06x", &addr);
   	clist_populate(store, addr, DUMP_SIZE);

	gtk_widget_show(child);

	gtk_notebook_insert_page(nb, child, label, page);
	gtk_notebook_set_current_page(nb, page);

    gtk_widget_grab_focus(child);
}
Пример #3
0
static void
bt_main_pages_add_tab (const BtMainPages * self, GtkWidget * content,
    gchar * str, gchar * icon, gchar * tip)
{
  GtkWidget *label, *event_box, *box, *image;

  label = gtk_label_new (str);
  //gtk_label_set_ellipsize(GTK_LABEL(label),PANGO_ELLIPSIZE_END);
  gtk_widget_set_name (label, str);
  gtk_widget_show (label);

  image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
  gtk_widget_show (image);

  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_BORDER);
  gtk_widget_show (box);
  //gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
  //gtk_box_pack_start(GTK_BOX(box),label,TRUE,FALSE,0);
  gtk_container_add (GTK_CONTAINER (box), image);
  gtk_container_add (GTK_CONTAINER (box), label);

  event_box = gtk_event_box_new ();
  g_object_set (event_box, "visible-window", FALSE, NULL);
  gtk_container_add (GTK_CONTAINER (event_box), box);

  gtk_widget_set_tooltip_text (event_box, tip);

  gtk_notebook_insert_page (GTK_NOTEBOOK (self), content, event_box, -1);
}
Пример #4
0
static void create_side_panel(MainWindow *main_window){
  /* Close button for the side bar */
  GtkWidget *close_box = get_widget_from_builder(main_window, "sidepanelheader");
  main_window->pclose_sidebar_button = gedit_close_button_new();
  gtk_widget_set_tooltip_text(main_window->pclose_sidebar_button, _("Close side panel"));
  g_signal_connect(G_OBJECT(main_window->pclose_sidebar_button), "clicked", G_CALLBACK (side_panel_togle), main_window);
  gtk_widget_show(main_window->pclose_sidebar_button);
  gtk_box_pack_end(GTK_BOX(close_box), main_window->pclose_sidebar_button, FALSE, FALSE, 0);

  main_window->notebook_manager = get_widget_from_builder(main_window, "notebook_manager");
  
  /* Classbrowser stuff creation */  
  GtkWidget *classbox = get_widget_from_builder(main_window, "classbox");
  main_window->pclassbrowser = gphpedit_classbrowser_new (main_window); 
  gtk_widget_show(main_window->pclassbrowser);
  gtk_box_pack_start(GTK_BOX(classbox), main_window->pclassbrowser, TRUE, TRUE, 0);
  /* File browser stuff creation */
  if (get_preferences_manager_show_filebrowser(main_window->prefmg))
  {
  main_window->pfolder= gphpedit_filebrowser_new(main_window);
  gtk_widget_show(main_window->pfolder);
  GtkWidget *label= gtk_image_new_from_icon_name ("file-manager", GTK_ICON_SIZE_SMALL_TOOLBAR);
  gtk_widget_show(label);
  gtk_notebook_insert_page (GTK_NOTEBOOK(main_window->notebook_manager), main_window->pfolder, label, 1);
  }
}
Пример #5
0
/**
 * gedit_notebook_add_tab:
 * @nb: a #GeditNotebook
 * @tab: a #GeditTab
 * @position: the position where the @tab should be added
 * @jump_to: %TRUE to set the @tab as active
 *
 * Adds the specified @tab to the @nb.
 */
void
gedit_notebook_add_tab (GeditNotebook *nb,
		        GeditTab      *tab,
		        gint           position,
		        gboolean       jump_to)
{
	GtkWidget *tab_label;

	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
	g_return_if_fail (GEDIT_IS_TAB (tab));

	tab_label = create_tab_label (nb, tab);

	gtk_notebook_insert_page (GTK_NOTEBOOK (nb), 
				  GTK_WIDGET (tab),
				  tab_label,
				  position);
	gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (nb),
	                                  GTK_WIDGET (tab),
	                                  TRUE);
	gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (nb),
	                                 GTK_WIDGET (tab),
	                                 TRUE);

	/* The signal handler may have reordered the tabs */
	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
					  GTK_WIDGET (tab));

	if (jump_to)
	{
		gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), position);
		gtk_widget_grab_focus (GTK_WIDGET (tab));
	}
}
Пример #6
0
/* Inserts in notebook a new page whose content is child, and whose bookmark
 * is tab_label. The page is inserted just before the page number position,
 * starting with 0. If position is out of bounds, it is assumed to be the
 * current number of pages.  */
int
clip_GTK_NOTEBOOKINSERTPAGE(ClipMachine * cm)
{
	C_widget   *cntb = _fetch_cw_arg(cm);
	C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2));
	C_widget *clabel; GtkWidget *label;
	gint    position = _clip_parni(cm,4);
	CHECKCWID(cntb,GTK_IS_NOTEBOOK);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET);
	CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t);
	CHECKOPT(4,NUMERIC_t);
	if (_clip_parinfo(cm,3)==CHARACTER_t) {
		char   * caption = _clip_parc(cm, 3);
		LOCALE_TO_UTF(caption);
		label = gtk_label_new_with_mnemonic(caption);
		FREE_TEXT(caption);
	}
	else
	{
		clabel = _fetch_cwidget(cm,_clip_spar(cm,3));
		CHECKCWID(clabel,GTK_IS_WIDGET);
		if (clabel) label = clabel->widget;
	}
	if (_clip_parinfo(cm,4)==UNDEF_t) position = 1;
	gtk_notebook_insert_page(GTK_NOTEBOOK(cntb->widget), cchild->widget, label, position-1);
	return 0;
err:
	return 1;
}
Пример #7
0
void
scale_init(void)
{
	GtkWidget *nfr1, *nlbl, *vbox1;
	GtkWidget *b1;
	GtkWidget *cur_lbl;
	int scw, sch;
	char lbl[255];

	nlbl = gtk_label_new("Image Scaling");
  nfr1 = gtk_frame_new("Image Scaling");
	gtk_container_set_border_width(GTK_CONTAINER(nfr1), 3);
	gtk_notebook_insert_page(GTK_NOTEBOOK(ModMdi), nfr1, nlbl, 6);
  gtk_widget_show(nlbl);
  gtk_widget_show(nfr1);

	vbox1 = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(nfr1), vbox1);
	b1 = gtk_hbox_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox1), b1, FALSE, TRUE, 0);
	
	imlib_context_set_image(im);
	scw = imlib_image_get_width();
	sch = imlib_image_get_height();
		
	sprintf(lbl, "Current Width: %d\nCurrent Height: %d\n", scw, sch);
	cur_lbl = gtk_label_new(lbl);
	gtk_box_pack_start(GTK_BOX(vbox1), cur_lbl, FALSE, TRUE, 0);
	gtk_widget_show(cur_lbl);

	gtk_widget_show(vbox1);
	gtk_widget_show(b1);
}
Пример #8
0
/******************* Page d'affichage des règles *****************/
void create_show_rule_page(GtkNotebook * pNotebook){
  GtkWidget *pVBoxCentral;
  GtkWidget *pVBoxSup;
  GtkWidget *  pButtonRefresh = gtk_button_new_with_label("Refresh");
  
  //  data_page_show_rule_p 
  //on ajoute les entry a la data
  dpsr->pButtonRefresh = pButtonRefresh;
  
  GtkWidget *pLabel1 = gtk_label_new(g_strdup_printf("Label Box 1"));
  GtkWidget *pTabLabel = gtk_label_new(g_strdup_printf("Voir regles"));
  
  pVBoxCentral = gtk_vbox_new(FALSE, 0);
  pVBoxSup = gtk_vbox_new(FALSE, 0);
  
  
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBoxSup, FALSE, FALSE, 0);
  
  //on met le bouton refresh dans la partie inferieure
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pButtonRefresh, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(pButtonRefresh),"clicked",G_CALLBACK(OnButtonRefreshPageRule),NULL);  
  gtk_box_pack_start(GTK_BOX(pVBoxSup), pLabel1, FALSE, FALSE, 0);
  
  
  // Insertion de la page avec le widget pVBoxCentral
  gtk_notebook_insert_page(GTK_NOTEBOOK(pNotebook), pVBoxCentral, pTabLabel,2);
}
Пример #9
0
int
ephy_notebook_add_tab (EphyNotebook *notebook,
                       EphyEmbed    *embed,
                       int           position,
                       gboolean      jump_to)
{
  GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);

  g_assert (EPHY_IS_NOTEBOOK (notebook));

  position = gtk_notebook_insert_page (GTK_NOTEBOOK (notebook),
                                       GTK_WIDGET (embed),
                                       NULL,
                                       position);

  gtk_container_child_set (GTK_CONTAINER (notebook),
                           GTK_WIDGET (embed),
                           "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI,
                                                                 EPHY_PREFS_UI_EXPAND_TABS_BAR),
                           NULL);

  if (jump_to) {
    gtk_notebook_set_current_page (gnotebook, position);
    g_object_set_data (G_OBJECT (embed), "jump_to",
                       GINT_TO_POINTER (jump_to));
  }

  return position;
}
Пример #10
0
void
setup_notebook_out(void) {
	
	const char ** ports_out;
	int i, j, k;
	char client_name[MAXLEN];
	char client_name_prev[MAXLEN];
	char port_name[MAXLEN];
	GtkTreeIter iter;

        ports_out = jack_get_ports(jack_client, NULL, NULL, JackPortIsInput);

	for (j = 0; j < MAXLEN; j++) {
		client_name[j] = '\0';
		client_name_prev[j] = '\0';
	}

	i = 0;
	n_clients = -1;
	if (ports_out) {
		while (ports_out[i] != NULL) {
			/* get the client name */
			j = 0;
			while ((ports_out[i][j] != ':') && (ports_out[i][j] != '\0')) {
				client_name[j] = ports_out[i][j];
				j++;
			}
			client_name[j] = '\0';

			/* create a new notebook page if needed */
			if (strcmp(client_name, client_name_prev) != 0) {
				n_clients++;
				store_out_nb[n_clients] = gtk_list_store_new(1, G_TYPE_STRING);
				nb_out_labels[n_clients] = gtk_label_new(client_name);
				gtk_widget_show(nb_out_labels[n_clients]);
				gtk_notebook_insert_page(GTK_NOTEBOOK(nb_outs), GTK_WIDGET(setup_tree_out()),
							 GTK_WIDGET(nb_out_labels[n_clients]), n_clients);
			}
			/* add the port to the list */
			j = 0;
			while ((ports_out[i][j] != ':') && (ports_out[i][j] != '\0'))
				j++;
			if (ports_out[i][j] == '\0')
				fprintf(stderr, "ERROR: bad JACK port string: %s\n", ports_out[i]);
			else {
				k = 0;
				j++;
				while (ports_out[i][j] != '\0')
					port_name[k++] = ports_out[i][j++];
				port_name[k] = '\0';
				gtk_list_store_append(store_out_nb[n_clients], &iter);
				gtk_list_store_set(store_out_nb[n_clients], &iter, 0, port_name, -1);
			}
			strcpy(client_name_prev, client_name);
			i++;
		}
		free(ports_out);
	}
}
void ui_playlist_notebook_create_tab(gint playlist)
{
    GtkWidget *scrollwin, *treeview;
    GtkWidget *label, *entry, *ebox, *hbox;
    GtkAdjustment *vscroll;
    gint position = aud_playlist_get_position (playlist);

    scrollwin = gtk_scrolled_window_new(NULL, NULL);
    vscroll = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrollwin));

    treeview = ui_playlist_widget_new(playlist);
    g_object_set_data(G_OBJECT(scrollwin), "treeview", treeview);

    gtk_container_add(GTK_CONTAINER(scrollwin), treeview);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_widget_show_all(scrollwin);

    ebox = gtk_event_box_new();
    gtk_event_box_set_visible_window ((GtkEventBox *) ebox, FALSE);

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);

    label = gtk_label_new ("");
    set_tab_label (playlist, (GtkLabel *) label);
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);

    entry = gtk_entry_new();
    gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
    gtk_container_add(GTK_CONTAINER(ebox), hbox);
    gtk_widget_show_all(ebox);
    gtk_widget_hide(entry);

    gtk_box_pack_end ((GtkBox *) hbox, make_close_button (playlist), FALSE, FALSE, 0);

    g_object_set_data(G_OBJECT(ebox), "label", label);
    g_object_set_data(G_OBJECT(ebox), "entry", entry);
    g_object_set_data(G_OBJECT(ebox), "page", scrollwin);

    gtk_notebook_insert_page (UI_PLAYLIST_NOTEBOOK, scrollwin, ebox, playlist);
    gtk_notebook_set_tab_reorderable(UI_PLAYLIST_NOTEBOOK, scrollwin, TRUE);

    g_object_set_data ((GObject *) treeview, "playlist-id",
     GINT_TO_POINTER (aud_playlist_get_unique_id (playlist)));

    if (position >= 0)
    {
        aud_playlist_select_all (playlist, FALSE);
        aud_playlist_entry_set_selected (playlist, position, TRUE);
        audgui_list_set_highlight (treeview, position);
        audgui_list_set_focus (treeview, position);
    }

    g_signal_connect(ebox, "button-press-event", G_CALLBACK(tab_button_press_cb), NULL);
    g_signal_connect(ebox, "key-press-event", G_CALLBACK(tab_key_press_cb), NULL);
    g_signal_connect(entry, "activate", G_CALLBACK(tab_title_save), ebox);
    g_signal_connect_swapped (vscroll, "value-changed",
     G_CALLBACK(ui_playlist_widget_scroll), treeview);
}
Пример #12
0
void recreate_front_page(){
  GtkWidget * pNotebook = dw->pNotebook;
  GtkWidget *pVBoxCentral;
  GtkWidget *pVBox1;
  GtkWidget *pVBox2;
  GtkWidget *pSeparatorH;
  GtkWidget *pButtonAddRule;
  
  //debug
  gint i = 0;
  
  
  GtkWidget *pLabel2;
  GtkWidget *pTabLabel;
  
  pSeparatorH = gtk_hseparator_new();
  pButtonAddRule = gtk_button_new_with_label("AddRule");
  g_signal_connect(G_OBJECT(pButtonAddRule),"clicked",G_CALLBACK(OnButtonAddRule),pNotebook);   
  
  pVBoxCentral = gtk_vbox_new(FALSE, 0);
  pVBox1 = gtk_vbox_new(FALSE, 0);
  pVBox2 = gtk_vbox_new(FALSE, 0);
  
  //on ajoute tout cela dans dfp
  dfp->pVBoxCentral = pVBoxCentral;
  dfp->pVBox1 = pVBox1;
  dfp->pVBox2 = pVBox2;
  
  /* Creation des differents GtkLabel */
  pTabLabel = gtk_label_new(g_strdup_printf("Nouvelle page %d", i));
  
  pLabel2 = gtk_label_new(g_strdup_printf("Nouvo label Box 2:%d", i));
  
  create_vbox_from_caract_list(GTK_BOX(pVBox1));
  
  gtk_box_pack_start(GTK_BOX(pVBox2), pSeparatorH, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBox2), pLabel2, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBox2), pButtonAddRule, FALSE, FALSE, 0);
  
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBox1, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBox2, FALSE, FALSE, 0);



  gint current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(pNotebook));
  printf("Current page = %d\n", current_page);
  // Insertion de la page avec le widget pLabel
  gtk_notebook_remove_page(GTK_NOTEBOOK(pNotebook),0);
  printf("On enleve une page\n");
  gtk_notebook_insert_page(GTK_NOTEBOOK(pNotebook), pVBoxCentral, pTabLabel,0);
  printf("On rajoute une page\n");
  
  printf("On va sur la page %d\n",current_page);


  gtk_widget_show_all(dw->pWindow);
  gtk_notebook_set_current_page (GTK_NOTEBOOK(pNotebook),current_page);
}
Пример #13
0
GtkWidget* GroupDialog_addPage(const char* tabLabel, GtkWidget* widget, const StringExportCallback& title)
{
  GtkWidget* w = gtk_label_new(tabLabel);
  gtk_widget_show(w);
  GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(g_GroupDlg.m_pNotebook), gtk_notebook_insert_page(GTK_NOTEBOOK(g_GroupDlg.m_pNotebook), widget, w, -1));
  g_pages.push_back(title);

  return page;
}
Пример #14
0
static GtkWidget *build_develop_panel(void)
{
	develop_notebook = gtk_notebook_new();
	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(develop_notebook), FALSE);
	gtk_notebook_set_show_border(GTK_NOTEBOOK(develop_notebook),
				     FALSE);
	gtk_widget_show(develop_notebook);

	gtk_notebook_insert_page(GTK_NOTEBOOK(develop_notebook),
				 develop_build_page(), NULL, 0);
	gtk_notebook_insert_page(GTK_NOTEBOOK(develop_notebook),
				 discard_build_page(), NULL, 1);
	gtk_notebook_insert_page(GTK_NOTEBOOK(develop_notebook),
				 gold_build_page(), NULL, 2);
	gtk_notebook_insert_page(GTK_NOTEBOOK(develop_notebook),
				 prompt_build_page(), NULL, 3);

	return develop_notebook;
}
Пример #15
0
void
gcal_editable_set_edit_widget (GcalEditable *editable,
                               GtkWidget    *widget)
{
    g_return_if_fail (GCAL_IS_EDITABLE (editable));

    if (gtk_notebook_get_nth_page (GTK_NOTEBOOK (editable), 1) != NULL)
        gtk_notebook_remove_page (GTK_NOTEBOOK (editable), 1);

    gtk_notebook_insert_page (GTK_NOTEBOOK (editable), widget, NULL, 1);
}
Пример #16
0
girara_tab_t*
girara_tab_new(girara_session_t* session, const char* title, GtkWidget* widget,
               bool next_to_current, void* data)
{
    if (session == NULL || widget == NULL) {
        return NULL;
    }

    girara_tab_t* tab = g_slice_new(girara_tab_t);

    tab->title   = title ? g_strdup(title) : g_strdup(UNTITLED_TAB_TITLE);
    tab->widget  = widget;
    tab->session = session;
    tab->data    = data;

    int position = (next_to_current) ?
                   (gtk_notebook_get_current_page(session->gtk.tabs) + 1) : -1;

    /* insert tab into notebook */
    if (gtk_notebook_insert_page(session->gtk.tabs, tab->widget, NULL, position) == -1) {
        g_free(tab->title);
        g_slice_free(girara_tab_t, tab);
        return NULL;
    }

    /* create tab label */
    GtkWidget *tab_label = gtk_label_new(tab->title);
    GtkWidget *tab_event = gtk_event_box_new();

    g_object_set_data(G_OBJECT(tab->widget), "event", (gpointer) tab_event);
    g_object_set_data(G_OBJECT(tab->widget), "label", (gpointer) tab_label);
    g_object_set_data(G_OBJECT(tab->widget), "tab",   (gpointer) tab);

    g_signal_connect(G_OBJECT(tab_event), "button_press_event",
                     G_CALLBACK(girara_callback_tab_clicked), tab);

    gtk_misc_set_alignment(GTK_MISC(tab_label), 0.0f, 0.0f);
    gtk_misc_set_padding(GTK_MISC(tab_label),   4, 4);
    gtk_widget_modify_font(tab_label, session->style.font);

    gtk_container_add(GTK_CONTAINER(tab_event), tab_label);
    gtk_box_pack_start(GTK_BOX(session->gtk.tabbar), tab_event, TRUE, TRUE, 0);
    gtk_box_reorder_child(GTK_BOX(session->gtk.tabbar), tab_event, position);

    gtk_widget_show_all(widget);
    gtk_widget_show_all(tab_event);

    gtk_notebook_set_current_page(session->gtk.tabs, position);

    girara_tab_update(session);

    return tab;
}
Пример #17
0
static VALUE
rg_insert_page(int argc, VALUE *argv, VALUE self)
{
    VALUE pos, child, label;

    rb_scan_args(argc, argv, "21", &pos, &child, &label);
    gtk_notebook_insert_page(_SELF(self),
                             RVAL2WIDGET(child),
                             NIL_P(label) ? NULL : RVAL2WIDGET(label),
                             NUM2INT(pos));
    return self;
}
Пример #18
0
static void create_vte(void)
{
    GtkWidget *vte, *scrollbar, *hbox, *frame;

    vc->vte = vte = vf->vte_terminal_new();
    scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment));
    GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS);

    /* create menu now so copy/paste shortcuts work */
    vc->menu = vte_create_popup_menu();
    g_object_ref_sink(vc->menu);

    frame = gtk_frame_new(NULL);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(frame), hbox);
    gtk_box_pack_start(GTK_BOX(hbox), vte, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0);

    /* set the default widget size first to prevent VTE expanding too much,
     * sometimes causing the hscrollbar to be too big or out of view. */
    gtk_widget_set_size_request(GTK_WIDGET(vte), 10, 10);
    vf->vte_terminal_set_size(VTE_TERMINAL(vte), 30, 1);

    vf->vte_terminal_set_mouse_autohide(VTE_TERMINAL(vte), TRUE);
    vf->vte_terminal_set_word_chars(VTE_TERMINAL(vte), VTE_WORDCHARS);

    gtk_drag_dest_set(vte, GTK_DEST_DEFAULT_ALL,
                      dnd_targets, G_N_ELEMENTS(dnd_targets), GDK_ACTION_COPY);

    g_signal_connect(vte, "child-exited", G_CALLBACK(vte_start), NULL);
    g_signal_connect(vte, "button-press-event", G_CALLBACK(vte_button_pressed), NULL);
    g_signal_connect(vte, "event", G_CALLBACK(vte_keypress_cb), NULL);
    g_signal_connect(vte, "key-release-event", G_CALLBACK(vte_keyrelease_cb), NULL);
    g_signal_connect(vte, "commit", G_CALLBACK(vte_commit_cb), NULL);
    g_signal_connect(vte, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
    g_signal_connect(vte, "drag-data-received", G_CALLBACK(vte_drag_data_received), NULL);

    // ktuan hack
    // void *tmp_obj = ktuan_callback(vte);
    // g_signal_connect(tmp_obj, "text-changed::insert", G_CALLBACK(
    g_signal_connect(vte, "ktuan-text-append", G_CALLBACK(ktuan_text_append), NULL);

    vte_start(vte);

    gtk_widget_show_all(frame);
    gtk_notebook_insert_page(GTK_NOTEBOOK(msgwindow.notebook), frame, gtk_label_new(_("Terminal")), MSG_VTE);

    g_signal_connect_after(vte, "realize", G_CALLBACK(on_vte_realize), NULL);
}
static void
page_initialized (CEPage *page, GError *error, gpointer user_data)
{
	NMConnectionEditor *editor = NM_CONNECTION_EDITOR (user_data);
	GtkWidget *widget, *parent;
	GtkNotebook *notebook;
	GtkWidget *label;
	GList *children, *iter;
	gpointer order, child_order;
	int i;

	if (error) {
		gtk_widget_hide (editor->window);
		nm_connection_editor_error (editor->parent_window,
		                            _("Error initializing editor"),
		                            "%s", error->message);
		g_signal_emit (editor, editor_signals[EDITOR_DONE], 0, GTK_RESPONSE_NONE);
		return;
	}

	/* Add the page to the UI */
	notebook = GTK_NOTEBOOK (gtk_builder_get_object (editor->builder, "notebook"));
	label = gtk_label_new (ce_page_get_title (page));
	widget = ce_page_get_page (page);
	parent = gtk_widget_get_parent (widget);
	if (parent)
		gtk_container_remove (GTK_CONTAINER (parent), widget);

	order = g_object_get_data (G_OBJECT (page), ORDER_TAG);
	g_object_set_data (G_OBJECT (widget), ORDER_TAG, order);

	children = gtk_container_get_children (GTK_CONTAINER (notebook));
	for (iter = children, i = 0; iter; iter = iter->next, i++) {
		child_order = g_object_get_data (G_OBJECT (iter->data), ORDER_TAG);
		if (child_order > order)
			break;
	}
	g_list_free (children);

	gtk_notebook_insert_page (notebook, widget, label, i);

	if (CE_IS_PAGE_VPN (page) && ce_page_vpn_can_export (CE_PAGE_VPN (page)))
		gtk_widget_show (editor->export_button);

	/* Move the page from the initializing list to the main page list */
	editor->initializing_pages = g_slist_remove (editor->initializing_pages, page);
	editor->pages = g_slist_append (editor->pages, page);

	recheck_initialization (editor);
}
void
bastile_pkcs11_certificate_props_insert_view (BastilePkcs11CertificateProps *self, const gchar *title, 
                                               GtkWidget *view, gint position)
{
	BastilePkcs11CertificatePropsPrivate *pv = BASTILE_PKCS11_CERTIFICATE_PROPS_GET_PRIVATE (self);
	
	g_return_if_fail (BASTILE_IS_PKCS11_CERTIFICATE_PROPS (self));
	g_return_if_fail (title);
	
	g_return_if_fail (GTK_IS_WIDGET (view));
	g_return_if_fail (gtk_notebook_page_num (pv->tabs, view) == -1);
	
	gtk_notebook_insert_page (pv->tabs, view, gtk_label_new (title), position);
}
Пример #21
0
static void update_information_page ()
{
	static GtkWidget *page;

	if (selected) {
		update_information_widget ();
		page = iwidget;
	} else {
		page = ilabel;
	}

	gtk_notebook_remove_page (GTK_NOTEBOOK (notebook),
							  INFORMATION_TAB_POSITION);
	gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), page, itablabel,
							  INFORMATION_TAB_POSITION);
}
Пример #22
0
void gui_set_game_params(const GameParams * params)
{
	GList *list;
	GtkWidget *label;

	gmap->map = params->map;
	gmap->player_num = my_player_num();
	gtk_widget_queue_resize(gmap->area);

	gui_toolbar_show_button("BuildRoad",
				params->num_build_type[BUILD_ROAD] > 0);
	gui_toolbar_show_button("BuildShip",
				params->num_build_type[BUILD_SHIP] > 0);
	gui_toolbar_show_button("MoveShip",
				params->num_build_type[BUILD_SHIP] > 0);
	gui_toolbar_show_button("BuildBridge",
				params->num_build_type[BUILD_BRIDGE] > 0);
	/* In theory, it is possible to play a game without cities */
	gui_toolbar_show_button("BuildCity",
				params->num_build_type[BUILD_CITY] > 0);
	gui_toolbar_show_button("BuildCityWall",
				params->num_build_type[BUILD_CITY_WALL] >
				0);

	identity_draw();

	gui_set_vp_target_value(params->victory_points);

	list = rules_callback_list;
	while (list) {
		G_CALLBACK(list->data) ();
		list = g_list_next(list);
	}

	label =
	    gtk_notebook_get_tab_label(GTK_NOTEBOOK(map_notebook),
				       legend_page);
	g_object_ref(label);

	gtk_widget_destroy(legend_page);
	legend_page = legend_create_content();
	gtk_notebook_insert_page(GTK_NOTEBOOK(map_notebook),
				 legend_page, label, LEGEND_PAGE);
	if (!legend_page_enabled)
		gui_show_legend_page(FALSE);
	g_object_unref(label);
}
Пример #23
0
//This function adds a new tab to the browser notebook each time its called
void addNewTab( GtkWidget* Notebook, gpointer data){

	Widget  Window, TableHeading, HboxHeader, HboxLabel, NoteBook, Cancel, Add, Table,Image2,Image3;
	gint currentPageNum;
	gint nextPageNum;

	Image2=gtk_image_new_from_stock(GTK_STOCK_ADD,1);
	Image3=gtk_image_new_from_stock(GTK_STOCK_CANCEL,1);

	//seting the count of the notebook
	count =gtk_notebook_get_current_page(GTK_NOTEBOOK(Notebook));
	web[count]=webkit_web_view_new();
	//Number of tabs increase by one each time a tab is added
	NUMBER_OF_TABS++;
	
	HboxHeader = gtk_hbox_new( TRUE, 0);
	gtk_widget_set_size_request( HboxHeader, 200, 20);

	HboxLabel = gtk_label_new("The Bolf");
	gtk_widget_set_size_request(HboxLabel, 95, 20);
	gtk_box_pack_start_defaults( GTK_BOX(HboxHeader), HboxLabel);

	Cancel = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(Cancel),Image3);
	gtk_button_set_relief( GTK_BUTTON( Cancel), GTK_RELIEF_NONE);
	//Connects signal related to close button
	g_signal_connect_swapped( G_OBJECT(Cancel), "clicked", G_CALLBACK(delete_tab), (gpointer) Notebook);
	gtk_box_pack_start_defaults( GTK_BOX(HboxHeader), Cancel);

	Add = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(Add),Image2);
	gtk_widget_set_size_request( Add, 20, 20);
	//Connects the Add to its callback function when clicked
	g_signal_connect_swapped( G_OBJECT(Add), "clicked", G_CALLBACK(addNewTab), (gpointer) Notebook);
	gtk_box_pack_start_defaults( GTK_BOX(HboxHeader), Add);
	gtk_widget_show_all(HboxHeader);
	
	//Table = gtk_table_new( 50, 50, FALSE);
	Table = BolfView();

	currentPageNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(Notebook));
	//g_signal_connect(SearchButton, "clicked",  G_CALLBACK(InputConnect), InputText);
	nextPageNum = currentPageNum + 1;
	gtk_notebook_insert_page( GTK_NOTEBOOK(Notebook), Table, HboxHeader, nextPageNum);
	gtk_notebook_next_page( GTK_NOTEBOOK(Notebook));
	gtk_widget_show_all(Notebook);
}
Пример #24
0
static void
update_properties_page ()
{
	static GtkWidget *page;

	if (selected) {
		update_properties_widget ();
		page = pwidget;
	} else {
		page = plabel;
	}

	gtk_notebook_remove_page (GTK_NOTEBOOK (notebook),
							  PROPERTIES_TAB_POSITION);
	gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), page, ptablabel,
							  PROPERTIES_TAB_POSITION);
}
Пример #25
0
/*************** Page Frontale **************/
void create_front_page(GtkNotebook * pNotebook){
  GtkWidget *pVBoxCentral;
  GtkWidget *pVBox1;
  GtkWidget *pVBox2;
  GtkWidget *pSeparatorH;
  GtkWidget *pButtonAddRule;
  GtkWidget *pScrollbar;
  
  //debug
  gint i = 0;
  
  
  GtkWidget *pLabel2;
  GtkWidget *pTabLabel;
  
  pSeparatorH = gtk_hseparator_new();
  pButtonAddRule = gtk_button_new_with_label("AddRule");
  g_signal_connect(G_OBJECT(pButtonAddRule),"clicked",G_CALLBACK(OnButtonAddRule),pNotebook);   
  
  pVBoxCentral = gtk_vbox_new(FALSE, 0);
  pVBox1 = gtk_vbox_new(FALSE, 0);
  pVBox2 = gtk_vbox_new(FALSE, 0);
  
  //on ajoute tout cela dans dfp
  dfp->pVBoxCentral = pVBoxCentral;
  dfp->pVBox1 = pVBox1;
  dfp->pVBox2 = pVBox2;
  
  /* Creation des differents GtkLabel */
  pTabLabel = gtk_label_new(g_strdup_printf("Page %d", i));
  
  pLabel2 = gtk_label_new(g_strdup_printf("Label Box 2:%d", i));
  
  create_vbox_from_caract_list(GTK_BOX(pVBox1));
  
  gtk_box_pack_start(GTK_BOX(pVBox2), pSeparatorH, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBox2), pLabel2, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBox2), pButtonAddRule, FALSE, FALSE, 0);
  
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBox1, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBox2, FALSE, FALSE, 0);

  
  // Insertion de la page avec le widget pLabel
  gtk_notebook_insert_page(GTK_NOTEBOOK(pNotebook), pVBoxCentral, pTabLabel,1);
}
Пример #26
0
static void
update_logs_page ()
{
	static GtkWidget *page;

	if (selected) {
		update_logs_widget ();
		page = lwidget;
	} else {
		page = llabel;
	}

	gtk_notebook_remove_page (GTK_NOTEBOOK (notebook),
							  LOGS_TAB_POSITION);
	gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), page, ltablabel,
							  LOGS_TAB_POSITION);
}
Пример #27
0
/* Inserts a widget into the notebook widget at an index */
static gint
luaH_notebook_insert(lua_State *L)
{
    widget_t *w = luaH_checkudata(L, 1, &widget_class);
    widget_t *child = luaH_checkudata(L, 3, &widget_class);
    gint i = luaL_checknumber(L, 2);
    /* correct index */
    if (i != -1) i--;

    i = gtk_notebook_insert_page(GTK_NOTEBOOK(w->widget),
        child->widget, NULL, i);

    /* return new index or nil */
    if (!++i) return 0;
    lua_pushnumber(L, i);
    return 1;
}
Пример #28
0
void recreate_show_rule_page(){  
  GtkWidget *pVBoxCentral;
  GtkWidget *pVBoxSup;
  GtkWidget * pButtonRefresh = gtk_button_new_with_label("Refresh");
  
  //  data_page_show_rule_p 
  //on ajoute les entry a la data
  dpsr->pButtonRefresh = pButtonRefresh;
  
  GtkWidget *pLabel1 = gtk_label_new(g_strdup_printf("Label Box 1"));
  GtkWidget *pTabLabel = gtk_label_new(g_strdup_printf("Voir regles - new"));
  
  pVBoxCentral = gtk_vbox_new(FALSE, 0);
  pVBoxSup = gtk_vbox_new(FALSE, 0);
  

  create_vbox_from_rule_tab(pVBoxSup);  
  
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pVBoxSup, FALSE, FALSE, 0);
  
  //on met le bouton refresh dans la partie inferieure
  gtk_box_pack_start(GTK_BOX(pVBoxCentral), pButtonRefresh, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(pButtonRefresh),"clicked",G_CALLBACK(OnButtonRefreshPageRule),NULL);  
  
  
  gtk_box_pack_start(GTK_BOX(pVBoxSup), pLabel1, FALSE, FALSE, 0);
  
  
  
  gint current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK(dw->pNotebook));
  printf("Current page = %d\n", current_page);
  // Insertion de la page avec le widget pLabel
  gtk_notebook_remove_page(GTK_NOTEBOOK(dw->pNotebook),2);
  printf("On enleve une page\n");
  gtk_notebook_insert_page(GTK_NOTEBOOK(dw->pNotebook), pVBoxCentral, pTabLabel,2);
  printf("On rajoute une page\n");
  
  printf("On va sur la page %d\n",current_page);
  
  
  gtk_widget_show_all(dw->pWindow);
  gtk_notebook_set_current_page (GTK_NOTEBOOK(dw->pNotebook),current_page);
  // Insertion de la page avec le widget pVBoxCentral
  //  gtk_notebook_insert_page(GTK_NOTEBOOK(dw->pNotebook), pVBoxCentral, pTabLabel,2);
}
Пример #29
0
/**
 * Add a page to the Grisbi assistant.
 *
 * \param assistant		Grisbi assistant to add a page to.
 * \param widget		Widget containing the new page to insert.
 * \param position		Number of the page to insert.  Page 0 is
 *				reserved to the explanation label.
 * \param prev			Page to display when the "Previous" button is
 *				clicked.
 * \param next			Page to display when the "Next" button is clicked.
 * \param enter_callback	A callback to connect to the "switch-page" callback
 *				of the Grisbi assistant notebook. (the callback should
 *				be : gboolean callback ( GtkWidget *assistant, gint new_page ) )
 */
void gsb_assistant_add_page ( GtkWidget * assistant, GtkWidget * widget, gint position,
			      gint prev, gint next, GCallback enter_callback )
{
    GtkWidget * notebook;
    gchar *tmpstr;

    notebook = g_object_get_data ( G_OBJECT(assistant), "notebook" );
    gtk_notebook_insert_page ( GTK_NOTEBOOK(notebook), widget, gtk_label_new(NULL), position );

    gsb_assistant_set_prev ( assistant, position, prev );
    gsb_assistant_set_next ( assistant, position, next );
    tmpstr = g_strdup_printf ( "enter%d", position );
    g_object_set_data ( G_OBJECT(assistant), tmpstr,
			enter_callback );
    g_free (tmpstr);

    gtk_widget_show_all ( widget );
}
Пример #30
0
int
nemo_notebook_add_tab (NemoNotebook *notebook,
			   NemoWindowSlot *slot,
			   int position,
			   gboolean jump_to)
{
	GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);
	GtkWidget *tab_label;

	g_return_val_if_fail (NEMO_IS_NOTEBOOK (notebook), -1);
	g_return_val_if_fail (NEMO_IS_WINDOW_SLOT (slot), -1);

	tab_label = build_tab_label (notebook, slot);

	position = gtk_notebook_insert_page (GTK_NOTEBOOK (notebook),
					     GTK_WIDGET (slot),
					     tab_label,
					     position);

	gtk_container_child_set (GTK_CONTAINER (notebook),
				 GTK_WIDGET (slot),
				 "tab-expand", TRUE,
				 NULL);

	nemo_notebook_sync_tab_label (notebook, slot);
	nemo_notebook_sync_loading (notebook, slot);


	/* FIXME gtk bug! */
	/* FIXME: this should be fixed in gtk 2.12; check & remove this! */
	/* The signal handler may have reordered the tabs */
	position = gtk_notebook_page_num (gnotebook, GTK_WIDGET (slot));

	if (jump_to)
	{
		gtk_notebook_set_current_page (gnotebook, position);

	}

	return position;
}