Ejemplo n.º 1
0
ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright ){
	auto hsplit = ui::HPaned(ui::New);
	hsplit.show();

	hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned );
	hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_hpaned );

	{
		auto vsplit = ui::VPaned(ui::New);
		gtk_paned_add1( GTK_PANED( hsplit ), vsplit  );
		vsplit.show();

		vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned1 );
		vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned1 );

		gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( topleft  ) );
		gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( topright  ) );
	}
	{
		auto vsplit = ui::VPaned(ui::New);
		gtk_paned_add2( GTK_PANED( hsplit ), vsplit  );
		vsplit.show();

		vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_vpaned2 );
		vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_vpaned2 );

		gtk_paned_add1( GTK_PANED( vsplit ), create_framed_widget( botleft  ) );
		gtk_paned_add2( GTK_PANED( vsplit ), create_framed_widget( botright  ) );
	}
	return hsplit;
}
Ejemplo n.º 2
0
int main(int argc,char *argv[ ])
{
    GtkWidget *window, *paned1, *paned2, *paned3;
    GtkWidget *button;

    gtk_init(&argc,&argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect(GTK_OBJECT(window),"delete_event",G_CALLBACK(gtk_main_quit),NULL);

    paned1 = gtk_vpaned_new();
    gtk_container_add(GTK_CONTAINER(window), paned1);

    paned2 = gtk_hpaned_new();
    gtk_paned_add1(GTK_PANED(paned1),paned2);

    button = gtk_button_new_with_label("Button1");
    gtk_paned_add2(GTK_PANED(paned1),button);

    button = gtk_button_new_with_label("Button2");
    gtk_paned_add1(GTK_PANED(paned2),button);

    paned3 = gtk_vpaned_new();
    gtk_paned_add2(GTK_PANED(paned2),paned3);

    button = gtk_button_new_with_label("Button3");
    gtk_paned_add1(GTK_PANED(paned3),button);

    button = gtk_button_new_with_label("Button4");
    gtk_paned_add2(GTK_PANED(paned3),button);

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}
Ejemplo n.º 3
0
static int hview_init(void)
{
      GtkWidget		*menubar;
      GtkWidget		*toolbar;
      GtkWidget		*statusbar;
      GtkWidget		*vpaned;
      GtkWidget		*hpaned;
      GtkWidget		*main_vbox;

// Create main window ---------------------------------------------------------
      main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      g_signal_connect(G_OBJECT(main_window), "destroy",
		       G_CALLBACK(gtk_main_quit),
		       NULL);
      gtk_window_set_title(GTK_WINDOW(main_window), HVIEW_TITLE);
      gtk_widget_set_size_request(GTK_WIDGET(main_window),
				  HVIEW_MAIN_WINDOW_WIDTH,
				  HVIEW_MAIN_WINDOW_HEIGHT);
//-----------------------------------------------------------------------------

      main_vbox = gtk_vbox_new(FALSE, 1);
      gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
      gtk_container_add(GTK_CONTAINER(main_window), main_vbox);

      menubar = hview_get_menubar();
      gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, FALSE, 0);

      vpaned = gtk_vpaned_new();
      hpaned = gtk_hpaned_new();

// Create scrolled "tree window" and add it to horizontal paned window --------
      tree_window = hview_get_tree_window();
      gtk_paned_add1(GTK_PANED(hpaned), tree_window);
//-----------------------------------------------------------------------------

// Create scrolled "detail window" and add it to hpaned window ----------------
      detail_window = hview_get_detail_window();
      gtk_paned_add2(GTK_PANED(hpaned), detail_window);
//-----------------------------------------------------------------------------

// Create scrolled "log window" and add it with hpaned window to vertical paned
      log_window = hview_get_log_window();
      gtk_text_view_set_editable(GTK_TEXT_VIEW(log_view), FALSE);
      gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(log_view), FALSE);
      hview_print(HVIEW_NAME_VERSION);
      gtk_paned_add1(GTK_PANED(vpaned), hpaned);
      gtk_paned_add2(GTK_PANED(vpaned), log_window);
