当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_TREE_VIEW函数代码示例

本文整理汇总了C++中GTK_TREE_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TREE_VIEW函数的具体用法?C++ GTK_TREE_VIEW怎么用?C++ GTK_TREE_VIEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_TREE_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create_view

/*----------导入功能up----------------------------------------------------------------*/
void create_view(GtkWidget *container,gpointer data)//容器管理的主界面
{
	GtkTreeViewColumn *column22;
	GtkTreeViewColumn *column33;
	GtkTreeViewColumn *column44;
	GtkWidget *window;
	//GtkWidget *combox_images;
	GtkBuilder *builder;
	GtkTreeIter iter;
	GtkWidget *button11;
	GtkWidget *button22;
	GtkWidget *button33;
	GtkWidget *button44;
	GtkWidget *button55;
	GtkWidget *button66;
	GtkWidget *button77;
	GtkWidget *button88;
	GtkWidget *button99;
	GtkWidget *button110;
	
	GtkCellRenderer *cell11;
	GtkListStore *list11;
	
	GtkCellRenderer *cell;
	GtkTreeSelection *selection;
	static int j;
	docker_contain();
	builder=gtk_builder_new ();
	gtk_builder_add_from_file (builder,CONTAINER_MANAGE_FILE,NULL);
	window=GTK_WIDGET(gtk_builder_get_object (builder,CONTAINER_MANAGE_WINDOW));
	gtk_window_set_title (window,_("contians manage"));
	gtk_widget_set_name(window, "nfs_container_mange_window");
	button11=GTK_WIDGET(gtk_builder_get_object (builder,"button1"));
	button22=GTK_WIDGET(gtk_builder_get_object (builder,"button2"));
	button33=GTK_WIDGET(gtk_builder_get_object (builder,"button3"));
	button44=GTK_WIDGET(gtk_builder_get_object (builder,"button4"));
	button55=GTK_WIDGET(gtk_builder_get_object (builder,"button5"));
	button66=GTK_WIDGET(gtk_builder_get_object (builder,"button6"));
	button77=GTK_WIDGET(gtk_builder_get_object (builder,"button7"));
	button88=GTK_WIDGET(gtk_builder_get_object (builder,"button8"));
	button99=GTK_WIDGET(gtk_builder_get_object (builder,"button9"));
	button110=GTK_WIDGET(gtk_builder_get_object (builder,"button10"));
	
	column22=GTK_WIDGET(gtk_builder_get_object (builder,"treeviewcolumn1"));
	column33=GTK_WIDGET(gtk_builder_get_object (builder,"treeviewcolumn2"));
	column44=GTK_WIDGET(gtk_builder_get_object (builder,"treeviewcolumn3"));
	gtk_tree_view_column_set_title (column22,_("Mirror image"));
	cell=gtk_cell_renderer_text_new ();
	gtk_tree_view_column_pack_start (column22, cell,FALSE);
	gtk_tree_view_column_set_attributes(column22,cell,"text",0,NULL);
	
	gtk_tree_view_column_set_title (column33,"ID");
	cell=gtk_cell_renderer_text_new ();
	gtk_tree_view_column_pack_start (column33,cell,FALSE);
	gtk_tree_view_column_set_attributes(column33,cell,"text",1,NULL);
	
	gtk_tree_view_column_set_title (column44,_("name_colum"));
	cell=gtk_cell_renderer_text_new ();
	gtk_tree_view_column_pack_start (column44,cell,FALSE);
	gtk_tree_view_column_set_attributes(column44,cell,"text",2,NULL);
	
	gtk_button_set_label (GTK_BUTTON(button11),_("starting contain and enter"));
	
	gtk_button_set_label (GTK_BUTTON(button22),_("stop contian"));
         gtk_button_set_label (GTK_BUTTON(button33),_("create gurd contian"));
         gtk_button_set_label (GTK_BUTTON(button44),_("create contian"));
         gtk_button_set_label (GTK_BUTTON(button55),_("export"));
	
	gtk_button_set_label (GTK_BUTTON(button66),_("ls starting contain"));
	gtk_button_set_label (GTK_BUTTON(button77),_("ls gurd contain"));
	gtk_button_set_label (GTK_BUTTON(button88),_("dele on contian"));
	gtk_button_set_label (GTK_BUTTON(button99),_("dele mul contians"));
	gtk_button_set_label (GTK_BUTTON(button110),_("import"));
	
	tree_view=GTK_WIDGET(gtk_builder_get_object (builder,"treeview1"));
	list11=gtk_list_store_new (4, G_TYPE_STRING,G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING);
	gtk_tree_view_set_model (GTK_TREE_VIEW(tree_view),GTK_TREE_MODEL(list11));
	selection=gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view));

	

	
	//mod=gtk_tree_view_get_model (GTK_TREE_VIEW(tree_view));
	g_signal_connect(G_OBJECT(tree_view),"cursor-changed",G_CALLBACK(clicked_row11),selection);
	//g_signal_connect(G_OBJECT(selection),"changed",G_CALLBACK(clicked_row11),selection);
	g_signal_connect(G_OBJECT(button11),"clicked",G_CALLBACK(button11_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button88),"clicked",G_CALLBACK(button88_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button44),"clicked",G_CALLBACK(button44_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button33),"clicked",G_CALLBACK(button33_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button99),"clicked",G_CALLBACK(button99_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button66),"clicked",G_CALLBACK(button33_fun),"docker ps");
	g_signal_connect(G_OBJECT(button22),"clicked",G_CALLBACK(button22_treeview_fun),selection);
	g_signal_connect(G_OBJECT(button110),"clicked",G_CALLBACK(import_selcet_file),window);
	g_signal_connect(G_OBJECT(button55),"clicked",G_CALLBACK(export_selcet_file),selection);
	g_signal_connect(G_OBJECT(button77),"clicked",G_CALLBACK(button77_lsgurd_fun),window);
	
		for(j=0;j<contains_num;j++){
	gtk_list_store_append (list11,&iter);
	gtk_list_store_set (list11, &iter, 0,&a[j].image,-1);
//.........这里部分代码省略.........
开发者ID:jy4618272,项目名称:docker-gui,代码行数:101,代码来源:nfs_container_manage.c

示例2: fcitx_im_dialog_init

static void
fcitx_im_dialog_init(FcitxImDialog* self)
{
    gtk_window_set_title(GTK_WINDOW(self), _("Add input method"));
    gtk_window_set_modal(GTK_WINDOW(self), TRUE);

    gtk_dialog_add_buttons(GTK_DIALOG(self),
                           GTK_STOCK_CANCEL,
                           GTK_RESPONSE_CANCEL,
                           GTK_STOCK_OK,
                           GTK_RESPONSE_OK,
                           NULL
                          );
    gtk_dialog_set_alternative_button_order (GTK_DIALOG (self),
                                         GTK_RESPONSE_OK,
                                         GTK_RESPONSE_CANCEL,
                                         -1);

    g_signal_connect(self, "response",
                    G_CALLBACK(_fcitx_im_dialog_response_cb),
                    NULL);

    GtkCellRenderer* renderer;
    GtkTreeViewColumn* column;

    gtk_widget_set_size_request(GTK_WIDGET(self), 400, 300);

    self->availimstore = gtk_list_store_new(IM_N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
    self->filtermodel = gtk_tree_model_filter_new(GTK_TREE_MODEL(self->availimstore), NULL);

    gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(self->filtermodel),
                                        (GtkTreeModelFilterVisibleFunc) _fcitx_im_dialog_filter_func,
                                           self ,
                                           NULL);
    self->sortmodel = gtk_tree_model_sort_new_with_model(self->filtermodel);
    gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(self->sortmodel), IM_LIST_IM_STRING, GTK_SORT_ASCENDING);
    self->availimview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(self->sortmodel));

    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(
                 _("Input Method"), renderer,
                 "text", IM_LIST_IM_STRING,
                 NULL);
    gtk_tree_view_append_column(GTK_TREE_VIEW(self->availimview), column);

    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(self->availimview), FALSE);
    GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self->availimview));
    gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
    g_signal_connect(G_OBJECT(selection), "changed",
                     G_CALLBACK(_fcitx_im_dialog_im_selection_changed), self);
    GtkWidget* scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_container_add(GTK_CONTAINER(scrolledwindow), self->availimview);

    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), scrolledwindow, TRUE, TRUE, 0);
    g_object_set(G_OBJECT(scrolledwindow), "margin-left", 5, "margin-right", 5, "shadow-type", GTK_SHADOW_IN, NULL);

    self->onlycurlangcheckbox = gtk_check_button_new_with_label(_("Only Show Current Language"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self->onlycurlangcheckbox), TRUE);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), self->onlycurlangcheckbox, FALSE, TRUE, 0);
    g_object_set(G_OBJECT(self->onlycurlangcheckbox), "margin-left", 5, "margin-right", 5, NULL);

    self->filterentry = gtk_entry_new();
    gtk_entry_set_icon_from_stock (GTK_ENTRY (self->filterentry),
                                    GTK_ENTRY_ICON_SECONDARY,
                                    GTK_STOCK_CLEAR);
