예제 #1
0
G_MODULE_EXPORT
void
on_expand_devices_activate (GtkMenuItem *menuitem,
                            gpointer     user_data)
{
        gtk_tree_view_expand_all (GTK_TREE_VIEW (treeview));
}
예제 #2
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *  Recursive function to select the current page in the treeview
 *
 */
static void select_page(GtkTreeView *treeview,
                        GtkTreeIter *parent, PAGE *page)
{
    GtkTreeModel *treemodel = gtk_tree_view_get_model (treeview);
    GtkTreeIter iter;
    PAGE *p_current;

    if (!gtk_tree_model_iter_children (treemodel, &iter, parent)) {
        return;
    }

    do {
        gtk_tree_model_get (treemodel, &iter,
                            COLUMN_PAGE, &p_current,
                            -1);
        if (p_current == page) {
            gtk_tree_view_expand_all (treeview);
            gtk_tree_selection_select_iter (
                gtk_tree_view_get_selection (treeview),
                &iter);
            return;
        }

        select_page (treeview, &iter, page);

    } while (gtk_tree_model_iter_next (treemodel, &iter));

}
예제 #3
0
static void
phase_dialog_setup_tree_view (DialogData *data)
{
	GtkListStore      *store;
	GtkCellRenderer   *cell;
	GtkTreeViewColumn *col;
	GList             *list;

	store = gtk_list_store_new (NUM_COLS,
				    G_TYPE_STRING);

	g_signal_connect_object (data->project,
				 "notify::phases",
				 G_CALLBACK (phase_dialog_notify_phases),
				 data->dialog,
				 0);

	gtk_tree_view_set_model (GTK_TREE_VIEW (data->tree_view),
				 GTK_TREE_MODEL (store));

	cell = gtk_cell_renderer_text_new ();
	col = gtk_tree_view_column_new_with_attributes (
		NULL,
		cell,
		"text", COL_PHASE,
		NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (data->tree_view), col);

	g_object_get (data->project, "phases", &list, NULL);
	phase_dialog_rebuild_model (data, list);
	mrp_string_list_free (list);

	gtk_tree_view_expand_all (GTK_TREE_VIEW (data->tree_view));
}
예제 #4
0
파일: dbg_pclog.c 프로젝트: debrouxl/tiemu
/*
	Display registers window
*/
GtkWidget* display_dbgpclog_window(void)
{
	GladeXML *xml;
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_pclog-2.glade"), "dbgpclog_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgpclog_window");

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));
	gtk_widget_show(data);

	gtk_window_resize(GTK_WINDOW(dbox), options3.pclog.w, options3.pclog.h);
	gtk_window_move(GTK_WINDOW(dbox), options3.pclog.x, options3.pclog.y);
    gtk_widget_show(GTK_WIDGET(dbox));

	already_open = !0;

	return dbox;
}
예제 #5
0
static void 
on_view_expand_all (GtkAction* action, SeahorseKeyserverResults* self) 
{
	g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
	g_return_if_fail (GTK_IS_ACTION (action));
	gtk_tree_view_expand_all (self->pv->view);
}
예제 #6
0
GtkWidget *bmark_gui(Tbfwin * bfwin)
{
	GtkWidget *vbox, *scroll;
	GtkCellRenderer *cell;
	GtkTreeViewColumn *column;
	DEBUG_MSG("bmark_gui, building gui for bfwin=%p\n",bfwin);
	/* Tree Store is in bfwin->bookmarkstore 
	   Tree View is in bfwin->bmark 
	 */
	vbox = gtk_vbox_new(FALSE, 1);
	bfwin->bmark = gtk_tree_view_new_with_model(GTK_TREE_MODEL(bfwin->bookmarkstore));
	cell = gtk_cell_renderer_text_new();
	column = gtk_tree_view_column_new_with_attributes("", cell, "text", NAME_COLUMN, NULL);
	gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
	gtk_tree_view_append_column(GTK_TREE_VIEW(bfwin->bmark), column);
	gtk_widget_show_all(bfwin->bmark);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(bfwin->bmark), FALSE);
	/*gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(bfwin->bmark), TRUE);*/
	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), bfwin->bmark);
	gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
	g_signal_connect(G_OBJECT(bfwin->bmark), "button-press-event",
					 G_CALLBACK(bmark_event_mouseclick), bfwin);
	gtk_tree_view_expand_all(bfwin->bmark);
	return vbox;
}
예제 #7
0
파일: dbg_regs.c 프로젝트: debrouxl/tiemu
/*
	Display registers window
*/
GtkWidget* dbgregs_create_window(void)
{
	GladeXML *xml = NULL;
	GtkWidget *dbox;
    GtkWidget *data;	
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_regs-2.glade"), "dbgregs_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgregs_window");
	if(options3.transient)
		gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

	data = glade_xml_get_widget(xml, "treeview1");
    store = ctree_create(data);
	ctree_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));

	return dbox;
}
예제 #8
0
파일: list.c 프로젝트: ywwxhz/HiChat
void setupModel(GtkWidget *treeview, GArray *userList) {
	if (userList != NULL && userList->len > 0) {
		GtkTreeStore *treestore;
		GtkTreeIter toplevelonline, childonline;
		GtkTreeIter topleveloffline, childoffline;
		treestore = gtk_tree_store_new(NUM_COLS, G_TYPE_STRING, G_TYPE_STRING,
		G_TYPE_STRING);
		guint i;
		gtk_tree_store_append(treestore, &toplevelonline, NULL);
		gtk_tree_store_set(treestore, &toplevelonline, NAME, "在线好友", ID, "", IP,
				"", -1);
		gtk_tree_store_append(treestore, &topleveloffline, NULL);
		gtk_tree_store_set(treestore, &topleveloffline, NAME, "离线好友", ID, "",
				IP, "", -1);
		for (i = 0; i < userList->len; i++) {
			treeItem *pItem = &g_array_index(userList, treeItem, i);
			if (pItem->onlineStat == 1) {
				gtk_tree_store_append(treestore, &childonline, &toplevelonline);
				gtk_tree_store_set(treestore, &childonline, NAME, pItem->name,
						ID, pItem->id, IP, inet_ntoa(pItem->ip_addr), -1);

			} else {
				gtk_tree_store_append(treestore, &childoffline,
						&topleveloffline);
				gtk_tree_store_set(treestore, &childoffline, NAME, pItem->name,
						ID, pItem->id, IP, "", -1);
			}
		}
		gtk_tree_view_set_model(GTK_TREE_VIEW(treeview),
		GTK_TREE_MODEL (treestore));
		gtk_tree_view_expand_all(GTK_TREE_VIEW (treeview));
		g_object_unref(treestore);
	}
}
static gboolean
source_viewer_initable_init (GInitable *initable,
                             GCancellable *cancellable,
                             GError **error)
{
	ESourceViewer *viewer;
	ESourceRegistry *registry;

	viewer = E_SOURCE_VIEWER (initable);

	registry = e_source_registry_new_sync (cancellable, error);

	if (registry == NULL)
		return FALSE;

	viewer->registry = registry;  /* takes ownership */

	g_signal_connect (
		registry, "source-added",
		G_CALLBACK (source_viewer_source_added_cb), viewer);

	g_signal_connect (
		registry, "source-changed",
		G_CALLBACK (source_viewer_source_changed_cb), viewer);

	g_signal_connect (
		registry, "source-removed",
		G_CALLBACK (source_viewer_source_removed_cb), viewer);

	source_viewer_build_model (viewer);

	gtk_tree_view_expand_all (GTK_TREE_VIEW (viewer->tree_view));

	return TRUE;
}
예제 #10
0
파일: dbg_heap.c 프로젝트: debrouxl/tiemu
/*
	Display registers window
*/
GtkWidget* dbgheap_create_window(void)
{
	GtkWidget *dbox;
    GtkWidget *data;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("dbg_heap-2.glade"), "dbgheap_window",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed !\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "dbgheap_window");
	gtk_window_set_transient_for(GTK_WINDOW(dbox), GTK_WINDOW(main_wnd));

	data = glade_xml_get_widget(xml, "treeview1");
    store = clist_create(data);
	clist_populate(store);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(data));

	already_open = !0;

	return wnd = dbox;
}
/**
 * make_widget_for_element_model:
 * @xml_element:
 *
 * TODO: Write me
 */