//-----------------------------------------------------------------------------

      gtk_box_pack_start(GTK_BOX(main_vbox), vpaned, TRUE, TRUE, 0);

      gtk_widget_show_all(main_window);

      return 0;
}
Ejemplo n.º 4
0
int
main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *vpaned;
    GtkWidget *list;
    GtkWidget *text;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
    gtk_container_border_width (GTK_CONTAINER (window), 10);
   
    /* vpaned widget을 만들어서 toplevel 윈도에 더한다. */
   
    vpaned = gtk_vpaned_new ();
    gtk_container_add (GTK_CONTAINER(window), vpaned);
    gtk_widget_show (vpaned);
   
    /* 이제 윈도 두 부분의 내용을 만든다. */
   
    list = create_list ();
    gtk_paned_add1 (GTK_PANED(vpaned), list);
    gtk_widget_show (list);
   
    text = create_text ();
    gtk_paned_add2 (GTK_PANED(vpaned), text);
    gtk_widget_show (text);
    gtk_widget_show (window);
    gtk_main ();
    return 0;
}
Ejemplo n.º 5
0
int main(int argc, char** argv)
{
    GtkWidget *window;
    GtkWidget *scrolled;
    GtkWidget *text;
    GtkWidget *paned;

    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_widget_set_size_request(window, 400, 300);
    g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);

    paned = gtk_hpaned_new();
    gtk_container_add(GTK_CONTAINER(window), paned);

    scrolled = gtk_scrolled_window_new(NULL, NULL);
    gtk_paned_add1(GTK_PANED(paned), scrolled);

    text = gtk_text_view_new();
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), text);

    scrolled = gtk_scrolled_window_new(NULL, NULL);
    gtk_paned_add2(GTK_PANED(paned), scrolled);

    text = gtk_text_view_new();
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), text);

    gtk_widget_show_all(window);
    gtk_main();
    return 0;
}
Ejemplo n.º 6
0
int main(int argc, char *argv[])
{
    GtkWidget *window, *hpaned, *button1, *button2;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Panes");

    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
    gtk_widget_set_size_request(window, 225, 150);

    hpaned  = gtk_hpaned_new();
    button1 = gtk_button_new_with_label("Resize");
    button2 = gtk_button_new_with_label("Me!");

    g_signal_connect_swapped(G_OBJECT(button1), "clicked",
                             G_CALLBACK(gtk_widget_destroy),
                             (gpointer) window);
    g_signal_connect_swapped(G_OBJECT(button2), "clicked",
                             G_CALLBACK(gtk_widget_destroy),
                             (gpointer) window);

    gtk_paned_add1(GTK_PANED(hpaned), button1);
    gtk_paned_add2(GTK_PANED(hpaned), button2);

    gtk_container_add(GTK_CONTAINER(window), hpaned);
    gtk_widget_show_all(window);

    gtk_main();
    return 0;
}
Ejemplo n.º 7
0
static void phidias_items_classic_init (PhidiasItemsClassic *item)
{
    GtkWidget *scroll;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *col;
    GtkTreeSelection *selection;

    item->priv = PHIDIAS_ITEMS_CLASSIC_GET_PRIVATE (item);

    item->priv->list = gtk_tree_view_new ();
    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (item->priv->list), FALSE);

    renderer = gtk_cell_renderer_text_new ();
    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", ITEM_INFO_TITLE, NULL);
    gtk_tree_view_column_set_cell_data_func (col, renderer, set_line_style, NULL, NULL);
    gtk_tree_view_append_column (GTK_TREE_VIEW (item->priv->list), col);

    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (item->priv->list));
    gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
    g_signal_connect (selection, "changed", G_CALLBACK (item_selected_cb), item);

    scroll = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), item->priv->list);
    gtk_paned_add1 (GTK_PANED (item), scroll);

    item->priv->description = webkit_web_view_new ();
    scroll = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), item->priv->description);
    gtk_paned_add2 (GTK_PANED (item), scroll);
}
Ejemplo n.º 8
0
void EClassTree::populateWindow() {
	// Create the overall vbox
	_dialogVBox = gtk_vbox_new(FALSE, 12);
	gtk_container_add(GTK_CONTAINER(getWindow()), _dialogVBox);
	
	GtkWidget* paned = gtk_hpaned_new();
	gtk_box_pack_start(GTK_BOX(_dialogVBox), paned, TRUE, TRUE, 0);
	
	// Pack tree view
	gtk_paned_add1(GTK_PANED(paned), createEClassTreeView());
	
	// Pack spawnarg treeview
	gtk_paned_add2(GTK_PANED(paned), GTK_WIDGET(createPropertyTreeView()));
	
	// Pack in dialog buttons
	gtk_box_pack_start(GTK_BOX(_dialogVBox), createButtons(), FALSE, FALSE, 0);
	
	// Set the default size of the window
	GtkWindow* mainWindow = GlobalMainFrame().getTopLevelWindow();
	GdkRectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow);
	gtk_window_set_default_size(
		GTK_WINDOW(getWindow()), gint(rect.width * 0.8f), gint(rect.height * 0.8f)
	);

	gtk_paned_set_position(GTK_PANED(paned), static_cast<gint>(rect.width * 0.25f));
}
Ejemplo n.º 9
0
void create_Window()
{
	
	bdk_window.fenster = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect(GTK_OBJECT(bdk_window.fenster), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
	//g_signal_connect (G_OBJECT (fenster), "delete_event", G_CALLBACK (delete_event), NULL);
	gtk_window_set_title (GTK_WINDOW(bdk_window.fenster), "Bilddatenkompression(BDK) Tool");
	gtk_widget_set_size_request (GTK_WIDGET(bdk_window.fenster), 600, 600);

	/* Make a vbox to put the three menus in */
	bdk_window.main_vbox = gtk_vbox_new (FALSE, 1);
	gtk_container_set_border_width (GTK_CONTAINER (bdk_window.main_vbox), 1);
	gtk_container_add (GTK_CONTAINER (bdk_window.fenster), bdk_window.main_vbox);

	create_menubar_menu();
	create_toolbar_menu();

	bdk_window.image			= gtk_image_new_from_file("C:\\Dokumente und Einstellungen\\uwe_work\\Eigene Dateien\\Eigene Bilder\\Battlestar\\battlestargalpic_01.jpg");
	bdk_window.scrolled_window	= gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (bdk_window.scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (bdk_window.scrolled_window), bdk_window.image);

	bdk_window.hpaned = gtk_hpaned_new();
	create_view_and_model();
	gtk_paned_add1(GTK_PANED(bdk_window.hpaned), bdk_window.view);
	gtk_paned_add2(GTK_PANED(bdk_window.hpaned), bdk_window.scrolled_window);
	gtk_box_pack_start (GTK_BOX (bdk_window.main_vbox), bdk_window.hpaned, TRUE, TRUE, 0);
}
Ejemplo n.º 10
0
static void fm_tab_page_init(FmTabPage *page)
{
    GtkPaned* paned = GTK_PANED(page);
    FmTabLabel* tab_label;
    FmFolderView* folder_view;
    GList* focus_chain = NULL;
    FmSidePaneMode mode = app_config->side_pane_mode;

    page->side_pane = fm_side_pane_new();
    fm_side_pane_set_mode(page->side_pane, (mode & FM_SP_MODE_MASK));
    /* TODO: add a close button to side pane */
    gtk_paned_add1(paned, GTK_WIDGET(page->side_pane));
    focus_chain = g_list_prepend(focus_chain, page->side_pane);

    /* handlers below will be used when FmMainWin detects new page added */
    folder_view = (FmFolderView*)fm_standard_view_new(app_config->view_mode,
                                                      update_files_popup,
                                                      open_folder_func);
    page->folder_view = folder_view;
    fm_folder_view_set_selection_mode(folder_view, GTK_SELECTION_MULTIPLE);
    page->nav_history = fm_nav_history_new();
    gtk_paned_add2(paned, GTK_WIDGET(page->folder_view));
    focus_chain = g_list_prepend(focus_chain, page->folder_view);

    /* We need this to change tab order to focus folder view before left pane. */
    gtk_container_set_focus_chain(GTK_CONTAINER(page), focus_chain);
    g_list_free(focus_chain);

    gtk_widget_show_all(GTK_WIDGET(page));
    if(mode & FM_SP_HIDE)
        gtk_widget_hide(GTK_WIDGET(page->side_pane));

    /* create tab label */
    tab_label = (FmTabLabel*)fm_tab_label_new("");
    gtk_label_set_max_width_chars(tab_label->label, app_config->max_tab_chars);
#if ! GTK_CHECK_VERSION(3, 0, 0)
    gtk_label_set_ellipsize(tab_label->label, PANGO_ELLIPSIZE_END);
#endif
    page->tab_label = tab_label;

    g_signal_connect(page->folder_view, "sel-changed",
                     G_CALLBACK(on_folder_view_sel_changed), page);
    /*
    g_signal_connect(page->folder_view, "chdir",
                     G_CALLBACK(on_folder_view_chdir), page);
    g_signal_connect(page->folder_view, "loaded",
                     G_CALLBACK(on_folder_view_loaded), page);
    g_signal_connect(page->folder_view, "error",
                     G_CALLBACK(on_folder_view_error), page);
    */

    /* the folder view is already loded, call the "loaded" callback ourself. */
    //if(fm_folder_view_is_loaded(folder_view))
    //    on_folder_view_loaded(folder_view, fm_folder_view_get_cwd(folder_view), page);
}
Ejemplo n.º 11
0
static GtkWidget* CreateMainContainer_(void)
{
    GtkWidget*  container = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
    GtkWidget*  leftPane = GStreamerSink_Create();
    GtkWidget*  rightPane = LeaderBoardsUi_Create();

    gtk_paned_add1(GTK_PANED(container), leftPane);    
    gtk_paned_add2(GTK_PANED(container), rightPane);
    
    return container;
} // CreateMainContainer_
Ejemplo n.º 12
0
/* Add a child to the top or left pane with default parameters.
 * This is equivalent to gtk_paned_pack1(paned, FALSE, TRUE); */
int
clip_GTK_PANEDADD1(ClipMachine * cm)
{
	C_widget *cpan = _fetch_cw_arg(cm);
	C_widget *cwid = _fetch_cwidget(cm,_clip_spar(cm,2));
	CHECKCWID(cpan,GTK_IS_PANED);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_paned_add1(GTK_PANED(cpan->widget), cwid->widget);
	return 0;
err:
	return 1;
}
Ejemplo n.º 13
0
extern void populate_window(void)
{
	gtk_container_add( GTK_CONTAINER(window), pane );
	gtk_paned_add1( GTK_PANED(pane), lpane );
	gtk_paned_add2( GTK_PANED(pane), rgrid );

	gtk_paned_add1( GTK_PANED(lpane), history_scrollbox );
	gtk_paned_add2( GTK_PANED(lpane), input_scrollbox );
	gtk_container_add( GTK_CONTAINER(history_scrollbox), history_view );
	gtk_container_add( GTK_CONTAINER(input_scrollbox), input_view );

	gtk_grid_attach( GTK_GRID(rgrid), button_contacts, 0, 0, 1, 1 );
	gtk_grid_attach( GTK_GRID(rgrid), button_chats, 1, 0, 1, 1 );
	gtk_grid_attach( GTK_GRID(rgrid), button_settings, 2, 0, 1, 1 );

	gtk_grid_attach( GTK_GRID(rgrid), label, 0, 1, 3, 1 );
	gtk_grid_attach( GTK_GRID(rgrid), list, 0, 1, 3, 1 );
	gtk_widget_show(label);
	togglestatus = FALSE;
	label_was_visible = TRUE;
	gtk_grid_attach( GTK_GRID(rgrid), button_add_contact, 0, 2, 3, 1 );

	return;
}
Ejemplo n.º 14
0
static void
activate (GtkApplication *app,
          gpointer        user_data)
{
    GtkWidget *window;
    GtkWidget *frame;
    GtkWidget *drawing_area;
    GtkWidget *chooser_button;

    window = gtk_application_window_new (app);
    gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");

    g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);

    gtk_container_set_border_width (GTK_CONTAINER (window), 8);

    frame = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
    gtk_container_add (GTK_CONTAINER (window), frame);

    chooser_button = gtk_file_chooser_button_new("Select problem...", GTK_FILE_CHOOSER_ACTION_OPEN);

    drawing_area = gtk_drawing_area_new ();
    /* set a minimum size */
    gtk_widget_set_size_request (drawing_area, 800, 800);

    gtk_paned_add1(GTK_PANED(frame), drawing_area);
    gtk_paned_add2(GTK_PANED(frame), chooser_button);

    /* Signals used to handle the backing surface */
    g_signal_connect (drawing_area, "draw",
                      G_CALLBACK (draw_cb), NULL);
    g_signal_connect (drawing_area,"configure-event",
                      G_CALLBACK (configure_event_cb), NULL);
    g_signal_connect(drawing_area, "button_press_event",
                      G_CALLBACK(button_press_event_cb), NULL);
    g_signal_connect(chooser_button, "file-set",
                         G_CALLBACK(set_file), chooser_button);

    /* Ask to receive events the drawing area doesn't normally
     * subscribe to. In particular, we need to ask for the
     * button press and motion notify events that want to handle.
     */
    gtk_widget_set_events (drawing_area, gtk_widget_get_events (drawing_area)
                                         | GDK_BUTTON_PRESS_MASK
                                         | GDK_POINTER_MOTION_MASK);

    gtk_widget_show_all (window);
}
Ejemplo n.º 15
0
/**
 * schema_browser_perspective_new
 *
 * Creates new #BrowserPerspective widget which 
 */