#if GTK_CHECK_VERSION(3,2,0)
    gtk_entry_set_placeholder_text(GTK_ENTRY (self->filterentry), _("Search Input Method"));
#endif
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), self->filterentry, FALSE, TRUE, 0);
    g_object_set(G_OBJECT(self->filterentry), "margin-left", 5, "margin-right", 5, NULL);

    g_signal_connect(G_OBJECT(self->filterentry), "changed", G_CALLBACK(_fcitx_im_dialog_filtertext_changed), self);
    g_signal_connect(G_OBJECT(self->onlycurlangcheckbox), "toggled", G_CALLBACK(_fcitx_im_dialog_onlycurlangcheckbox_toggled), self);
    g_signal_connect(G_OBJECT(self->filterentry), "icon-press", G_CALLBACK (icon_press_cb), NULL);

    _fcitx_im_dialog_connect(self);
}
开发者ID:tigersoldier,项目名称:fcitx-configtool,代码行数:78,代码来源:im_dialog.c

示例3: gwy_module_browser_construct

static GtkWidget*
gwy_module_browser_construct(GtkWidget *parent)
{
    static const struct {
        const gchar *title;
        const guint id;
    }
    columns[] = {
        { N_("Module"), MODULE_NAME },
        { N_("Version"), MODULE_VERSION },
        { N_("Author"), MODULE_AUTHOR },
    };

    GtkWidget *tree;
    GtkListStore *store;
    GtkTreeSelection *selection;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    GSList *l, *list = NULL;
    GtkTreeIter iter;
    gsize i;

    store = gtk_list_store_new(MODULE_LAST,
                               G_TYPE_STRING,
                               G_TYPE_STRING,
                               G_TYPE_STRING);
    gwy_module_foreach(gwy_hash_table_to_slist_cb, &list);
    list = g_slist_sort(list, (GCompareFunc)module_name_compare_cb);
    for (l = list; l; l = g_slist_next(l)) {
        const GwyModuleInfo *mod_info = (const GwyModuleInfo*)l->data;

        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
                           MODULE_NAME, mod_info->name,
                           MODULE_VERSION, mod_info->version,
                           MODULE_AUTHOR, mod_info->author,
                           -1);
    }
    g_slist_free(list);

    tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
    gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
    g_object_unref(store);

    for (i = 0; i < G_N_ELEMENTS(columns); i++) {
        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(_(columns[i].title),
                                                          renderer,
                                                          "text",
                                                          columns[i].id,
                                                          NULL);
        gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
    }

    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
    gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

    g_signal_connect(G_OBJECT(tree), "cursor-changed",
                     G_CALLBACK(update_module_info_cb), parent);

    return tree;
}
开发者ID:svn2github,项目名称:gwyddion,代码行数:62,代码来源:gwymodulebrowser.c

示例4: zkartmat_add_columns

void zkartmat_add_columns(GtkTreeView *treeview)
{
GtkCellRenderer *renderer;
//GtkTreeModel *model = gtk_tree_view_get_model (treeview);
//GdkColor color;

printf("zkartmat_add_columns\n");

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Дата подт-ния"), renderer,"text", COL_DATAP,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Дата док-та"), renderer,"text", COL_DATADOK,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Номер документа"), renderer,"text", COL_NOMDOK,NULL);


renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Операция"), renderer,"text", COL_KODOP,NULL);


renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Контрагент"), renderer,"text", COL_KONTR,NULL);


renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Количество"), renderer,"text", COL_KOLIH,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,"+\\-", renderer,"text", COL_PR,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1,gettext("Цена"), renderer,"text", COL_CENA,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),-1,
gettext("Дополнительное наименование"), renderer,
"text", COL_DOPNAIM,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),-1,
gettext("Дата и время записи"), renderer,
"text", COL_DATA_VREM,NULL);

renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),-1,
gettext("Кто записал"), renderer,
"text", COL_KTO,NULL);

printf("zkartmat_add_columns end\n");

}
开发者ID:zaharchuktv,项目名称:linuxbuh,代码行数:61,代码来源:l_zkartmat.c

示例5: ft_manager_build_ui

static void
ft_manager_build_ui (EmpathyFTManager *manager)
{
  GtkBuilder *gui;
  GtkTreeView *view;
  GtkListStore *liststore;
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkTreeSelection *selection;
  gchar *filename;
  EmpathyFTManagerPriv *priv = GET_PRIV (manager);

  filename = empathy_file_lookup ("empathy-ft-manager.ui", "src");
  gui = empathy_builder_get_file (filename,
      "ft_manager_dialog", &priv->window,
      "ft_list", &priv->treeview,
      "clear_button", &priv->clear_button,
      "open_button", &priv->open_button,
      "abort_button", &priv->abort_button,
      NULL);
  g_free (filename);

  empathy_builder_connect (gui, manager,
      "ft_manager_dialog", "destroy", ft_manager_destroy_cb,
      "ft_manager_dialog", "response", ft_manager_response_cb,
      "ft_manager_dialog", "delete-event", ft_manager_delete_event_cb,
      "ft_manager_dialog", "key-press-event", ft_manager_key_press_event_cb,
      NULL);

  empathy_builder_unref_and_keep_widget (gui, priv->window);

  /* Window geometry. */
  empathy_geometry_bind (GTK_WINDOW (priv->window), "ft-manager");

  /* Setup the tree view */
  view = GTK_TREE_VIEW (priv->treeview);
  selection = gtk_tree_view_get_selection (view);
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
  g_signal_connect (selection, "changed",
      G_CALLBACK (ft_manager_selection_changed), manager);
  gtk_tree_view_set_headers_visible (view, TRUE);
  gtk_tree_view_set_enable_search (view, FALSE);

  /* Setup the model */
  liststore = gtk_list_store_new (5,
      G_TYPE_INT,     /* percent */
      G_TYPE_ICON,    /* icon */
      G_TYPE_STRING,  /* message */
      G_TYPE_STRING,  /* remaining */
      G_TYPE_OBJECT); /* ft_handler */
  gtk_tree_view_set_model (view, GTK_TREE_MODEL (liststore));
  priv->model = GTK_TREE_MODEL (liststore);
  g_object_unref (liststore);

  /* Progress column */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("%"));
  gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_progress_new ();
  g_object_set (renderer, "xalign", 0.5, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_cell_data_func (column, renderer,
      ft_manager_progress_cell_data_func, NULL, NULL);

  /* Icon and filename column*/
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("File"));
  gtk_tree_view_column_set_expand (column, TRUE);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_column_set_sort_column_id (column, COL_MESSAGE);
  gtk_tree_view_column_set_spacing (column, 3);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_pixbuf_new ();
  g_object_set (renderer, "xpad", 3,
      "stock-size", GTK_ICON_SIZE_DND, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "gicon", COL_ICON, NULL);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
  gtk_tree_view_column_pack_start (column, renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "text", COL_MESSAGE, NULL);

  /* Remaining time column */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, _("Remaining"));
  gtk_tree_view_column_set_sort_column_id (column, COL_REMAINING);
  gtk_tree_view_insert_column (view, column, -1);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "xalign", 0.5, NULL);
  gtk_tree_view_column_pack_start (column, renderer, FALSE);
  gtk_tree_view_column_set_attributes (column, renderer,
      "text", COL_REMAINING, NULL);

//.........这里部分代码省略.........
开发者ID:blackskad,项目名称:empathy,代码行数:101,代码来源:empathy-ft-manager.c

示例6: poimatdok_create_list

void poimatdok_create_list (class poimatdok_data *data)
{
GtkListStore *model=NULL;
GtkTreeIter iter;
SQLCURSOR cur;
char strsql[512];
int  kolstr=0;
SQL_str row;

data->kl_shift=0; //0-отжата 1-нажата  

gdk_window_set_cursor(data->window->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
iceb_refresh();

if(data->treeview != NULL)
  gtk_widget_destroy(data->treeview);

data->treeview = gtk_tree_view_new();


gtk_container_add (GTK_CONTAINER (data->sw), data->treeview);

g_signal_connect(data->treeview,"row_activated",G_CALLBACK(poimatdok_v_row),data);

GtkTreeSelection *selection=gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview));
gtk_tree_selection_set_mode(selection,GTK_SELECTION_SINGLE);
g_signal_connect(selection,"changed",G_CALLBACK(poimatdok_vibor),data);

gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (data->treeview), TRUE); //Устанавливаются полоски при отображении списка
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (data->treeview)),GTK_SELECTION_SINGLE);




model = gtk_list_store_new (NUM_COLUMNS+1, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_STRING, 
G_TYPE_INT);


sprintf(strsql,"select datd,sklad,nomd,kontr,kodop,pod,pro,tip,ktoi,vrem from Dokummat where nomd='%s' \
order by datd desc",data->nomdok_p.ravno());

if((kolstr=cur.make_cursor(&bd,strsql)) < 0)
 {
  iceb_msql_error(&bd,gettext("Ошибка создания курсора !"),strsql,data->window);
  return;
 }
//gtk_list_store_clear(model);

iceb_u_str ss[NUM_COLUMNS];

data->kolzap=0;