GtkWidget*
make_widget_for_element_model (xmlElementPtr xml_element)
{
	GtkWidget *tree;
	GtkTreeModel *tree_model;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;

	g_assert (xml_element);

	tree_model = make_tree_model_for_element_model (xml_element);
	
	tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (tree_model));
	g_object_unref (G_OBJECT (tree_model));

	renderer = gtk_cell_renderer_text_new ();

	/* To translators: this is the label of a widget that shows the valid combinations of child elements for an element in the document; "content" is a noun */
	column = gtk_tree_view_column_new_with_attributes (_("Valid Content"), renderer,
							   "text", CONTENT_COLUMN,
							   NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);

	gtk_tree_view_expand_all (GTK_TREE_VIEW (tree));

	return tree;
}
예제 #12
0
/**
 * Expand all nodes in tree for current search.
 */
void
search_gui_expand_all(struct search *search)
{
	if (search) {
		gtk_tree_view_expand_all(GTK_TREE_VIEW(search->tree));
	}
}
예제 #13
0
파일: start.c 프로젝트: rosedu/anjuta
static void
attach_process_review (AttachProcess *ap)
{
	gchar *ps_output, *begin, *end;
	guint line_num = 0;
	GtkTreeStore *store;

	g_return_if_fail (ap);
	g_return_if_fail (ap->ps_output);
	store = GTK_TREE_STORE (gtk_tree_view_get_model 
							(GTK_TREE_VIEW (ap->treeview)));
	g_return_if_fail (store);

	ps_output = g_strdup (ap->ps_output);
	end = ps_output;
	while (*end)
	{
		begin = end;
		while (*end && *end != '\n') end++;
		if (++line_num > 2) // skip description line & process 'init'
		{
			*end = '\0';
			attach_process_add_line (ap, store, begin);
		}
		end++;
	}
	g_free (ps_output);

	iter_stack_clear (ap);
	gtk_tree_view_expand_all (GTK_TREE_VIEW (ap->treeview));
}
void AP_UnixDialog_CollaborationAccounts::_populateWindowData()
{
	GtkTreeSelection *sel;
	_setModel(_constructModel());
	
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (m_wAccountsTree), true);

	// get the current selection
	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_wAccountsTree));
	gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
	
	m_wRenderer = gtk_cell_renderer_text_new ();
	m_wToggleRenderer = gtk_cell_renderer_toggle_new ();
	g_object_set (m_wToggleRenderer, "xalign", 0.0, NULL);
	g_signal_connect (m_wToggleRenderer, "toggled", G_CALLBACK (s_online_toggled), this);
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (m_wAccountsTree), 
												-1,	"Online", 
												m_wToggleRenderer, "active", 0, (void*)NULL);
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (m_wAccountsTree), 
												-1,
												"Account", 
												m_wRenderer, "text", 1, (void*)NULL);
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (m_wAccountsTree), 
												-1,
												"Type", 
												m_wRenderer, "text", 2, (void*)NULL);
	
	gtk_tree_view_expand_all (GTK_TREE_VIEW (m_wAccountsTree));
	gtk_widget_show_all(m_wAccountsTree);
}
예제 #15
0
static gboolean
refresh_list_idle (GeditDocumentsPanel *panel)
{
	GtkTreeSelection *selection;

	gedit_debug (DEBUG_PANEL);

	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
	g_signal_handler_block (selection, panel->priv->selection_changed_handler_id);

	gtk_tree_store_clear (GTK_TREE_STORE (panel->priv->model));

	panel->priv->adding_tab = TRUE;
	gedit_multi_notebook_foreach_notebook (panel->priv->mnb,
					       (GtkCallback)refresh_notebook_foreach,
					       panel);
	panel->priv->adding_tab = FALSE;

	gtk_tree_view_expand_all (GTK_TREE_VIEW (panel->priv->treeview));

	select_active_tab (panel);

	panel->priv->refresh_idle_id = 0;

	g_signal_handler_unblock (selection, panel->priv->selection_changed_handler_id);

	return FALSE;
}
예제 #16
0
/* Set tree of the tree-store. This includes getting the folder tree and
 * storing it */