BrowserPerspective *
schema_browser_perspective_new (BrowserWindow *bwin)
{
	TConnection *tcnc;
	BrowserPerspective *bpers;
	SchemaBrowserPerspective *perspective;
	gboolean fav_supported;

	bpers = (BrowserPerspective*) g_object_new (TYPE_SCHEMA_BROWSER_PERSPECTIVE, NULL);
	perspective = (SchemaBrowserPerspective*) bpers;
	tcnc = browser_window_get_connection (bwin);
	fav_supported = t_connection_get_favorites (tcnc) ? TRUE : FALSE;
	perspective->priv->bwin = bwin;

	/* contents */
	GtkWidget *paned, *wid, *nb;
	paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
	if (fav_supported) {
		wid = favorite_selector_new (tcnc);
		g_signal_connect (wid, "selection-changed",
				  G_CALLBACK (fav_selection_changed_cb), bpers);
		gtk_paned_add1 (GTK_PANED (paned), wid);
		gtk_paned_set_position (GTK_PANED (paned), DEFAULT_FAVORITES_SIZE);
		perspective->priv->favorites = wid;
	}

	nb = browser_perspective_create_notebook (bpers);
	perspective->priv->notebook = nb;
	gtk_paned_add2 (GTK_PANED (paned), nb);

	wid = objects_index_new (tcnc);
	g_signal_connect (wid, "selection-changed",
			  G_CALLBACK (objects_index_selection_changed_cb), bpers);
	gtk_notebook_append_page (GTK_NOTEBOOK (nb), wid,
				  ui_make_tab_label_with_icon (_("Index"), "help-about", FALSE, NULL));
	gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (nb), wid, TRUE);
	gtk_notebook_set_group_name (GTK_NOTEBOOK (nb), "schema-browser");

	gtk_notebook_set_menu_label (GTK_NOTEBOOK (nb), wid,
				     ui_make_tab_label_with_icon (_("Index"), "help-about", FALSE, NULL));
	gtk_box_pack_start (GTK_BOX (bpers), paned, TRUE, TRUE, 0);
	gtk_widget_show_all (paned);

	if (perspective->priv->favorites && !perspective->priv->favorites_shown)
		gtk_widget_hide (perspective->priv->favorites);

	return bpers;
}
Ejemplo n.º 16
0
static GtkWidget *
mug_query_area (MugData * mugdata)
{
	GtkWidget *queryarea;
	GtkWidget *paned;
	GtkWidget *scrolled;

#ifdef HAVE_GTK3
	queryarea = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
#else
	queryarea = gtk_vbox_new (FALSE, 2);
	paned = gtk_vpaned_new ();
#endif /*!HAVE_GTK3 */


	mugdata->mlist = mug_msg_list_view_new
		(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB));
	scrolled = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);

	gtk_container_add (GTK_CONTAINER (scrolled), mugdata->mlist);
	gtk_paned_add1 (GTK_PANED (paned), scrolled);

	mugdata->msgview = mug_msg_view_new ();

	mug_msg_view_set_msg (MUG_MSG_VIEW (mugdata->msgview), NULL);
	g_signal_connect (G_OBJECT (mugdata->mlist), "msg-selected",
			  G_CALLBACK (on_msg_selected), mugdata);
	g_signal_connect (G_OBJECT (mugdata->mlist), "error-occured",
			  G_CALLBACK (on_list_view_error), mugdata);
	gtk_paned_add2 (GTK_PANED (paned), mugdata->msgview);

	mugdata->querybar = mug_querybar ();
	g_signal_connect (G_OBJECT (mugdata->querybar), "query-changed",
			  G_CALLBACK (on_query_changed), mugdata);

	gtk_box_pack_start (GTK_BOX (queryarea),
			    mugdata->querybar, FALSE, FALSE, 2);
	gtk_box_pack_start (GTK_BOX (queryarea), paned, TRUE, TRUE, 2);

	gtk_widget_show_all (queryarea);
	return queryarea;
}
Ejemplo n.º 17
0
static GtkWidget *
mug_query_area (MugData * mugdata)
{
	GtkWidget *queryarea, *paned, *scrolled;

#ifdef HAVE_GTK3
	queryarea = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
#else
	queryarea = gtk_vbox_new (FALSE, 2);
	paned = gtk_vpaned_new ();
#endif /*!HAVE_GTK3*/


	mugdata->mlist = mug_msg_list_view_new
		(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB));
	scrolled = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);

	gtk_container_add (GTK_CONTAINER (scrolled), mugdata->mlist);
	gtk_paned_add1 (GTK_PANED (paned), scrolled);

	mugdata->msgview = mug_msg_view_new ();
	mug_msg_view_set_note (MUG_MSG_VIEW(mugdata->msgview),
			       "<h1>Welcome to <i>mug</i>!</h1><hr>"
			       "<tt>mug</tt> is an experimental UI for <tt>mu</tt>, which will "
			       "slowly evolve into something useful.<br><br>Enjoy the ride.");
	g_signal_connect (G_OBJECT (mugdata->mlist), "msg-selected",
			  G_CALLBACK (on_msg_selected), mugdata);
	g_signal_connect (G_OBJECT (mugdata->mlist), "error-occured",
			  G_CALLBACK (on_list_view_error), mugdata);
	gtk_paned_add2 (GTK_PANED (paned), mugdata->msgview);

	mugdata->querybar = mug_querybar ();
	g_signal_connect (G_OBJECT (mugdata->querybar), "query-changed",
			  G_CALLBACK (on_query_changed), mugdata);

	gtk_box_pack_start (GTK_BOX (queryarea),
			    mugdata->querybar, FALSE, FALSE, 2);
	gtk_box_pack_start (GTK_BOX (queryarea), paned, TRUE, TRUE, 2);

	gtk_widget_show_all (queryarea);
	return queryarea;
}
Ejemplo n.º 18
0
static void fm_tab_page_init(FmTabPage *page)
{
    GtkPaned* paned = GTK_PANED(page);
    FmTabLabel* tab_label;
    FmFolderView* folder_view;
    GList* focus_chain = NULL;

    page->side_pane = fm_side_pane_new();
    fm_side_pane_set_mode(FM_SIDE_PANE(page->side_pane), app_config->side_pane_mode);
    /* TODO: add a close button to side pane */
    gtk_paned_add1(paned, page->side_pane);
    focus_chain = g_list_prepend(focus_chain, page->side_pane);

    page->folder_view = fm_folder_view_new(app_config->view_mode);
    folder_view = FM_FOLDER_VIEW(page->folder_view);
    fm_folder_view_set_hint_type(folder_view, app_config->hint_type);
    fm_folder_view_sort(folder_view, app_config->sort_type, app_config->sort_by);
    fm_folder_view_set_selection_mode(folder_view, GTK_SELECTION_MULTIPLE);
    page->nav_history = fm_nav_history_new();
    gtk_paned_add2(paned, page->folder_view);
    focus_chain = g_list_prepend(focus_chain, page->folder_view);

    /* We need this to change tab order to focus folder view before left pane. */
    gtk_container_set_focus_chain(page, focus_chain);
    g_list_free(focus_chain);

    gtk_widget_show_all(GTK_WIDGET(page));

    /* create tab label */
    tab_label = (FmTabLabel*)fm_tab_label_new("");
    gtk_label_set_max_width_chars(tab_label->label, app_config->max_tab_chars);
    gtk_label_set_ellipsize(tab_label->label, PANGO_ELLIPSIZE_END);
    page->tab_label = GTK_WIDGET(tab_label);

    g_signal_connect(page->folder_view, "sel-changed",
                     G_CALLBACK(on_folder_view_sel_changed), page);
    g_signal_connect(page->folder_view, "loaded",
                     G_CALLBACK(on_folder_view_loaded), page);
    /* the folder view is already loded, call the "loaded" callback ourself. */
    if(fm_folder_view_get_is_loaded(folder_view))
        on_folder_view_loaded(folder_view, fm_folder_view_get_cwd(folder_view), page);
}
Ejemplo n.º 19
0
void relayout_mainbox ()
{
	gboolean mvisible = rookie_settings_get_visible (ROOKIE_SIDEPANE_VISIBLE);
	gboolean nvisible = rookie_settings_get_visible (ROOKIE_BOTTOMPANE_VISIBLE);

	GtkWidget *parent;
	GtkWidget *left_widget = nvisible ? vpaned : sw2;
	GtkWidget *main_widget = mvisible ? hpaned : left_widget;

	parent  = gtk_widget_get_parent (vpaned);
	if (parent != NULL) {
		g_object_ref (vpaned);
		gtk_container_remove (GTK_CONTAINER(parent), vpaned);
	}

	parent  = gtk_widget_get_parent (sw2);
	if (parent != NULL) {
		g_object_ref (sw2);
		gtk_container_remove (GTK_CONTAINER(parent), sw2);
	}

	parent  = gtk_widget_get_parent (hpaned);
	if (parent != NULL) {
		g_object_ref (hpaned);
		gtk_container_remove (GTK_CONTAINER(parent), hpaned);
	}

	if (nvisible) {
		gtk_paned_add1 (GTK_PANED (vpaned), sw2);
		g_object_unref (sw2);
	}

	if (mvisible) {
		gtk_paned_add2 (GTK_PANED (hpaned), left_widget);
		g_object_unref (left_widget);
	}

	gtk_box_pack_start  (GTK_BOX (mainbox), main_widget, TRUE, TRUE, 0);
	gtk_widget_show_all (mainbox);
}
Ejemplo n.º 20
0
/**
 *程序入口
 */