while(cur.read_cursor(&row) != 0)
 {
//  printf("%s %s %s %s\n",row[0],row[1],row[2],row[3]);
  //Дата  
  if(row[7][0] == '1')
   ss[COL_METKA].new_plus("+");
  if(row[7][0] == '2')
   ss[COL_METKA].new_plus("-");
  if(row[5][0] == '0')
   ss[COL_METKA].plus("?");
  if(row[6][0] == '0')
   ss[COL_METKA].plus("*");

  //склад
  ss[COL_SKLAD].new_plus(row[1]);

  //Дата документа
  ss[COL_DATADOK].new_plus(iceb_u_sqldata(row[0]));

  //Номер документа
  ss[COL_NOMDOK].new_plus(iceb_u_toutf(row[2]));

  //Код операции
  ss[COL_KODOP].new_plus(iceb_u_toutf(row[4]));


  //Код контрагента
  ss[COL_KONTR].new_plus(iceb_u_toutf(row[3]));
  

  //Дата и время записи
  ss[COL_DATA_VREM].new_plus(iceb_u_toutf(iceb_u_vremzap(row[9])));

  //Кто записал
  ss[COL_KTO].new_plus(iceb_kszap(row[8],0,data->window));

  
  gtk_list_store_append (model, &iter);

//.........这里部分代码省略.........
开发者ID:zaharchuktv,项目名称:linuxbuh,代码行数:101,代码来源:l_poimatdok.c

示例7: make_results_view

static GtkWidget *
make_results_view (XpathExplorer * ttt)
{
	g_return_val_if_fail(ttt != NULL, NULL);
	
	GtkTreeViewColumn	*col;
	GtkCellRenderer		*renderer, *icon_renderer;
	GtkWidget			*view;

	view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(make_results_blank()));
	//view = gtk_tree_view_new();
	
	gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(view), TRUE);
	
	g_signal_connect(view, "button-press-event",
			G_CALLBACK(xpath_explorer_button_press_event), ttt);
/*
    g_signal_connect(view, "popup-menu",
			G_CALLBACK(xpath_view_onPopupMenu), ttt);*/

	g_signal_connect(view, "row-activated",
			G_CALLBACK(xpath_explorer_row_activated), ttt);

 	col = gtk_tree_view_column_new();
 	gtk_tree_view_column_set_title (col, _("Name"));
	gtk_tree_view_column_set_resizable(col, TRUE);
	 
    icon_renderer = xml_cell_renderer_new();
    gtk_tree_view_column_pack_start(col, icon_renderer, FALSE);
    gtk_tree_view_column_set_attributes(col, icon_renderer,
                                        "node-id", XML_TREE_MODEL_COL_TYPE,
                                        NULL);

 	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start (col, renderer, TRUE);
	gtk_tree_view_column_add_attribute (col, renderer, "text", XML_TREE_MODEL_COL_NAME);
	gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);
 
	renderer = gtk_cell_renderer_text_new();
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_pack_start (col, renderer, TRUE);
	gtk_tree_view_column_add_attribute (col, renderer, "text", XML_TREE_MODEL_COL_XPATH);
	gtk_tree_view_column_set_title (col, _("XPath"));
	gtk_tree_view_column_set_resizable(col, TRUE);
	gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);

	renderer = gtk_cell_renderer_text_new();
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_pack_start (col, renderer, TRUE);
	gtk_tree_view_column_add_attribute (col, renderer, "text", XML_TREE_MODEL_COL_LINE);
	gtk_tree_view_column_set_title (col, _("Line"));
	gtk_tree_view_column_set_resizable(col, TRUE);
	gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);

	renderer = gtk_cell_renderer_text_new();
	g_object_set(renderer,"ellipsize", PANGO_ELLIPSIZE_END, NULL);
	g_object_set(renderer,"single-paragraph-mode", TRUE, NULL);

	col = gtk_tree_view_column_new();
	gtk_tree_view_column_pack_start (col, renderer, TRUE);
	gtk_tree_view_column_add_attribute (col, renderer, "text", XML_TREE_MODEL_COL_CONTENT);
	gtk_tree_view_column_set_title (col, _("Value"));
	gtk_tree_view_column_set_resizable(col, TRUE);
	gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);

	return view;
}
开发者ID:chebizarro,项目名称:gtk_xml_tools,代码行数:67,代码来源:xpathexplorer.c

示例8: dialog_zoom

void
dialog_zoom (WBCGtk *wbcg, Sheet *sheet)
{
	ZoomState *state;
	GSList *l, *sheets;
	int i, row, cur_row;
	gboolean is_custom = TRUE;
	GtkRadioButton *radio;
	GtkWidget *focus_target;
	GladeXML     *gui;
	GtkTreeViewColumn *column;

	g_return_if_fail (wbcg != NULL);
	g_return_if_fail (sheet != NULL);

	if (gnumeric_dialog_raise_if_exists (wbcg, ZOOM_DIALOG_KEY))
		return;
	gui = gnm_glade_xml_new (GO_CMD_CONTEXT (wbcg),
		"dialog-zoom.glade", NULL, NULL);
	if (gui == NULL)
		return;

	state = g_new (ZoomState, 1);
	state->wbcg   = wbcg;
	state->gui    = gui;
	state->dialog = glade_xml_get_widget (state->gui, "Zoom");
	g_return_if_fail (state->dialog != NULL);

	/* Get the list of sheets */
	state->sheet_list_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
	state->sheet_list = GTK_TREE_VIEW (glade_xml_get_widget (state->gui, "sheet_list"));
	gtk_tree_view_set_headers_visible (state->sheet_list, FALSE);
	gtk_tree_view_set_model (state->sheet_list, GTK_TREE_MODEL (state->sheet_list_model));
	state->sheet_list_selection = gtk_tree_view_get_selection (state->sheet_list);
	gtk_tree_selection_set_mode (state->sheet_list_selection, GTK_SELECTION_MULTIPLE);

	column = gtk_tree_view_column_new_with_attributes (_("Name"),
			gtk_cell_renderer_text_new (),
			"text", 0,
			NULL);
	gtk_tree_view_column_set_sort_column_id (column, COL_SHEET_NAME);
	gtk_tree_view_append_column (GTK_TREE_VIEW (state->sheet_list), column);

	sheets = workbook_sheets (wb_control_get_workbook (WORKBOOK_CONTROL (wbcg)));
	cur_row = row = 0;
	for (l = sheets; l; l = l->next) {
		GtkTreeIter iter;
		Sheet *this_sheet = l->data;

		gtk_list_store_append (state->sheet_list_model, &iter);
		gtk_list_store_set (state->sheet_list_model,
				    &iter,
				    COL_SHEET_NAME, this_sheet->name_unquoted,
				    COL_SHEET_PTR, this_sheet,
				    -1);

		if (this_sheet == sheet)
			cur_row = row;
		row++;
	}
	g_slist_free (sheets);

	{
		GtkTreePath *path = gtk_tree_path_new_from_indices (cur_row, -1);
		gtk_tree_view_set_cursor (state->sheet_list, path, NULL, FALSE);
		gtk_tree_path_free (path);
	}

	state->zoom  = GTK_SPIN_BUTTON (glade_xml_get_widget (state->gui, "zoom"));
	g_return_if_fail (state->zoom != NULL);
	state->custom = GTK_RADIO_BUTTON (glade_xml_get_widget (state->gui, "radio_custom"));
	g_return_if_fail (state->custom != NULL);
	focus_target = GTK_WIDGET (state->custom);
	g_signal_connect (G_OBJECT (state->custom),
		"clicked",
		G_CALLBACK (focus_to_custom), (gpointer) state);
	g_signal_connect (G_OBJECT (state->zoom),
		"focus_in_event",
		G_CALLBACK (custom_selected), state);

	for (i = 0; buttons[i].name != NULL; i++) {
		radio  = GTK_RADIO_BUTTON (glade_xml_get_widget (state->gui, buttons[i].name));
		g_return_if_fail (radio != NULL);

		g_object_set_data (G_OBJECT (radio), ZOOM_DIALOG_FACTOR_KEY,
				   GINT_TO_POINTER(buttons[i].factor));

		g_signal_connect (G_OBJECT (radio),
			"toggled",
			G_CALLBACK (radio_toggled), state);

		if (((int)(sheet->last_zoom_factor_used * 100. + .5)) == buttons[i].factor) {
			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
			is_custom = FALSE;
			focus_target = GTK_WIDGET (radio);
		}
	}

	if (is_custom) {
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->custom), TRUE);
//.........这里部分代码省略.........
开发者ID:Ghnuberath,项目名称:gnumeric,代码行数:101,代码来源:dialog-zoom.c