static void foldercheck_set_tree(SpecificFolderArrayEntry *entry)
{
  Folder *folder;
  GList *list;

  for(list = folder_get_list(); list != NULL; list = list->next) {
    folder = FOLDER(list->data);

    if(folder == NULL) {
      debug_print("Notification plugin::foldercheck_set_tree(): Found a NULL folder.\n");
      continue;
    }

    /* Only regard built-in folders, because folders from plugins (such as RSS, calendar,
     * or plugin-provided mailbox storage systems like Maildir or MBox) may vanish
     * without letting us know. */
    switch(folder->klass->type) {
    case F_MH:
    case F_IMAP:
    case F_NEWS:
      foldercheck_insert_gnode_in_store(entry->tree_store, folder->node, NULL);
      break;
    default:
      break;
    }
  }

  gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(entry->tree_store),
				       FOLDERCHECK_FOLDERNAME,
				       GTK_SORT_ASCENDING);

  if(GTK_IS_TREE_VIEW(entry->treeview))
    gtk_tree_view_expand_all(GTK_TREE_VIEW(entry->treeview));
}
예제 #17
0
static void remmina_main_action_view_quick_search(GtkToggleAction *action, RemminaMain *remminamain)
{
	gboolean toggled;

	toggled = gtk_toggle_action_get_active(action);
	if (toggled)
	{
		gtk_entry_set_text(GTK_ENTRY(remminamain->priv->quick_search_entry), "");
		gtk_widget_show(GTK_WIDGET(remminamain->priv->quick_search_separator));
		gtk_widget_show(GTK_WIDGET(remminamain->priv->quick_search_item));
		gtk_widget_grab_focus(remminamain->priv->quick_search_entry);
	}
	else
	{
		gtk_widget_hide(GTK_WIDGET(remminamain->priv->quick_search_separator));
		gtk_widget_hide(GTK_WIDGET(remminamain->priv->quick_search_item));
	}
	if (remminamain->priv->initialized)
	{
		remmina_pref.show_quick_search = toggled;
		remmina_pref_save();

		if (!toggled)
		{
			gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(remminamain->priv->file_model_filter));
			gtk_tree_view_expand_all(GTK_TREE_VIEW(remminamain->priv->file_list));
		}
	}
}
예제 #18
0
GtkWidget *
gnome_prefs_window_subsection_new (GtkWidget *window,
				   const gchar *section_name)
{
  GnomePrefsWindow *gpw = NULL;
  GtkWidget *container = NULL;
  GtkTreeModel *model = NULL;
  GtkTreeIter child_iter;
    
  if (!window)
    return NULL;
  
  gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (window), "gpw");

  if (!gpw || !section_name)
    return NULL;

  container = gtk_vbox_new (FALSE, 4);
  model = gtk_tree_view_get_model (GTK_TREE_VIEW (gpw->sections_tree_view));
  gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &gpw->iter);
  gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter, 0, section_name,
		      1, gpw->last_page, -1);
  gtk_tree_view_expand_all (GTK_TREE_VIEW (gpw->sections_tree_view));
  
  gpw->last_page++;
  
  gtk_notebook_append_page (GTK_NOTEBOOK (gpw->notebook),
			    container, NULL);

  gtk_widget_show_all (container);
  
  return container;
}
예제 #19
0
파일: foldersel.c 프로젝트: twolife/claws
static void foldersel_set_tree(Folder *cur_folder, FolderSelectionType type)
{
	Folder *folder;
	GList *list;

	for (list = folder_get_list(); list != NULL; list = list->next) {
		folder = FOLDER(list->data);
		cm_return_if_fail(folder != NULL);

		if (type != FOLDER_SEL_ALL) {
			if (FOLDER_TYPE(folder) == F_NEWS)
				continue;
		}
		
		if (cur_folder && (cur_folder->klass != folder->klass
		    && strcmp2(cur_folder->name, folder->name) != 0))
		    continue;
		
		foldersel_insert_gnode_in_store(tree_store, folder->node, NULL);
	}

	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_store),
					     FOLDERSEL_FOLDERNAME,
					     GTK_SORT_ASCENDING);

	gtk_tree_view_expand_all(GTK_TREE_VIEW(treeview));
}
예제 #20
0
void UzblTreeTab::RebuildTree()
{    
    int i = 0;
    for(GList* l = uzblinstances; l != NULL; l = g_list_next(l)) {
        UzblInstance* cuz = (UzblInstance*)l->data;
        cuz->SetNum(i);
        cuz->SetPNum(-1);
        cuz->ClearChildren();
        cuz->SetRowRef(NULL);
        i++;
    }
    for(GList* l = uzblinstances; l != NULL; l = g_list_next(l)) {
        UzblInstance* cuz = (UzblInstance*)l->data;
        if (cuz->GetParent() != NULL) {
            cuz->SetPNum(cuz->GetParent()->GetNum());
            cuz->GetParent()->AddChild(cuz);
        }
    }
    
    totaltabs = i;
    if (currenttab >= totaltabs)
        currenttab = totaltabs-1;
    if (currenttab < 0)
        currenttab = 0;
    
    gtk_tree_store_clear(tabmodel);
    
    for(GList* l = uzblinstances; l != NULL; l = g_list_next(l)) {
        UzblInstance* iuz = ((UzblInstance*)l->data);
        GtkTreeIter iter;
        if (iuz->GetParent() != NULL) {
            GtkTreeIter piter;
            GtkTreeRowReference* pr = iuz->GetParent()->GetRowRef();
            GtkTreePath* pp = gtk_tree_row_reference_get_path(pr);
            gtk_tree_model_get_iter(GTK_TREE_MODEL(tabmodel), &piter, pp);
            gtk_tree_store_append(tabmodel, &iter, &piter);
        }
        else {
            gtk_tree_store_append(tabmodel, &iter, NULL);
        }
        
        GtkTreePath* p = gtk_tree_model_get_path(GTK_TREE_MODEL(tabmodel), &iter);
        GtkTreeRowReference* ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(tabmodel), p);
        iuz->SetRowRef(ref);
    }
    
    gtk_tree_view_expand_all(tabtree);
    
    GtkTreeIter siter;
    UzblInstance* suz = (UzblInstance*)g_list_nth(uzblinstances, currenttab)->data;
    GtkTreeRowReference* sr = suz->GetRowRef();
    GtkTreePath* sp = gtk_tree_row_reference_get_path(sr);
    gtk_tree_model_get_iter(GTK_TREE_MODEL(tabmodel), &siter, sp);
    
    GtkTreeSelection* sel = gtk_tree_view_get_selection(tabtree);
    gtk_tree_selection_select_iter(sel, &siter);
}
예제 #21
0
파일: gconf.c 프로젝트: OpenHMR/Open-HMR600
/* Display a part of the tree starting at current node (single/split view) */
static void display_tree_part(void)
{
	if (tree2)
		gtk_tree_store_clear(tree2);
	if(view_mode == SINGLE_VIEW)
		display_tree(current);
 	else if(view_mode == SPLIT_VIEW)
		display_tree(browsed);
	gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
}
예제 #22
0
static gboolean cb_entry_changed(GtkEditable *entry, GtkTreeView *treeview)
{
    GtkTreeModelFilter *filter;

    filter = GTK_TREE_MODEL_FILTER(gtk_tree_view_get_model(treeview));
    gtk_tree_model_filter_refilter(filter);

    gtk_tree_view_expand_all(GTK_TREE_VIEW(treeview));
    return (FALSE);
}
예제 #23
0
파일: gconf.c 프로젝트: OpenHMR/Open-HMR600
/* Display the list in the left frame (split view) */
static void display_list(void)
{
	if (tree1)
		gtk_tree_store_clear(tree1);

	tree = tree1;
	display_tree(&rootmenu);
	gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w));
	tree = tree2;
}
예제 #24
0
static void
rw_preferences_dialog_categories_tree_realize (GtkWidget		 *widget, 
						  COption *parent)
{
	gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));

	gtk_tree_model_foreach (parent->categories_tree_model, 
			(GtkTreeModelForeachFunc) rw_preferences_dialog_selection_init,
			(gpointer)parent);
}
예제 #25
0
static int _dirtree_new(Prefs * prefs, char const * pathname)
{
	GtkIconTheme * theme;
	GtkWidget * scrolled;
	GtkWidget * window;
	GtkTreeStore * store;
	GtkTreeIter iter;
	GtkWidget * treeview;
	GtkCellRenderer * renderer;
	GtkTreeViewColumn * column;
	char * p;

	if((p = strdup(pathname)) == NULL)
		return -1;
	if(_folder == NULL)
	{
		theme = gtk_icon_theme_get_default();
		_folder = gtk_icon_theme_load_icon(theme, "stock_folder", 16, 0,
				NULL);
	}
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), "Directory tree");
	gtk_window_set_default_size(GTK_WINDOW(window), 480, 640);
	g_signal_connect_swapped(G_OBJECT(window), "delete-event", G_CALLBACK(
				_on_dirtree_closex), window);
	scrolled = gtk_scrolled_window_new(NULL, NULL);
	store = gtk_tree_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING,
			G_TYPE_STRING);
	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 2,
			GTK_SORT_ASCENDING);
	gtk_tree_store_append(store, &iter, NULL);
	gtk_tree_store_set(store, &iter, 0, _folder, 1, pathname, 2,
			basename(p), -1);
	_dirtree_add(store, &iter);
	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
	renderer = gtk_cell_renderer_pixbuf_new();
	column = gtk_tree_view_column_new_with_attributes("Icon", renderer,
			"pixbuf", 0, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
	renderer = gtk_cell_renderer_text_new();
	column = gtk_tree_view_column_new_with_attributes("Name", renderer,
			"text", 2, NULL);
	gtk_tree_view_column_set_expand(column, TRUE);
	gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
	g_signal_connect(G_OBJECT(treeview), "row-activated", G_CALLBACK(
				_on_dirtree_default), prefs);
	gtk_container_add(GTK_CONTAINER(scrolled), treeview);
	gtk_container_add(GTK_CONTAINER(window), scrolled);
	gtk_widget_show_all(window);
	if(*prefs & PREFS_u)
		gtk_tree_view_expand_all(GTK_TREE_VIEW(treeview));
	free(p);
	return 0;
}
예제 #26
0
static void
on_button_search_clicked(const GtkButton *p_button, GtkEntry *p_search_entry) {
   g_debug("button_search clicked %s", gtk_entry_get_text(p_search_entry));
   BREAKPOINT;

   g_debug("VALE : %s\n", gtk_entry_get_text(p_search_entry));
   model.model_search = gui_create_treemodel_search(gtk_entry_get_text(p_search_entry));
   BREAKPOINT;
   gtk_tree_view_set_model(GTK_TREE_VIEW(gui.treeview_search), model.model_search);
   gtk_tree_view_expand_all(GTK_TREE_VIEW(gui.treeview_search));
}
static void
categories_tree_selection_changed (GtkTreeSelection *selection,
                                   hierarchy_data *data)
{
    GtkTreeView *tree_view;
    GtkTreeModel *model;
    GtkTreeViewColumn *column;
    GtkTreeIter iter;
    GncExampleAccount *gea;
    GtkTextBuffer* buffer;
    gchar *text;

    /* Remove the old account tree */
    if (data->category_accounts_tree)
        gtk_widget_destroy(GTK_WIDGET(data->category_accounts_tree));
    data->category_accounts_tree = NULL;

    /* Add a new one if something selected */
    if (gtk_tree_selection_get_selected (selection, &model, &iter))
    {
        gchar *text2;
        gtk_tree_model_get (model, &iter, COL_ACCOUNT, &gea, -1);
        /* Translators: '%s' is the name of the selected account hierarchy template. */
        text2 = g_strdup_printf(_("Accounts in '%s'"), gea->title);
        text = g_strdup_printf("<b>%s</b>", text2);
        gtk_label_set_markup(data->category_accounts_label, text);
        g_free(text2);
        g_free(text);
        buffer = gtk_text_view_get_buffer(data->category_description);
        gtk_text_buffer_set_text(buffer, gea->long_description ?
                                 gea->long_description :
                                 _("No description provided."), -1);

        tree_view = gnc_tree_view_account_new_with_root (gea->root, FALSE);
        /* Override the normal fixed (user settable) sizing */
        column = gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view), 0);
        gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);

        data->category_accounts_tree = tree_view;
        gtk_tree_view_expand_all (tree_view);
        gtk_container_add(GTK_CONTAINER(data->category_accounts_container), GTK_WIDGET(tree_view));
        gtk_widget_show(GTK_WIDGET(tree_view));
    }
    else
    {
        gchar *text;
        text = g_strdup_printf ("<b>%s</b>", _("Accounts in Category"));
        gtk_label_set_markup(data->category_accounts_label, text);
        g_free (text);
        buffer = gtk_text_view_get_buffer(data->category_description);
        gtk_text_buffer_set_text(buffer, "", -1);
    }
}
예제 #28
0
파일: ctree.c 프로젝트: Jonimoose/tilp
void ctree_set_basetree(void)
{
	GtkTreeIter clc_node;
	GtkTreeIter *top_node = NULL;
	GtkTreeIter lcd_node, rom_node, idl_node, clk_node;
	gchar* str;

	// clear tree
	gtk_tree_store_clear(tree);
	
	// top node
#if 1
	str = g_strdup_printf(_("%s -> %s:#%i"), tifiles_model_to_string(options.calc_model),
		ticables_model_to_string(options.cable_model), options.cable_port);

	top_node = &clc_node;
	gtk_tree_store_append(tree, top_node, NULL);
	gtk_tree_store_set(tree, &clc_node, 
		COLUMN_NAME, str,
		COLUMN_DATA, (gpointer) NULL, -1);
	g_free(str);
#endif

	// lcd, rom, vars & apps nodes
	gtk_tree_store_append(tree, &lcd_node, top_node);
	gtk_tree_store_set(tree, &lcd_node, COLUMN_NAME, NODE1,
			   COLUMN_DATA, (gpointer) NULL, -1);

	gtk_tree_store_append(tree, &rom_node, top_node);
	gtk_tree_store_set(tree, &rom_node, COLUMN_NAME, NODE2,
			   COLUMN_DATA, (gpointer) NULL, -1);

	gtk_tree_store_append(tree, &vars_node, top_node);
	gtk_tree_store_set(tree, &vars_node, COLUMN_NAME, NODE3,
			   COLUMN_DATA, (gpointer) NULL, -1);

	if (tifiles_is_flash(options.calc_model)) 
	{
		gtk_tree_store_append(tree, &apps_node, top_node);
		gtk_tree_store_set(tree, &apps_node, COLUMN_NAME, NODE4,
				   COLUMN_DATA, (gpointer) NULL, -1);

		gtk_tree_store_append(tree, &idl_node, top_node);
		gtk_tree_store_set(tree, &idl_node, COLUMN_NAME, NODE5,
				   COLUMN_DATA, (gpointer) NULL, -1);

		gtk_tree_store_append(tree, &clk_node, top_node);
		gtk_tree_store_set(tree, &clk_node, COLUMN_NAME, NODE6,
				   COLUMN_DATA, (gpointer) NULL, -1);
	}

	gtk_tree_view_expand_all(GTK_TREE_VIEW(ctree_wnd));
}
예제 #29
0
파일: sortmodel.c 프로젝트: Pfiver/gtk
static void
ref_count_cleanup (void)
{
  GtkTreeIter grandparent1, grandparent2, parent1, parent2;
  GtkTreeIter iter_parent1, iter_parent2;
  GtkTreeModel *model;
  GtkTreeModelRefCount *ref_model;
  GtkTreeModel *sort_model;
  GtkWidget *tree_view;

  model = gtk_tree_model_ref_count_new ();
  ref_model = GTK_TREE_MODEL_REF_COUNT (model);

  /* + grandparent1
   * + grandparent2
   *   + parent1
   *     + iter_parent1
   *   + parent2
   *     + iter_parent2
   *     + iter_parent2
   */

  gtk_tree_store_append (GTK_TREE_STORE (model), &grandparent1, NULL);
  gtk_tree_store_append (GTK_TREE_STORE (model), &grandparent2, NULL);
  gtk_tree_store_append (GTK_TREE_STORE (model), &parent1, &grandparent2);
  gtk_tree_store_append (GTK_TREE_STORE (model), &iter_parent1, &parent1);
  gtk_tree_store_append (GTK_TREE_STORE (model), &parent2, &grandparent2);
  gtk_tree_store_append (GTK_TREE_STORE (model), &iter_parent2, &parent2);
  gtk_tree_store_append (GTK_TREE_STORE (model), &iter_parent2, &parent2);

  sort_model = gtk_tree_model_sort_new_with_model (model);
  tree_view = gtk_tree_view_new_with_model (sort_model);

  gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));

  gtk_widget_destroy (tree_view);

  assert_node_ref_count (ref_model, &grandparent1, 0);
  assert_node_ref_count (ref_model, &grandparent2, 1);
  assert_node_ref_count (ref_model, &parent1, 1);
  assert_node_ref_count (ref_model, &parent2, 1);
  assert_node_ref_count (ref_model, &iter_parent1, 0);
  assert_node_ref_count (ref_model, &iter_parent2, 0);

  gtk_tree_model_sort_clear_cache (GTK_TREE_MODEL_SORT (sort_model));

  assert_entire_model_unreferenced (ref_model);

  g_object_unref (sort_model);
  g_object_unref (ref_model);
}
예제 #30
0
static void
usage_view_project_loaded_cb (MrpProject *project, PlannerView *view)
{
	PlannerUsageViewPriv *priv;
        GtkTreeModel         *model;

	priv = PLANNER_USAGE_VIEW (view)->priv;

	/* FIXME: This is not working so well. Look at how the gantt view
	 * handles this. (The crux is that the root task for example might
	 * change when a project is loaded, so we need to rconnect signals
	 * etc.)
	 */
        if (project == priv->project) {
		/* FIXME: Due to the above, we have this hack. */
		planner_usage_chart_setup_root_task (priv->chart);

                gtk_tree_view_expand_all (GTK_TREE_VIEW (priv->tree));
                planner_usage_chart_expand_all (priv->chart);
                return;
        }

	model = GTK_TREE_MODEL (planner_usage_model_new (project));

	planner_usage_tree_set_model (PLANNER_USAGE_TREE (priv->tree),
				      PLANNER_USAGE_MODEL (model));
        planner_usage_chart_set_model (PLANNER_USAGE_CHART (priv->chart), model);

	priv->expose_id = g_signal_connect_after (priv->tree,
						  "expose_event",
						  G_CALLBACK (usage_view_expose_cb),
						  view);

	g_object_unref (model);

	gtk_tree_view_expand_all (GTK_TREE_VIEW (priv->tree));
        planner_usage_chart_expand_all (priv->chart);
}