int main(int argc,char *argv[]){
   GtkWidget *vBox = NULL;//主布局
   GtkWidget *hPanel = NULL; //操作主布局
   GtkWidget *rightMainVBox = NULL; //右边主布局
   
   gtk_init(&argc,&argv);
   
   g_print("检查目录%d\n",check_dir());
   
   
   window = create_main_window();//创建主窗口
   set_main_window(window);//同步ui.c的window
   hPanel = gtk_hpaned_new(); //创建操作主布局
   leftCatalogVBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   rightMainVBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   
   //设置主布局
   vBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   gtk_container_add(GTK_CONTAINER(window),vBox);//向窗口加入主布局--不可视
   
   gtk_box_pack_start(GTK_BOX(vBox),create_menus(),FALSE,FALSE,0);  //添加菜单
   gtk_box_pack_start(GTK_BOX(vBox),hPanel,TRUE,TRUE,10);  //添加面板
   
   gtk_paned_add1(GTK_PANED(hPanel),leftCatalogVBox);// 添加布局
   gtk_paned_add2(GTK_PANED(hPanel),rightMainVBox);// 添加布局
   
   gtk_widget_set_size_request(leftCatalogVBox,150,300); //设置左边大小
   
   init_tree_view_catalog();
   gtk_box_pack_start(GTK_BOX(rightMainVBox),init_right_main_view(),TRUE,TRUE,0); //显示左边主要内容
   
   
   gtk_widget_show_all(window);  //显示所有组件
   
   init_right_main_view_hide_all(NULL);
   gtk_main();
   return 0;
}
Ejemplo n.º 21
0
Archivo: t24.cpp Proyecto: ombt/ombt
int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GtkWidget *vpaned;
    GtkWidget *list;
    GtkWidget *text;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
    g_signal_connect (window, "destroy",
	              G_CALLBACK (gtk_main_quit), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);

    /* create a vpaned widget and add it to our toplevel window */
   
    vpaned = gtk_vpaned_new ();
    gtk_container_add (GTK_CONTAINER (window), vpaned);
    gtk_widget_show (vpaned);
   
    /* Now create the contents of the two halves of the window */
   
    list = create_list ();
    gtk_paned_add1 (GTK_PANED (vpaned), list);
    gtk_widget_show (list);
   
    text = create_text ();
    gtk_paned_add2 (GTK_PANED (vpaned), text);
    gtk_widget_show (text);
    gtk_widget_show (window);

    gtk_main ();

    return 0;
}
Ejemplo n.º 22
0
    bool attach()
    {
        GRefPtr<WebKitWebViewBase> inspectorView = webkit_web_inspector_get_web_view(m_inspector);
        if (m_inspectorWindow) {
            gtk_container_remove(GTK_CONTAINER(m_inspectorWindow), GTK_WIDGET(inspectorView.get()));
            gtk_widget_destroy(m_inspectorWindow);
            m_inspectorWindow = 0;
        }

        GtkWidget* pane;
        if (gtk_bin_get_child(GTK_BIN(m_parentWindow)) == GTK_WIDGET(m_webView)) {
            GRefPtr<WebKitWebView> inspectedView = m_webView;
            gtk_container_remove(GTK_CONTAINER(m_parentWindow), GTK_WIDGET(m_webView));
            pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
            gtk_paned_add1(GTK_PANED(pane), GTK_WIDGET(m_webView));
            gtk_container_add(GTK_CONTAINER(m_parentWindow), pane);
            gtk_widget_show_all(pane);
        } else
            pane = gtk_bin_get_child(GTK_BIN(m_parentWindow));
        gtk_paned_set_position(GTK_PANED(pane), webkit_web_inspector_get_attached_height(m_inspector));
        gtk_paned_add2(GTK_PANED(pane), GTK_WIDGET(inspectorView.get()));

        return InspectorTest::attach();
    }
Ejemplo n.º 23
0
GtkWidget *
pgd_find_create_widget (PopplerDocument *document)
{
	PgdFindDemo      *demo;
	GtkWidget        *vbox, *hbox;
	GtkWidget        *button;
	GtkWidget        *swindow;
        GtkWidget        *checkbutton;
        GtkTreeModel     *model;
	GtkWidget        *treeview;
	GtkCellRenderer  *renderer;
        GtkWidget        *hpaned;
        GtkTreeSelection *selection;

	demo = g_new0 (PgdFindDemo, 1);

	demo->doc = g_object_ref (document);

	demo->n_pages = poppler_document_get_n_pages (document);
        demo->selected_page = -1;
        demo->options = POPPLER_FIND_DEFAULT;

        hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_paned_set_position (GTK_PANED (hpaned), 300);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);

	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

	demo->entry = gtk_entry_new ();
	gtk_box_pack_start (GTK_BOX (hbox), demo->entry, FALSE, TRUE, 0);
	gtk_widget_show (demo->entry);

	demo->progress = gtk_progress_bar_new ();
	gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (demo->progress),
					PANGO_ELLIPSIZE_END);
	gtk_box_pack_start (GTK_BOX (hbox), demo->progress, TRUE, TRUE, 0);
	gtk_widget_show (demo->progress);

	button = gtk_button_new_with_label ("Find");
	gtk_widget_set_sensitive (button, FALSE);
	g_signal_connect (G_OBJECT (button), "clicked",
			  G_CALLBACK (pgd_find_button_clicked),
			  (gpointer)demo);
	g_signal_connect_swapped (G_OBJECT (demo->entry), "changed",
				  G_CALLBACK (pgd_find_button_sensitivity_cb),
				  (gpointer)button);
	gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
	gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6);
	gtk_widget_show (hbox);

        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

        checkbutton = gtk_check_button_new_with_label ("Case sensitive");
        g_signal_connect (checkbutton, "toggled",
                          G_CALLBACK (pgd_find_case_sensitive_toggled),
                          demo);
        gtk_box_pack_start (GTK_BOX (hbox), checkbutton, FALSE, FALSE, 0);
        gtk_widget_show (checkbutton);

        checkbutton = gtk_check_button_new_with_label ("Backwards");
        g_signal_connect (checkbutton, "toggled",
                          G_CALLBACK (pgd_find_backwards_toggled),
                          demo);
        gtk_box_pack_start (GTK_BOX (hbox), checkbutton, FALSE, FALSE, 0);
        gtk_widget_show (checkbutton);

        checkbutton = gtk_check_button_new_with_label ("Whole words only");
        g_signal_connect (checkbutton, "toggled",
                          G_CALLBACK (pgd_find_whole_words_toggled),
                          demo);
        gtk_box_pack_start (GTK_BOX (hbox), checkbutton, FALSE, FALSE, 0);
        gtk_widget_show (checkbutton);

        gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
        gtk_widget_show (hbox);

	swindow = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	model = pgd_find_create_model ();
	treeview = gtk_tree_view_new_with_model (model);
        g_object_unref (model);
        demo->treeview = treeview;
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
        g_signal_connect (selection, "changed",
                          G_CALLBACK (pgd_find_selection_changed),
                          demo);

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     TITLE_COLUMN, "Matches",
						     renderer,
						     "text", TITLE_COLUMN,
						     NULL);
	
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     X1_COLUMN, "X1",
						     renderer,
						     "text", X1_COLUMN,
						     "visible", VISIBLE_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     Y1_COLUMN, "Y1",
						     renderer,
						     "text", Y1_COLUMN,
						     "visible", VISIBLE_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     X2_COLUMN, "X2",
						     renderer,
						     "text", X2_COLUMN,
						     "visible", VISIBLE_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     Y2_COLUMN, "Y2",
						     renderer,
						     "text", Y2_COLUMN,
						     "visible", VISIBLE_COLUMN,
						     NULL);
	gtk_container_add (GTK_CONTAINER (swindow), treeview);
	gtk_widget_show (treeview);

        gtk_paned_add1 (GTK_PANED (hpaned), swindow);
        gtk_widget_show (swindow);

        demo->darea = gtk_drawing_area_new ();
        g_signal_connect (demo->darea, "draw",
                          G_CALLBACK (pgd_find_viewer_drawing_area_draw),
                          demo);

        swindow = gtk_scrolled_window_new (NULL, NULL);