示例9: questions_tree_view_row_activated


//.........这里部分代码省略.........
		                    DATA_COLUMN, &object,
		                    -1);
		if (GPINSTRUCT_IS_LESSON_TEST_MULTI_CHOICE_QUESTION (object))
		{
			GPInstructLessonTestMultiChoiceQuestion *question = GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_QUESTION (object);
			guint choices_num = gpinstruct_lesson_test_multi_choice_question_get_choices_length (question);

			GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Question Properties"),
			                                                 GTK_WINDOW (priv->window),
			                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
			                                                 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
			                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
			                                                 NULL);
			GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
			gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);

			scrolled_window = gtk_scrolled_window_new (NULL, NULL);
			gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
			                                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
			text_view = gtk_text_view_new ();
			gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD_CHAR);
			gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
			                          gpinstruct_lesson_test_multi_choice_question_get_text (question),
			                          -1);
			gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    gtk_label_new (_("Text:")),
			                    FALSE, TRUE, 0);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    scrolled_window,
			                    TRUE, TRUE, 0);

			scrolled_window = gtk_scrolled_window_new (NULL, NULL);
			gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
			                                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
			explanation_view = gtk_text_view_new ();
			gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (explanation_view), GTK_WRAP_WORD_CHAR);
			gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (explanation_view)),
			                          gpinstruct_lesson_test_multi_choice_question_get_explanation (question),
			                          -1);
			gtk_container_add (GTK_CONTAINER (scrolled_window), explanation_view);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    gtk_label_new (_("Explanation:")),
			                    FALSE, TRUE, 0);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    scrolled_window,
			                    TRUE, TRUE, 0);

			if (choices_num)
			{
				answer_combobox = gtk_combo_box_new_with_model (GTK_TREE_MODEL (priv->choices_store));
				GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
				gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (answer_combobox), renderer, TRUE);
				gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (answer_combobox), renderer,
				                                "text", TITLE_COLUMN,
				                                NULL);
				gtk_combo_box_set_active (GTK_COMBO_BOX (answer_combobox),
				                          gpinstruct_lesson_test_multi_choice_question_get_answer (question));
				gtk_box_pack_start (GTK_BOX (content_area),
				                    gtk_label_new (_("Answer:")),
				                    FALSE, TRUE, 0);
				gtk_box_pack_start (GTK_BOX (content_area),
				                    answer_combobox,
				                    FALSE, TRUE, 0);
			}

			gtk_widget_show_all (content_area);
			if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
			{
				GtkTextIter start, end;
				gchar *text;

				gtk_text_buffer_get_bounds (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
				                            &start, &end);
				text = gtk_text_iter_get_text (&start, &end);
				gpinstruct_lesson_test_multi_choice_question_set_text (question, text);
				g_free (text);

				gtk_text_buffer_get_bounds (gtk_text_view_get_buffer (GTK_TEXT_VIEW (explanation_view)),
				                            &start, &end);
				text = gtk_text_iter_get_text (&start, &end);
				gpinstruct_lesson_test_multi_choice_question_set_explanation (question, text);
				g_free (text);

				if (choices_num)
					gpinstruct_lesson_test_multi_choice_question_set_answer (question,
					                                                         gtk_combo_box_get_active (GTK_COMBO_BOX (answer_combobox)));

				update_questions_tree_view (GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_EDITOR (user_data));
				gpinstruct_editor_window_set_modified (priv->window, TRUE);

				gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->questions_store),
				                               &iter, NULL, gtk_tree_path_get_indices (path)[0]);
				gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)), &iter);
			}

			gtk_widget_destroy (dialog);
		}
	}
}
开发者ID:kyoushuu,项目名称:gpinstruct,代码行数:101,代码来源:gpinstruct-lesson-test-multi-choice-editor.c

示例10: gpinstruct_lesson_test_multi_choice_editor_init