#if GTK_CHECK_VERSION(3, 7, 8)
        gtk_container_add(GTK_CONTAINER(swindow), demo->darea);
#else
        gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swindow), demo->darea);
#endif
        gtk_widget_show (demo->darea);

        gtk_paned_add2 (GTK_PANED (hpaned), swindow);
        gtk_widget_show (swindow);

        gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
        gtk_widget_show (hpaned);

	g_object_weak_ref (G_OBJECT (vbox),
			   (GWeakNotify)pgd_find_free,
			   (gpointer)demo);

	return vbox;
}
Ejemplo n.º 24
0
int main(int argc,char *argv[])

{
    
    app.connected = FALSE;
    
    app.is_server = FALSE;
    
    app.finish = FALSE;
    
    windowIO = g_slice_new (InputOutput);
    
    
    
    gtk_init(&argc, &argv);
    
    
    
    
    
    //  Main window
    
    app.chat = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    
    gtk_container_set_border_width(GTK_CONTAINER(app.chat), 10);
    
    g_signal_connect(G_OBJECT(app.chat), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
    
    gtk_window_set_default_size(GTK_WINDOW(app.chat), 600, 300);
    
    gtk_window_set_title(GTK_WINDOW(app.chat), "Conversation électronique");
    
    
    
    // GUI
    
    
    
    app.button  = gtk_button_new_with_label ("Terminer Session");
    
    app.button2 = gtk_button_new_with_label ("Demarrer Session");
    
    app.button3 = gtk_button_new_with_label ("Sauvegarde Fichier");
    
    //app.button4 = gtk_button_new_with_label ("Saisir Note");
    
    
    app.scrolled_window   = gtk_scrolled_window_new(NULL, NULL);
    
    
    
    windowIO->textview    = gtk_text_view_new();
    
    windowIO->entry       = gtk_entry_new();
    
    app.chat_right_column = gtk_vbox_new(FALSE, 5);
    
    app.chat_space        = gtk_hpaned_new ();
    
    app.container_option  = gtk_vpaned_new ();
    
    
    
    gtk_text_view_set_editable(GTK_TEXT_VIEW(windowIO->textview), FALSE);
    
    
    
    gtk_paned_set_position (GTK_PANED(app.chat_space), 450);
    
    gtk_paned_set_position (GTK_PANED(app.container_option), 250);
    
    
    
    gtk_paned_add1 (GTK_PANED(app.chat_space), app.container_option);
    
    gtk_paned_add2 (GTK_PANED(app.chat_space), app.chat_right_column);
    
    gtk_paned_add1 (GTK_PANED(app.container_option), app.scrolled_window);
    
    gtk_paned_add2 (GTK_PANED(app.container_option), windowIO->entry);
    
    
    
    gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button2, FALSE, FALSE,  0);
    
    gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button3, FALSE, FALSE, 10);
    
    //gtk_box_pack_start(GTK_BOX(app.chat_right_column), app.button4, FALSE, FALSE, 20);
    
    gtk_box_pack_end  (GTK_BOX(app.chat_right_column), app.button,  FALSE, FALSE, 25);
    
    
    
    
    
    gtk_container_add (GTK_CONTAINER(app.scrolled_window), windowIO->textview);
    
    gtk_container_add (GTK_CONTAINER(app.chat), app.chat_space);
    
    
    /*g_signal_connect (G_OBJECT (app.button4), "clicked",
                      G_CALLBACK (save_mark),
                      NULL);*/
    
    
    g_signal_connect (G_OBJECT (app.button3), "clicked",
                      G_CALLBACK (save_file),
                      NULL);
    
    
    g_signal_connect (G_OBJECT (app.button2), "clicked",
                      G_CALLBACK (start_session),
                      NULL);
    
    
    g_signal_connect (G_OBJECT (app.button), "clicked",
                      G_CALLBACK (end_session),
                      NULL);
    
    
    g_signal_connect (windowIO->entry, "activate",
                      G_CALLBACK (enter_text),
                      NULL);
    
    
    gtk_widget_show_all(app.chat);
    gtk_main();
    return 0;
}
Ejemplo n.º 25
0
void
browser_dialog_open (const gchar *plug_in_binary)
{
  GtkWidget   *window;
  GtkWidget   *main_vbox;
  GtkWidget   *vbox;
  GtkWidget   *toolbar;
  GtkWidget   *paned;
  GtkWidget   *scrolled;
  GtkToolItem *item;
  GtkAction   *action;
  DialogData   data = { 720, 560, 240, TRUE, 1.0 };

  gimp_ui_init (plug_in_binary, TRUE);

  gimp_get_data (GIMP_HELP_BROWSER_DIALOG_DATA, &data);

  /*  the dialog window  */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), _("GIMP Help Browser"));
  gtk_window_set_role (GTK_WINDOW (window), plug_in_binary);

  gtk_window_set_default_size (GTK_WINDOW (window), data.width, data.height);

  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  window_set_icons (window);

  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
  gtk_container_add (GTK_CONTAINER (window), vbox);
  gtk_widget_show (vbox);

  ui_manager = ui_manager_new (window);

  toolbar = gtk_ui_manager_get_widget (ui_manager, "/help-browser-toolbar");
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
  gtk_widget_show (toolbar);

  item = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL);
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
  gtk_widget_show (GTK_WIDGET (item));

  action = gtk_ui_manager_get_action (ui_manager,
                                      "/ui/help-browser-popup/forward");
  gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action);
  g_object_notify (G_OBJECT (action), "tooltip");
  button_next = GTK_WIDGET (item);

  item = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL);
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
  gtk_widget_show (GTK_WIDGET (item));

  action = gtk_ui_manager_get_action (ui_manager,
                                      "/ui/help-browser-popup/back");
  gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action);
  g_object_notify (G_OBJECT (action), "tooltip");
  button_prev = GTK_WIDGET (item);

  item =
    GTK_TOOL_ITEM (gtk_ui_manager_get_widget (ui_manager,
                                              "/help-browser-toolbar/space"));
  gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
  gtk_tool_item_set_expand (item, TRUE);

  /*  the horizontal paned  */
  paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
  gtk_box_pack_start (GTK_BOX (vbox), paned, TRUE, TRUE, 0);
  gtk_widget_show (paned);

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_paned_add1 (GTK_PANED (paned), scrolled);
  gtk_paned_set_position (GTK_PANED (paned), data.paned_position);

  sidebar = scrolled;

  if (data.show_index)
    gtk_widget_show (sidebar);

  tree_view = gtk_tree_view_new ();
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
  gtk_container_add (GTK_CONTAINER (scrolled), tree_view);
  gtk_widget_show (tree_view);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
                                               NULL,
                                               gtk_cell_renderer_text_new (),
                                               "text", 1,
                                               NULL);

  g_signal_connect (tree_view, "row-activated",
                    G_CALLBACK (row_activated),
                    NULL);

  /*  HTML view  */
  main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_show (main_vbox);
  gtk_paned_pack2 (GTK_PANED (paned), main_vbox, TRUE, TRUE);

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  gtk_widget_set_size_request (scrolled, 300, 200);
  gtk_box_pack_start (GTK_BOX (main_vbox), scrolled, TRUE, TRUE, 0);
  gtk_widget_show (scrolled);

  view = webkit_web_view_new ();
  webkit_web_view_set_maintains_back_forward_list (WEBKIT_WEB_VIEW (view),
                                                   TRUE);
  gtk_container_add (GTK_CONTAINER (scrolled), view);
  gtk_widget_show (view);

  g_signal_connect (view, "realize",
                    G_CALLBACK (view_realize),
                    NULL);
  g_signal_connect (view, "unrealize",
                    G_CALLBACK (view_unrealize),
                    NULL);

  g_signal_connect (view, "popup-menu",
                    G_CALLBACK (view_popup_menu),
                    NULL);
  g_signal_connect (view, "button-press-event",
                    G_CALLBACK (view_button_press),
                    NULL);
  g_signal_connect (view, "key-press-event",
                    G_CALLBACK (view_key_press),
                    NULL);

  webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), data.zoom);

  g_signal_connect (view, "title-changed",
                    G_CALLBACK (title_changed),
                    window);

  g_signal_connect (view, "load-started",
                    G_CALLBACK (load_started),
                    NULL);
  g_signal_connect (view, "load-finished",
                    G_CALLBACK (load_finished),
                    NULL);

  gtk_widget_grab_focus (view);

  g_signal_connect (window, "unmap",
                    G_CALLBACK (dialog_unmap),
                    paned);

  update_actions ();

  /* Searchbar */
  searchbar = build_searchbar ();
  gtk_box_pack_start (GTK_BOX (main_vbox), searchbar, FALSE, FALSE, 0);
}
Ejemplo n.º 26
0
static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList *logs,
						const char *title, GtkWidget *icon, int log_size)
{
	PidginLogViewer *lv;
	GtkWidget *title_box;
	char *text;
	GtkWidget *pane;
	GtkWidget *sw;
	GtkCellRenderer *rend;
	GtkTreeViewColumn *col;
	GtkTreeSelection *sel;
	GtkWidget *vbox;
	GtkWidget *frame;
	GtkWidget *hbox;
	GtkWidget *find_button;
	GtkWidget *size_label;

	if (logs == NULL)
	{
		/* No logs were found. */
		const char *log_preferences = NULL;

		if (ht == NULL) {
			if (!purple_prefs_get_bool("/purple/logging/log_system"))
				log_preferences = _("System events will only be logged if the \"Log all status changes to system log\" preference is enabled.");
		} else {
			if (ht->type == PURPLE_LOG_IM) {
				if (!purple_prefs_get_bool("/purple/logging/log_ims"))
					log_preferences = _("Instant messages will only be logged if the \"Log all instant messages\" preference is enabled.");
			} else if (ht->type == PURPLE_LOG_CHAT) {
				if (!purple_prefs_get_bool("/purple/logging/log_chats"))
					log_preferences = _("Chats will only be logged if the \"Log all chats\" preference is enabled.");
			}
			g_free(ht->screenname);
			g_free(ht);
		}

		if(icon != NULL)
			gtk_widget_destroy(icon);

		purple_notify_info(NULL, title, _("No logs were found"), log_preferences);
		return NULL;
	}

	lv = g_new0(PidginLogViewer, 1);
	lv->logs = logs;

	if (ht != NULL)
		g_hash_table_insert(log_viewers, ht, lv);

	/* Window ***********/
	lv->window = gtk_dialog_new_with_buttons(title, NULL, 0,
					     GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
#ifdef _WIN32
	/* Steal the "HELP" response and use it to trigger browsing to the logs folder */
	gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP);
#endif
	gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE);
	gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE);
	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0);
	g_signal_connect(G_OBJECT(lv->window), "response",
					 G_CALLBACK(destroy_cb), ht);
	gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer");

	/* Icon *************/
	if (icon != NULL) {
		title_box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
		gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE);
		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0);

		gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0);
	} else
		title_box = GTK_DIALOG(lv->window)->vbox;

	/* Label ************/
	lv->label = gtk_label_new(NULL);

	text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", title);

	gtk_label_set_markup(GTK_LABEL(lv->label), text);
	gtk_misc_set_alignment(GTK_MISC(lv->label), 0, 0);
	gtk_box_pack_start(GTK_BOX(title_box), lv->label, FALSE, FALSE, 0);
	g_free(text);

	/* Pane *************/
	pane = gtk_hpaned_new();
	gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE);
	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0);

	/* List *************/
	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	gtk_paned_add1(GTK_PANED(pane), sw);
	lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
	lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore));
	g_object_unref(G_OBJECT(lv->treestore));
	rend = gtk_cell_renderer_text_new();
	col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col);
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE);
	gtk_container_add (GTK_CONTAINER (sw), lv->treeview);

	populate_log_tree(lv);

	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview));
	g_signal_connect (G_OBJECT (sel), "changed",
			G_CALLBACK (log_select_cb),
			lv);
	g_signal_connect (G_OBJECT(lv->treeview), "row-activated",
			G_CALLBACK(log_row_activated_cb),
			lv);
	pidgin_set_accessible_label(lv->treeview, lv->label);

	g_signal_connect(lv->treeview, "button-press-event", G_CALLBACK(log_button_press_cb), lv);
	g_signal_connect(lv->treeview, "popup-menu", G_CALLBACK(log_popup_menu_cb), lv);

	/* Log size ************/
	if(log_size) {
		char *sz_txt = purple_str_size_to_units(log_size);
		text = g_strdup_printf("<span weight='bold'>%s</span> %s", _("Total log size:"), sz_txt);
		size_label = gtk_label_new(NULL);
		gtk_label_set_markup(GTK_LABEL(size_label), text);
		/*		gtk_paned_add1(GTK_PANED(pane), size_label); */
		gtk_misc_set_alignment(GTK_MISC(size_label), 0, 0);
		gtk_box_pack_end(GTK_BOX(GTK_DIALOG(lv->window)->vbox), size_label, FALSE, FALSE, 0);
		g_free(sz_txt);
		g_free(text);
	}

	/* A fancy little box ************/
	vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
	gtk_paned_add2(GTK_PANED(pane), vbox);

	/* Viewer ************/
	frame = pidgin_create_imhtml(FALSE, &lv->imhtml, NULL, NULL);
	gtk_widget_set_name(lv->imhtml, "pidgin_log_imhtml");
	gtk_widget_set_size_request(lv->imhtml, 320, 200);
	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
	gtk_widget_show(frame);

	/* Search box **********/
	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
	lv->entry = gtk_entry_new();
	gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0);
	find_button = gtk_button_new_from_stock(GTK_STOCK_FIND);
	gtk_box_pack_start(GTK_BOX(hbox), find_button, FALSE, FALSE, 0);
	g_signal_connect(GTK_ENTRY(lv->entry), "activate", G_CALLBACK(search_cb), lv);
	g_signal_connect(GTK_BUTTON(find_button), "clicked", G_CALLBACK(search_cb), lv);

	select_first_log(lv);

	gtk_widget_show_all(lv->window);

	return lv;
}
Ejemplo n.º 27
0
/* engineering_init */
static Engineering * _engineering_init(PhonePluginHelper * helper)
{
	Engineering * engineering;
	GtkWidget * vbox;
	GtkWidget * toolbar;
	GtkWidget * paned;
	GtkWidget * frame;
	GtkWidget * scrolled;
	size_t i;
	GtkCellRenderer * renderer;
	GtkTreeViewColumn * column;

	if((engineering = object_new(sizeof(*engineering))) == NULL)
		return NULL;
	engineering->helper = helper;
	engineering->source = 0;
	engineering->enci = 0;
	engineering->enci_cnt = 0;
	/* widgets */
	/* window */
	engineering->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size(GTK_WINDOW(engineering->window), 200, 300);
#if GTK_CHECK_VERSION(2, 6, 0)
	gtk_window_set_icon_name(GTK_WINDOW(engineering->window),
			"stock_compile");
#endif
	gtk_window_set_title(GTK_WINDOW(engineering->window),
			"Engineering mode");
	g_signal_connect_swapped(engineering->window, "delete-event",
			G_CALLBACK(_on_engineering_closex), engineering);
#if GTK_CHECK_VERSION(3, 0, 0)
	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
#else
	vbox = gtk_vbox_new(FALSE, 0);
#endif
	/* toolbar */
	toolbar = gtk_toolbar_new();
	engineering->tb_play = gtk_toggle_tool_button_new_from_stock(
			GTK_STOCK_MEDIA_PLAY);
	g_signal_connect_swapped(G_OBJECT(engineering->tb_play), "toggled",
			G_CALLBACK(_on_engineering_play_toggled), engineering);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), engineering->tb_play, -1);
	engineering->tb_fullscreen = gtk_toggle_tool_button_new_from_stock(
			GTK_STOCK_FULLSCREEN);
	g_signal_connect_swapped(engineering->tb_fullscreen, "toggled",
			G_CALLBACK(_on_engineering_fullscreen_toggled),
			engineering);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), engineering->tb_fullscreen,
			-1);
	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, TRUE, 0);
	/* serving cell view */
#if GTK_CHECK_VERSION(3, 0, 0)
	paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
#else
	paned = gtk_vpaned_new();
#endif
	frame = gtk_frame_new("Serving cell");
	engineering->sc_store = gtk_list_store_new(SC_COL_COUNT,
			G_TYPE_STRING,		/* SC_COL_FREQUENCY */
			G_TYPE_STRING,		/* SC_COL_C1 */
			G_TYPE_STRING,		/* SC_COL_C2 */
			G_TYPE_STRING,		/* SC_COL_RX_LEVEL */
			G_TYPE_STRING,		/* SC_COL_STATION_ID */
			G_TYPE_STRING,		/* SC_COL_CELL_ID */
			G_TYPE_STRING,		/* SC_COL_TX_LEVEL */
			G_TYPE_STRING,		/* SC_COL_TIMESLOT_NUMBER */
			G_TYPE_STRING,		/* SC_COL_LAC */
			G_TYPE_STRING);		/* SC_COL_TMSI */
	scrolled = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	engineering->sc_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
				engineering->sc_store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(engineering->sc_view), TRUE);
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(
					engineering->sc_view)),
			GTK_SELECTION_NONE);
	/* columns */
	for(i = 0; _engineering_sc_columns[i].title != NULL; i++)
	{
		renderer = gtk_cell_renderer_text_new();
		column = gtk_tree_view_column_new_with_attributes(
				_engineering_sc_columns[i].title, renderer,
				"text", _engineering_sc_columns[i].col, NULL);
		gtk_tree_view_append_column(GTK_TREE_VIEW(engineering->sc_view),
				column);
	}
	gtk_container_add(GTK_CONTAINER(scrolled), engineering->sc_view);
	gtk_container_add(GTK_CONTAINER(frame), scrolled);
	gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
	gtk_paned_add1(GTK_PANED(paned), frame);
	/* neighbor cells view */
	frame = gtk_frame_new("Neighbor cells");
	engineering->nc_store = gtk_list_store_new(NC_COL_COUNT,
			G_TYPE_STRING,		/* NC_COL_FREQUENCY */
			G_TYPE_STRING,		/* NC_COL_C1 */
			G_TYPE_STRING,		/* NC_COL_C2 */
			G_TYPE_STRING,		/* NC_COL_RXLEV */
			G_TYPE_STRING,		/* NC_COL_BSIC */
			G_TYPE_STRING,		/* NC_COL_CELL_ID */
			G_TYPE_STRING,		/* NC_COL_LAC */
			G_TYPE_STRING,		/* NC_COL_FRAME_OFFSET */
			G_TYPE_STRING,		/* NC_COL_CBA */
			G_TYPE_STRING,		/* NC_COL_CBQ */
			G_TYPE_STRING,		/* NC_COL_CELL_TYPE_IND */
			G_TYPE_STRING);		/* NC_COL_RAC */
	scrolled = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	engineering->nc_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
				engineering->nc_store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(engineering->nc_view), TRUE);
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(
					engineering->nc_view)),
			GTK_SELECTION_NONE);
	/* columns */
	for(i = 0; _engineering_nc_columns[i].title != NULL; i++)
	{
		renderer = gtk_cell_renderer_text_new();
		column = gtk_tree_view_column_new_with_attributes(
				_engineering_nc_columns[i].title, renderer,
				"text", _engineering_nc_columns[i].col, NULL);
		gtk_tree_view_append_column(GTK_TREE_VIEW(engineering->nc_view),
				column);
	}
	gtk_container_add(GTK_CONTAINER(scrolled), engineering->nc_view);
	gtk_container_add(GTK_CONTAINER(frame), scrolled);
	gtk_container_set_border_width(GTK_CONTAINER(frame), 4);
	gtk_container_add(GTK_CONTAINER(engineering->window), vbox);
	gtk_paned_add2(GTK_PANED(paned), frame);
	gtk_box_pack_start(GTK_BOX(vbox), paned, TRUE, TRUE, 0);
	gtk_widget_show_all(engineering->window);
	/* trigger */