static void
gpinstruct_lesson_test_multi_choice_editor_init (GPInstructLessonTestMultiChoiceEditor *object)
{
	object->priv = GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_EDITOR_GET_PRIVATE (object);
	GPInstructLessonTestMultiChoiceEditorPrivate *priv = object->priv;

	priv->questions_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
	priv->choices_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);

	priv->title_label = gtk_label_new (_("Title:"));
	gtk_table_attach (GTK_TABLE (object), priv->title_label,
	                  0, 1, 0, 1,
	                  GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL,
	                  3, 3);
	priv->title_entry = gtk_entry_new ();
	gtk_table_attach (GTK_TABLE (object), priv->title_entry,
	                  1, 2, 0, 1,
	                  GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL,
	                  3, 3);

	priv->directions_label = gtk_label_new (_("Directions:"));
	gtk_table_attach (GTK_TABLE (object), priv->directions_label,
	                  0, 1, 1, 2,
	                  GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL,
	                  3, 3);
	GtkWidget *directions_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (directions_view_scrolled_window),
	                                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	priv->directions_view = gtk_text_view_new ();
	gtk_container_add (GTK_CONTAINER (directions_view_scrolled_window), priv->directions_view);
	gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->directions_view), GTK_WRAP_WORD_CHAR);
	gtk_table_attach (GTK_TABLE (object), directions_view_scrolled_window,
	                  1, 2, 1, 2,
	                  GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
	                  3, 3);

	priv->explain_label = gtk_label_new (_("Explain:"));
	gtk_table_attach (GTK_TABLE (object), priv->explain_label,
	                  0, 1, 2, 3,
	                  GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL,
	                  3, 3);
	priv->explain_switch = gtk_switch_new ();
	gtk_table_attach (GTK_TABLE (object), priv->explain_switch,
	                  1, 2, 2, 3,
	                  GTK_SHRINK, GTK_SHRINK | GTK_FILL,
	                  3, 3);


	GtkWidget *questions_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
	gtk_table_attach (GTK_TABLE (object), questions_hbox,
	                  0, 2, 3, 4,
	                  GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL,
	                  3, 3);

	GtkWidget *questions_tree_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (questions_tree_view_scrolled_window),
	                                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_box_pack_start (GTK_BOX (questions_hbox), questions_tree_view_scrolled_window, TRUE, TRUE, 0);

	priv->questions_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->questions_store));
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->questions_tree_view), TRUE);
	gtk_widget_set_events (priv->questions_tree_view, GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK);
	g_signal_connect (priv->questions_tree_view, "row-activated", G_CALLBACK (questions_tree_view_row_activated), object);
	g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->questions_tree_view)), "changed", G_CALLBACK (questions_tree_selection_changed), object);
	gtk_container_add (GTK_CONTAINER (questions_tree_view_scrolled_window), priv->questions_tree_view);

	GtkTreeViewColumn *questions_column = gtk_tree_view_column_new_with_attributes (_("Questions:"), gtk_cell_renderer_text_new (),
	                                                                                "text", 0,
	                                                                                NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (priv->questions_tree_view), questions_column);

	GtkWidget *questions_buttonbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (questions_buttonbox), GTK_BUTTONBOX_START);
	gtk_box_pack_start (GTK_BOX (questions_hbox), questions_buttonbox, FALSE, TRUE, 0);

	GtkWidget *questions_add_button = gtk_button_new_from_stock (GTK_STOCK_ADD);
	g_signal_connect (questions_add_button, "clicked", G_CALLBACK (questions_add_button_clicked), object);
	gtk_box_pack_start (GTK_BOX (questions_buttonbox), questions_add_button, FALSE, TRUE, 0);

	GtkWidget *questions_remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
	g_signal_connect (questions_remove_button, "clicked", G_CALLBACK (questions_remove_button_clicked), object);
	gtk_box_pack_start (GTK_BOX (questions_buttonbox), questions_remove_button, FALSE, TRUE, 0);


	GtkWidget *choices_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
	gtk_table_attach (GTK_TABLE (object), choices_hbox,
	                  0, 2, 4, 5,
	                  GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL,
	                  3, 3);

	GtkWidget *choices_tree_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (choices_tree_view_scrolled_window),
	                                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_box_pack_start (GTK_BOX (choices_hbox), choices_tree_view_scrolled_window, TRUE, TRUE, 0);

	priv->choices_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->choices_store));
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->choices_tree_view), TRUE);
	gtk_widget_set_events (priv->choices_tree_view, GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK);
	g_signal_connect (priv->choices_tree_view, "row-activated", G_CALLBACK (choices_tree_view_row_activated), object);
	gtk_container_add (GTK_CONTAINER (choices_tree_view_scrolled_window), priv->choices_tree_view);
//.........这里部分代码省略.........
开发者ID:kyoushuu,项目名称:gpinstruct,代码行数:101,代码来源:gpinstruct-lesson-test-multi-choice-editor.c

示例11: choices_tree_view_row_activated

static void
choices_tree_view_row_activated (GtkTreeView       *tree_view,
                                 GtkTreePath       *path,
                                 GtkTreeViewColumn *column,
                                 gpointer           user_data)
{
	GPInstructLessonTestMultiChoiceEditor *editor = GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_EDITOR (user_data);
	GPInstructLessonTestMultiChoiceEditorPrivate *priv = editor->priv;

	GPInstructObject *object;
	GtkTreeIter iter;
	GtkWidget *scrolled_window, *text_view;

	if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->choices_store), &iter, path))
	{
		object = questions_tree_view_get_current_data (editor);
		if (GPINSTRUCT_IS_LESSON_TEST_MULTI_CHOICE_QUESTION (object))
		{
			guint choice = gtk_tree_path_get_indices (path)[0];
			GPInstructLessonTestMultiChoiceQuestion *question = GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_QUESTION (object);

			GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Choice Properties"),
			                                                 GTK_WINDOW (priv->window),
			                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
			                                                 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
			                                                 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
			                                                 NULL);
			GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
			gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);

			scrolled_window = gtk_scrolled_window_new (NULL, NULL);
			gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
			                                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
			text_view = gtk_text_view_new ();
			gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD_CHAR);
			gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
			                          gpinstruct_lesson_test_multi_choice_question_get_choice (question, choice),
			                          -1);
			gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    gtk_label_new (_("Text:")),
			                    FALSE, TRUE, 0);
			gtk_box_pack_start (GTK_BOX (content_area),
			                    scrolled_window,
			                    TRUE, TRUE, 0);

			gtk_widget_show_all (content_area);
			if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
			{
				GtkTextIter start, end;
				gtk_text_buffer_get_bounds (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
				                            &start, &end);
				gchar *text = gtk_text_iter_get_text (&start, &end);
				gpinstruct_lesson_test_multi_choice_question_set_choice (question, choice, text);
				g_free (text);

				update_choices_tree_view (GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_EDITOR (user_data));
				gpinstruct_editor_window_set_modified (priv->window, TRUE);

				gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->choices_store),
					                           &iter, NULL, choice);
				gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
					                            &iter);
			}

			gtk_widget_destroy (dialog);
		}
	}
}
开发者ID:kyoushuu,项目名称:gpinstruct,代码行数:69,代码来源:gpinstruct-lesson-test-multi-choice-editor.c