#if 0 /* FIXME reimplement using an extension to the Hayes modem plug-in */
	helper->register_trigger(helper->phone, plugin, "%EM",
			_on_engineering_trigger_em);
#endif
	return engineering;
}
Ejemplo n.º 28
0
static int _console(void)
{
	/* FIXME allocate dynamically */
	static Console console;
	PangoFontDescription * desc;
	GtkWidget * vbox;
	GtkWidget * menuitem;
	GtkWidget * menu;
	GtkToolItem * toolitem;
	GtkWidget * paned;
	GtkWidget * widget;

	desc = pango_font_description_new();
	pango_font_description_set_family(desc, "Monospace");
	console.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size(GTK_WINDOW(console.window), 400, 300);
	gtk_window_set_title(GTK_WINDOW(console.window), "PHP Console");
	g_signal_connect_swapped(console.window, "delete-event",
			G_CALLBACK(_console_on_closex), NULL);
	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	/* menu bar */
	widget = gtk_menu_bar_new();
	/* menu bar: file */
	menuitem = gtk_menu_item_new_with_mnemonic("_File");
	gtk_menu_shell_append(GTK_MENU_SHELL(widget), menuitem);
	menu = gtk_menu_new();
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
	menuitem = gtk_menu_item_new_with_mnemonic("_Run");
	g_signal_connect_swapped(menuitem, "activate",
			G_CALLBACK(_console_on_execute), &console);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	menuitem = gtk_separator_menu_item_new();
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	menuitem = gtk_menu_item_new_with_mnemonic("C_lear");
	g_signal_connect_swapped(menuitem, "activate",
			G_CALLBACK(_console_on_clear), &console);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	menuitem = gtk_separator_menu_item_new();
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	menuitem = gtk_menu_item_new_with_mnemonic("_Close");
	g_signal_connect_swapped(menuitem, "activate",
			G_CALLBACK(_console_on_close), NULL);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	/* menu bar: help */
	menuitem = gtk_menu_item_new_with_mnemonic("_Help");
	gtk_menu_shell_append(GTK_MENU_SHELL(widget), menuitem);
	menu = gtk_menu_new();
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
	menuitem = gtk_menu_item_new_with_mnemonic("_About");
	g_signal_connect_swapped(menuitem, "activate",
			G_CALLBACK(_console_on_about), &console);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
	/* toolbar */
	widget = gtk_toolbar_new();
	toolitem = gtk_tool_button_new_from_stock(GTK_STOCK_EXECUTE);
	g_signal_connect_swapped(toolitem, "clicked",
			G_CALLBACK(_console_on_execute), &console);
	gtk_toolbar_insert(GTK_TOOLBAR(widget), toolitem, -1);
	toolitem = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
	g_signal_connect_swapped(toolitem, "clicked",
			G_CALLBACK(_console_on_clear), &console);
	gtk_toolbar_insert(GTK_TOOLBAR(widget), toolitem, -1);
	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
	/* paned */
	paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
	widget = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	console.code = gtk_text_view_new();
	gtk_widget_override_font(console.code, desc);
	gtk_container_add(GTK_CONTAINER(widget), console.code);
	gtk_paned_add1(GTK_PANED(paned), widget);
	widget = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	console.console = gtk_text_view_new();
	gtk_widget_override_font(console.console, desc);
	gtk_text_view_set_editable(GTK_TEXT_VIEW(console.console), FALSE);
	gtk_container_add(GTK_CONTAINER(widget), console.console);
	gtk_paned_add2(GTK_PANED(paned), widget);
	gtk_paned_set_position(GTK_PANED(paned), 150);
	gtk_box_pack_start(GTK_BOX(vbox), paned, TRUE, TRUE, 0);
	/* statusbar */
	widget = gtk_statusbar_new();
	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(console.window), vbox);
	gtk_widget_show_all(console.window);
	return 0;
}
Ejemplo n.º 29
0
UzblTreeTab::UzblTreeTab(char* name)
{
    running = true;
    currenttab = 0;
    totaltabs = 0;
    fifocount = 0;
    uzblinstances = NULL;
    fb = 0;
    sessionload = false;
    closing = false;
    
    if (name) {
        sprintf(fifopath, "/tmp/uzbltreetab-%s", name);
        strcpy(tabname, name);
    }
    else {
        sprintf(fifopath, "/tmp/uzbltreetab-%d", rand());
        tabname[0] = '\0';
    }
    mkfifo(fifopath, 0766);
    fifofd = open(fifopath, O_NONBLOCK);
    
    window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
    char title[1024];
    sprintf(title, "uzbltreetab - %s", name);
    gtk_window_set_title(window, title);
    
    tabtree = GTK_TREE_VIEW(gtk_tree_view_new());
    GtkScrolledWindow* tabscroll = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
    gtk_scrolled_window_set_policy(tabscroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_container_add(GTK_CONTAINER(tabscroll), GTK_WIDGET(tabtree));
    gtk_widget_set_can_focus(GTK_WIDGET(tabtree), false);
    //gtk_tree_view_set_reorderable(tabtree, true);
    tabmodel = gtk_tree_store_new(1, G_TYPE_STRING);
    gtk_tree_view_set_model(tabtree, GTK_TREE_MODEL(tabmodel));
    
    GtkTreeIter iter;
    GtkCellRenderer* trenderer = gtk_cell_renderer_text_new();
    //g_object_set(trenderer, "editable", true, NULL);
    gtk_tree_view_insert_column_with_attributes(tabtree, -1, "",
                                               trenderer, "text", 0, NULL);
    gtk_tree_view_set_headers_visible(tabtree, false);
    //g_signal_connect(trenderer, "edited", G_CALLBACK(cell_edited_callback), this);
    g_signal_connect(tabtree, "cursor-changed", G_CALLBACK(row_clicked), this);
    
    notebook = GTK_NOTEBOOK(gtk_notebook_new());
    gtk_notebook_set_show_tabs(notebook, false);
    gtk_notebook_set_show_border(notebook, false);

    pane = GTK_PANED(gtk_hpaned_new());
    gtk_paned_add1(pane, GTK_WIDGET(tabscroll));
    gtk_paned_add2(pane, GTK_WIDGET(notebook));
    
    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(pane));

    g_signal_connect(window, "destroy", G_CALLBACK(wdestroy), this);
    gtk_widget_show_all(GTK_WIDGET(window));
    gtk_paned_set_position(pane, 200);
    panepos = 200;
    
    //g_timeout_add(1000, updatetabs, this);
    g_timeout_add(100, checkfifo, this);
    
    LoadSession();
    if (totaltabs == 0)
        NewTab("about:blank");
}
Ejemplo n.º 30
0
Compose * compose_new(Config * config)
{
	Compose * compose;
	GtkAccelGroup * group;
	GtkWidget * vbox;
	GtkWidget * toolbar;
	GtkToolItem * toolitem;
	GtkSizeGroup * sizegroup;
	GtkWidget * vpaned;
	GtkWidget * vbox2;
	GtkWidget * widget;
	GtkCellRenderer * renderer;
	GtkTreeViewColumn * column;
	GtkTreeIter iter;
	char const * headers[] = {
		"To:", "Cc:", "Bcc:", "Reply-To:", "Newsgroup:",
		"Followup-To:" };
	size_t i;

	if((compose = malloc(sizeof(*compose))) == NULL)
	{
		compose_error(NULL, strerror(errno), 0);
		return NULL;
	}
	compose->mime = mime_new(NULL);
	/* check errors */
	if(compose->mime == NULL)
	{
		free(compose);
		return NULL;
	}
	compose->config = config;
	compose->standalone = FALSE;
	/* window */
	group = gtk_accel_group_new();
	compose->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_add_accel_group(GTK_WINDOW(compose->window), group);
#ifndef EMBEDDED
	gtk_window_set_default_size(GTK_WINDOW(compose->window), 512, 384);
#else
	gtk_window_set_default_size(GTK_WINDOW(compose->window), 200, 300);
#endif
	gtk_window_set_title(GTK_WINDOW(compose->window), _("Compose"));
#if GTK_CHECK_VERSION(2, 6, 0)
	gtk_window_set_icon_name(GTK_WINDOW(compose->window), "mailer");
#endif
	g_signal_connect_swapped(G_OBJECT(compose->window), "delete-event",
			G_CALLBACK(_compose_on_closex), compose);
	vbox = gtk_vbox_new(FALSE, 0);
	/* menubar */
#ifndef EMBEDDED
	widget = desktop_menubar_create(_compose_menubar, compose, group);
	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
#endif
	/* toolbar */
	toolbar = desktop_toolbar_create(_compose_toolbar, compose, group);
	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, TRUE, 0);
	/* from */
	sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
	toolbar = gtk_toolbar_new();
	widget = gtk_label_new(_("From: "));
	gtk_misc_set_alignment(GTK_MISC(widget), 0.1, 0.5);
	gtk_widget_set_size_request(widget, 80, -1);
	gtk_size_group_add_widget(sizegroup, widget);
	toolitem = gtk_tool_item_new();
	gtk_container_add(GTK_CONTAINER(toolitem), widget);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