示例12: gimp_container_popup_create_view

static void
gimp_container_popup_create_view (GimpContainerPopup *popup)
{
  GimpEditor *editor;
  GtkWidget  *button;

  popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR,
                                "view-type",         popup->view_type,
                                "container",         popup->container,
                                "context",           popup->context,
                                "view-size",         popup->view_size,
                                "view-border-width", popup->view_border_width,
                                NULL);

  gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view),
                                       FALSE);

  if (popup->view_type == GIMP_VIEW_TYPE_LIST)
    {
      GtkWidget *search_entry;

      search_entry = gtk_entry_new ();
      gtk_box_pack_end (GTK_BOX (popup->editor->view), search_entry,
                        FALSE, FALSE, 0);
      gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GIMP_CONTAINER_TREE_VIEW (GIMP_CONTAINER_VIEW (popup->editor->view))->view),
                                      GTK_ENTRY (search_entry));
      gtk_widget_show (search_entry);
    }

  gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view),
                                       6  * (popup->default_view_size +
                                             2 * popup->view_border_width),
                                       10 * (popup->default_view_size +
                                             2 * popup->view_border_width));

  if (GIMP_IS_EDITOR (popup->editor->view))
    gimp_editor_set_show_name (GIMP_EDITOR (popup->editor->view), FALSE);

  gtk_container_add (GTK_CONTAINER (popup->frame), GTK_WIDGET (popup->editor));
  gtk_widget_show (GTK_WIDGET (popup->editor));

  editor = GIMP_EDITOR (popup->editor->view);

  gimp_editor_add_button (editor, "zoom-out",
                          _("Smaller Previews"), NULL,
                          G_CALLBACK (gimp_container_popup_smaller_clicked),
                          NULL,
                          popup);
  gimp_editor_add_button (editor, "zoom-in",
                          _("Larger Previews"), NULL,
                          G_CALLBACK (gimp_container_popup_larger_clicked),
                          NULL,
                          popup);

  button = gimp_editor_add_icon_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp",
                                     G_CALLBACK (gimp_container_popup_view_type_toggled),
                                     popup);
  gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), popup->view_type);

  if (popup->dialog_factory)
    gimp_editor_add_button (editor, popup->dialog_icon_name,
                            popup->dialog_tooltip, NULL,
                            G_CALLBACK (gimp_container_popup_dialog_clicked),
                            NULL,
                            popup);

  gtk_widget_grab_focus (GTK_WIDGET (popup->editor));
}
开发者ID:Distrotech,项目名称:gimp,代码行数:68,代码来源:gimpcontainerpopup.c

示例13: MoveListCreate

extern void
MoveListCreate(hintdata * phd)
{
    static const char *aszTitleDetails[] = {
        N_("Rank"),
        N_("Type"),
        N_("Win"),
        N_("W g"),
        N_("W bg"),
        N_("Lose"),
        N_("L g"),
        N_("L bg"),
        NULL,
        N_("Diff."),
        N_("Move")
    };
    unsigned int i;
    int showWLTree = showMoveListDetail && !phd->fDetails;

    /* Create list widget */
    GtkListStore *store;
    GtkTreeIter iter;
    GtkTreeSelection *sel;
    GtkWidget *view = gtk_tree_view_new();
    int offset = (phd->fDetails) ? 0 : MIN_COLUMN_COUNT - DETAIL_COLUMN_COUNT;

    if (showWLTree) {
        GtkStyle *psDefault = gtk_widget_get_style(view);

        GtkCellRenderer *renderer = custom_cell_renderer_movelist_new();
        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_RANK], renderer,
                                                    "movelist", 0, "rank", 1, NULL);
        gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
        g_object_set(renderer, "cell-background-gdk", &psDefault->bg[GTK_STATE_NORMAL],
                     "cell-background-set", TRUE, NULL);

        g_object_set_data(G_OBJECT(view), "hintdata", phd);
    } else {
        GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
        g_object_set(renderer, "ypad", 0, NULL);

        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_RANK], renderer,
                                                    "text", ML_COL_RANK, "foreground", ML_COL_FGCOL + offset, NULL);
        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_TYPE], renderer,
                                                    "text", ML_COL_TYPE, "foreground", ML_COL_FGCOL + offset, NULL);

        if (phd->fDetails) {
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_WIN], renderer,
                                                        "text", ML_COL_WIN, "foreground", ML_COL_FGCOL + offset, NULL);
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_GWIN], renderer,
                                                        "text", ML_COL_GWIN, "foreground", ML_COL_FGCOL + offset, NULL);
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_BGWIN],
                                                        renderer, "text", ML_COL_BGWIN, "foreground",
                                                        ML_COL_FGCOL + offset, NULL);
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_LOSS], renderer,
                                                        "text", ML_COL_LOSS, "foreground", ML_COL_FGCOL + offset, NULL);
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_GLOSS],
                                                        renderer, "text", ML_COL_GLOSS, "foreground",
                                                        ML_COL_FGCOL + offset, NULL);
            gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_BGLOSS],
                                                        renderer, "text", ML_COL_BGLOSS, "foreground",
                                                        ML_COL_FGCOL + offset, NULL);
        }

        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_EQUITY], renderer,
                                                    "text", ML_COL_EQUITY + offset, "foreground", ML_COL_FGCOL + offset,
                                                    NULL);
        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_DIFF], renderer,
                                                    "text", ML_COL_DIFF + offset, "foreground", ML_COL_FGCOL + offset,
                                                    NULL);
        gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, aszTitleDetails[ML_COL_MOVE], renderer,
                                                    "text", ML_COL_MOVE + offset, "foreground", ML_COL_FGCOL + offset,
                                                    NULL);
    }

    phd->pwMoves = view;

    sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);

    g_signal_connect(view, "row-activated", G_CALLBACK(HintDoubleClick), phd);
    g_signal_connect(sel, "changed", G_CALLBACK(HintSelect), phd);


    /* Add empty rows */
    if (phd->fDetails)
        store =
            gtk_list_store_new(DETAIL_COLUMN_COUNT + 2, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
                               G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
    else {
        if (showWLTree)
            store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_INT);
        else
            store =
                gtk_list_store_new(MIN_COLUMN_COUNT + 2, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
                                   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
    }

    for (i = 0; i < phd->pml->cMoves; i++)
//.........这里部分代码省略.........
开发者ID:mormegil-cz,项目名称:gnubg,代码行数:101,代码来源:gtkmovelist.c

示例14: ip4_routes_dialog_new

GtkWidget *
ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic)
{
	GtkBuilder *builder;
	GtkWidget *dialog, *widget, *ok_button;
	GtkListStore *store;
	GtkTreeIter model_iter;
	GtkTreeSelection *selection;
	gint offset;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;
	int i;
	GSList *renderers = NULL;
	GError* error = NULL;

	/* Initialize temporary storage vars */
	g_free (last_edited);
	last_edited = NULL;
	last_path = NULL;
	g_free (last_path);
	last_column = -1;

	builder = gtk_builder_new ();

	if (!gtk_builder_add_from_file (builder, UIDIR "/ce-ip4-routes.ui", &error)) {
		g_warning ("Couldn't load builder file: %s", error->message);
		g_error_free (error);
		return NULL;
	}

	dialog = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_routes_dialog"));
	if (!dialog) {
		g_warning ("%s: Couldn't load ip4 routes dialog from .ui file.", __func__);
		g_object_unref (builder);
		return NULL;
	}

	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);

	g_object_set_data_full (G_OBJECT (dialog), "builder",
	                        builder, (GDestroyNotify) g_object_unref);

	ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "ok_button"));

	store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

	/* Add existing routes */
	for (i = 0; i < nm_setting_ip4_config_get_num_routes (s_ip4); i++) {
		NMIP4Route *route = nm_setting_ip4_config_get_route (s_ip4, i);
		struct in_addr tmp_addr;
		char ip_string[INET_ADDRSTRLEN];
		char *tmp;

		if (!route) {
			g_warning ("%s: empty IP4 route structure!", __func__);
			continue;
		}

		gtk_list_store_append (store, &model_iter);

		tmp_addr.s_addr = nm_ip4_route_get_dest (route);;
		if (inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
			gtk_list_store_set (store, &model_iter, COL_ADDRESS, ip_string, -1);

		tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip4_route_get_prefix (route));
		if (inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
			gtk_list_store_set (store, &model_iter, COL_PREFIX, ip_string, -1);

		tmp_addr.s_addr = nm_ip4_route_get_next_hop (route);
		if (tmp_addr.s_addr && inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
			gtk_list_store_set (store, &model_iter, COL_NEXT_HOP, ip_string, -1);

		if (nm_ip4_route_get_metric (route)) {
			tmp = g_strdup_printf ("%d", nm_ip4_route_get_metric (route));
			gtk_list_store_set (store, &model_iter, COL_METRIC, tmp, -1);
			g_free (tmp);
		}
	}

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_routes"));
	gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (store));
	g_object_unref (store);

	/* IP Address column */
	renderer = gtk_cell_renderer_text_new ();
	g_object_set (renderer, "editable", TRUE, NULL);
	g_signal_connect (renderer, "edited", G_CALLBACK (cell_edited), builder);
	g_object_set_data (G_OBJECT (renderer), "column", GUINT_TO_POINTER (COL_ADDRESS));
	g_signal_connect (renderer, "editing-started", G_CALLBACK (ip4_cell_editing_started), ok_button);
	g_signal_connect (renderer, "editing-canceled", G_CALLBACK (cell_editing_canceled), builder);
	renderers = g_slist_append (renderers, renderer);

	offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
	                                                      -1, _("Address"), renderer,
	                                                      "text", COL_ADDRESS,
	                                                      NULL);
	column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), offset - 1);
	gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
	gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);

//.........这里部分代码省略.........
开发者ID:domsom,项目名称:nm-applet-ds,代码行数:101,代码来源:ip4-routes-dialog.c

示例15: ft_manager_add_handler_to_list

static void
ft_manager_add_handler_to_list (EmpathyFTManager *manager,
                                EmpathyFTHandler *handler,
                                const GError *error)
{
  GtkTreeRowReference *row_ref;
  GtkTreeIter iter;
  GtkTreeSelection *selection;
  GtkTreePath *path;
  GIcon *icon;
  const char *content_type, *second_line;
  char *first_line, *message;
  EmpathyFTManagerPriv *priv = GET_PRIV (manager);

  icon = NULL;

  /* get the icon name from the mime-type of the file. */
  content_type = empathy_ft_handler_get_content_type (handler);

  if (content_type != NULL)
    icon = g_content_type_get_icon (content_type);

  /* append the handler in the store */
  gtk_list_store_insert_with_values (GTK_LIST_STORE (priv->model),
      &iter, G_MAXINT, COL_FT_OBJECT, handler,
      COL_ICON, icon, -1);

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

  /* insert the new row_ref in the hash table  */
  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->model), &iter);
  row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (priv->model), path);
  gtk_tree_path_free (path);
  g_hash_table_insert (priv->ft_handler_to_row_ref, g_object_ref (handler),
      row_ref);

  /* select the new row */
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
  gtk_tree_selection_select_iter (selection, &iter);

  if (error != NULL)
    {
      message = ft_manager_format_error_message (handler, error);
      ft_manager_update_handler_message (manager, row_ref, message);

      g_free (message);
      return;
    }

  /* update the row with the initial values.
   * the only case where we postpone this is in case we're managing
   * an outgoing+hashing transfer, as the hashing started signal will
   * take care of updating the information.
   */
  if (empathy_ft_handler_is_incoming (handler) ||
      !empathy_ft_handler_get_use_hash (handler)) {
    first_line = ft_manager_format_contact_info (handler);
    second_line = _("Waiting for the other participant's response");
    message = g_strdup_printf ("%s\n%s", first_line, second_line);

    ft_manager_update_handler_message (manager, row_ref, message);

    g_free (first_line);
    g_free (message);
  }

  /* hook up the signals and start the transfer */
  ft_manager_start_transfer (manager, handler);
}
开发者ID:blackskad,项目名称:empathy,代码行数:70,代码来源:empathy-ft-manager.c


注:本文中的GTK_TREE_VIEW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。