#if GTK_CHECK_VERSION(2, 24, 0)
	compose->from = gtk_combo_box_text_new_with_entry();
#else
	compose->from = gtk_combo_box_entry_new_text();
#endif
	toolitem = gtk_tool_item_new();
	gtk_tool_item_set_expand(toolitem, TRUE);
	gtk_container_add(GTK_CONTAINER(toolitem), compose->from);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
	gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
	/* paned */
	vpaned = gtk_vpaned_new();
	/* headers */
	widget = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	compose->h_store = gtk_list_store_new(CHC_COUNT, G_TYPE_STRING,
			G_TYPE_STRING, G_TYPE_BOOLEAN);
	compose->h_store_filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(
				compose->h_store), NULL);
	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(
				compose->h_store_filter),
			_compose_on_headers_filter, compose, NULL);
	compose->h_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
				compose->h_store_filter));
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(compose->h_view),
			FALSE);
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(compose->h_view), TRUE);
	compose->h_headers = gtk_list_store_new(2, G_TYPE_STRING,
			G_TYPE_STRING);
	for(i = 0; i < sizeof(headers) / sizeof(*headers); i++)
	{
		gtk_list_store_append(compose->h_headers, &iter);
		gtk_list_store_set(compose->h_headers, &iter, 0, headers[i], 1,
				headers[i], -1);
	}
	renderer = gtk_cell_renderer_combo_new();
	g_object_set(renderer, "editable", TRUE, "model", compose->h_headers,
			"text-column", 1, NULL);
	g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(
				_on_header_field_edited), compose);
	column = gtk_tree_view_column_new_with_attributes("", renderer, "text",
			CHC_HEADER, NULL);
	gtk_tree_view_column_set_min_width(column, 80);
	gtk_tree_view_append_column(GTK_TREE_VIEW(compose->h_view), column);
	renderer = gtk_cell_renderer_text_new();
	g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL);
	g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(
				_on_header_edited), compose);
	column = gtk_tree_view_column_new_with_attributes("", renderer, "text",
			CHC_VALUE, NULL);
#if GTK_CHECK_VERSION(2, 4, 0)
	gtk_tree_view_column_set_expand(column, TRUE);
#endif
	gtk_tree_view_append_column(GTK_TREE_VIEW(compose->h_view), column);
	/* default to 8-bits transfers with UTF-8 encoding */
	compose_set_header(compose, "Content-Transfer-Encoding:", "8bit",
			FALSE);
	compose_set_header(compose, "Content-Type:",
			"text/plain; charset=UTF-8", FALSE);
	compose_add_field(compose, "To:", NULL);
	gtk_container_add(GTK_CONTAINER(widget), compose->h_view);
	gtk_paned_add1(GTK_PANED(vpaned), widget);
	/* paned */
	vbox2 = gtk_vbox_new(FALSE, 0);
	/* subject */
	toolbar = gtk_toolbar_new();
	widget = gtk_label_new(_("Subject: "));
	gtk_misc_set_alignment(GTK_MISC(widget), 0.1, 0.5);
	gtk_size_group_add_widget(sizegroup, widget);
	toolitem = gtk_tool_item_new();
	gtk_container_add(GTK_CONTAINER(toolitem), widget);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
	compose->subject = gtk_entry_new();
	toolitem = gtk_tool_item_new();
	gtk_tool_item_set_expand(toolitem, TRUE);
	gtk_container_add(GTK_CONTAINER(toolitem), compose->subject);
	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
	gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, TRUE, 0);
	/* view */
	widget = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	compose->view = _new_text_view(compose);
	compose_set_font(compose, _compose_get_font(compose));
	gtk_container_add(GTK_CONTAINER(widget), compose->view);
	gtk_box_pack_start(GTK_BOX(vbox2), widget, TRUE, TRUE, 0);
	gtk_paned_add2(GTK_PANED(vpaned), vbox2);
	gtk_box_pack_start(GTK_BOX(vbox), vpaned, TRUE, TRUE, 0);
	/* attachments */
	compose->a_window = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(compose->a_window),
			GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
	compose->a_store = gtk_list_store_new(CAC_COUNT, G_TYPE_STRING,
			G_TYPE_STRING, GDK_TYPE_PIXBUF);
	compose->a_view = gtk_icon_view_new_with_model(GTK_TREE_MODEL(
				compose->a_store));
	gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(compose->a_view),
			CAC_ICON);
	gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(compose->a_view),
			GTK_SELECTION_MULTIPLE);
	gtk_icon_view_set_text_column(GTK_ICON_VIEW(compose->a_view),
			CAC_BASENAME);
	gtk_container_add(GTK_CONTAINER(compose->a_window), compose->a_view);
	gtk_widget_show_all(compose->a_view);
	gtk_widget_set_no_show_all(compose->a_window, TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), compose->a_window, FALSE, TRUE, 0);
	/* statusbar */
	compose->statusbar = gtk_statusbar_new();
	compose->statusbar_id = 0;
	gtk_box_pack_start(GTK_BOX(vbox), compose->statusbar, FALSE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(compose->window), vbox);
	/* about dialog */
	compose->ab_window = NULL;
	/* signature */
	compose_append_signature(compose);
	compose_set_modified(compose, FALSE);
	compose_scroll_to_offset(compose, 0);
	/* display */
	gtk_widget_grab_focus(compose->view);
	gtk_widget_show_all(vbox);
	gtk_widget_show(compose->window);
	return compose;
}