Ejemplo n.º 1
0
static void open_image(char* path)
{
	unsigned int width, height;
	if(bdk_window.decoder != NULL){
		bdk_window.decoder = delete_Decoder(bdk_window.decoder);
	}
	bdk_window.decoder = create_Decoder_c(path, bdk_window.error_path);

	width	= get_SIZ_Xsiz(bdk_window.decoder) - get_SIZ_XOsiz(bdk_window.decoder);
	height	= get_SIZ_Ysiz(bdk_window.decoder) - get_SIZ_YOsiz(bdk_window.decoder);
	
	bdk_window.buffer	= new unsigned char[width * height * 3];
	bdk_window.pixbuf	= gdk_pixbuf_new_from_data( bdk_window.buffer,
													GDK_COLORSPACE_RGB,
													FALSE,
													8,
													width,
													height,
													width * 3,
													NULL,
													NULL);

	fill_buffer( bdk_window.decoder, 0, 0, bdk_window.buffer, width, height);

	gtk_image_clear(GTK_IMAGE(bdk_window.image));
	gtk_image_set_from_pixbuf(GTK_IMAGE(bdk_window.image), bdk_window.pixbuf);
	//gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (bdk_window.scrolled_window), bdk_window.image);

	create_and_fill_model();

	gtk_tree_view_set_model(GTK_TREE_VIEW(bdk_window.view), bdk_window.model);
	g_object_unref(bdk_window.model);
}
Ejemplo n.º 2
0
//! pembuatan 	view 
GtkWidget *tableCreate (void){
    table = struct_new(table_);
	databaseCreate();
	GtkTreeModel        *model;
 
	table->view = gtk_tree_view_new();
	//header
	GtkTreeViewColumn   *col  =  tableCreateHeader(table->view);	
	/* connect a cell data function */
	model = create_and_fill_model("");
	gtk_tree_view_set_model(GTK_TREE_VIEW(table->view), model);
 
	g_object_unref(model); /* destroy model automatically with view */

	
	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(table->view)),GTK_SELECTION_SINGLE);
	gtk_tree_view_set_headers_clickable (table->view,TRUE);
	gtk_tree_view_set_rules_hint (table->view,TRUE);
	gtk_tree_view_set_grid_lines(table->view, GTK_TREE_VIEW_GRID_LINES_HORIZONTAL );

	g_object_set(	table->view ,"hover-selection" , TRUE,NULL);
	
	g_signal_connect(table->view, "button-press-event", (GCallback) table_onButtonPressed, NULL);

	return table->view;
}
Ejemplo n.º 3
0
static GtkWidget *
create_view_and_model (LokGameWidget * game_widget)
{
  GtkTreeViewColumn *col;
  GtkCellRenderer *renderer;
  GtkWidget *view;
  GtkTreeModel *model;
  LokBagPack *bag_pack;

  bag_pack = game_widget->game->hero->bag_pack;

  view = gtk_tree_view_new ();


  /* Column 0 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "Type");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_TYPE);

  /* Column 1 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "Name");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_NAME);

  /* Column 2 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "Points");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_POINTS);

  /* Column 3 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "Weigth");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_WEIGHT);

  model = create_and_fill_model (game_widget);
  gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);
  g_object_unref (model);
  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
      GTK_TREE_VIEW (view)), GTK_SELECTION_NONE);

  return view;
}
Ejemplo n.º 4
0
static GtkWidget *
create_view_and_model (void)
{
  GtkTreeViewColumn   *col;
  GtkCellRenderer     *renderer;
  GtkWidget           *view;
  GtkTreeModel        *model;

  view = gtk_tree_view_new();

  /* --- Column #1 --- */
  col = gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(col, "Navdata field");
  gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

  renderer = gtk_cell_renderer_text_new();
  gtk_tree_view_column_pack_start(col, renderer, TRUE);
  gtk_tree_view_column_add_attribute(col, renderer, "text", COL_FIELD);
  //g_object_set(renderer, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL);
  //g_object_set(renderer, "foreground", "Red", "foreground-set", TRUE, NULL); /* make red */

  /* --- Column #2 --- */
  col = gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(col, "Value");
  gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
  renderer = gtk_cell_renderer_text_new();
  gtk_tree_view_column_pack_start(col, renderer, TRUE);
  gtk_tree_view_column_add_attribute(col, renderer, "text", COL_VALUE);


  /* --- Column #3 --- */
  col = gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(col, "Comment");
  gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
  renderer = gtk_cell_renderer_text_new();
  gtk_tree_view_column_pack_start(col, renderer, TRUE);
  gtk_tree_view_column_add_attribute(col, renderer, "text", COL_COMMENT);

  //gtk_tree_view_column_set_cell_data_func(col, renderer, age_cell_data_func, NULL, NULL);


  model = create_and_fill_model();
  gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
  g_object_unref(model); /* destroy model automatically with view */
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), GTK_SELECTION_NONE);

  return view;
}
Ejemplo n.º 5
0
static void create_view_and_model()
{
	GtkTreeViewColumn	*col;
	GtkCellRenderer		*renderer;

	bdk_window.view = gtk_tree_view_new();
	gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(bdk_window.view), TRUE);

	col = gtk_tree_view_column_new();

	gtk_tree_view_column_set_title(col, "Variable");

	gtk_tree_view_append_column(GTK_TREE_VIEW(bdk_window.view), col);
	
	renderer = gtk_cell_renderer_text_new();

	gtk_tree_view_column_pack_start(col, renderer, TRUE);

	gtk_tree_view_column_add_attribute(col, renderer, "text", COL_VARIABLE);

	/* Columm #2 */

	col = gtk_tree_view_column_new();

	gtk_tree_view_column_set_title(col, "Value");

	gtk_tree_view_append_column(GTK_TREE_VIEW(bdk_window.view), col);

	renderer = gtk_cell_renderer_text_new();

	gtk_tree_view_column_pack_start(col, renderer, TRUE);

	gtk_tree_view_column_add_attribute(col, renderer, "text", COL_VALUE);

	gtk_tree_view_column_set_cell_data_func(col, renderer, age_cell_data_func, NULL, NULL);

	create_and_fill_model();

	gtk_tree_view_set_model(GTK_TREE_VIEW(bdk_window.view), bdk_window.model);

	g_object_unref(bdk_window.model);

	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(bdk_window.view)), GTK_SELECTION_NONE);

	g_signal_connect(bdk_window.view, "row-activated", (GCallback) view_onRowActivated, NULL);

}
Ejemplo n.º 6
0
/**
 * Sets root
 * @param root A gchar
 */
void
rs_dir_selector_set_root(RSDirSelector *selector, const gchar *root)
{
	GtkTreeModel *model;
	GtkTreeSortable *sortable;

	model = create_and_fill_model(root);

	sortable = GTK_TREE_SORTABLE(model);
	gtk_tree_sortable_set_sort_column_id(sortable,
										 COL_NAME,
										 GTK_SORT_ASCENDING);

	gtk_tree_view_set_model(GTK_TREE_VIEW(selector->view), model);
	
	g_object_unref(model); /* destroy model automatically with view */
}
Ejemplo n.º 7
0
static GtkWidget *
create_view_and_model (sqlite3_stmt* stmt)
{
  /* GtkCellRenderer     *renderer; */
  GtkTreeModel        *model;
  GtkWidget           *view;

  view = gtk_tree_view_new ();

  tree_view_insert_columns_from_stmt(view, stmt);

  /* /\* --- Column #1 --- *\/ */

  /* renderer = gtk_cell_renderer_text_new (); */
  /* gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), */
  /*                                              -1, */
  /*                                              "Name", */
  /*                                              renderer, */
  /*                                              "text", COL_NAME, */
  /*                                              NULL); */

  /* /\* --- Column #2 --- *\/ */

  /* renderer = gtk_cell_renderer_text_new (); */
  /* gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), */
  /*                                              -1, */
  /*                                              "Age", */
  /*                                              renderer, */
  /*                                              "text", COL_AGE, */
  /*                                              NULL); */

  model = create_and_fill_model (stmt);

  gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);

  /* The tree view has acquired its own reference to the
   *  model, so we can drop ours. That way the model will
   *  be freed automatically when the tree view is destroyed */

  g_object_unref (model);

  return view;
}
static GtkWidget *
create_view_and_model (LokBagPack * bag_pack)
{
  GtkTreeViewColumn *col;
  GtkCellRenderer *renderer;
  GtkWidget *view;
  GtkTreeModel *model;

  view = gtk_tree_view_new ();

  /* Column 1 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "name");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_NAME);

  /* Column 2 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "points of attack");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_ATTACK_POINTS);

  /* Column 3 */
  renderer = gtk_cell_renderer_text_new ();
  col = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (col, "weigth");
  gtk_tree_view_append_column(GTK_TREE_VIEW (view), col);
  gtk_tree_view_column_pack_start (col, renderer, TRUE);
  gtk_tree_view_column_add_attribute (col, renderer, "text", COL_WEIGHT);

  model = create_and_fill_model (bag_pack);
  gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);
  g_object_unref (model);
  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
      GTK_TREE_VIEW (view)), GTK_SELECTION_NONE);

  return view;
}
Ejemplo n.º 9
0
static GtkWidget *
create_view_and_model (void)
{
  GtkCellRenderer     *renderer;
  GtkTreeModel        *model;
  GtkWidget           *view;

  view = gtk_tree_view_new ();

  /* --- Column #1 --- */

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
                                               -1,
                                               "Name",
                                               renderer,
                                               "text", COL_NAME,
                                               NULL);

  /* --- Column #2 --- */

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
                                               -1,
                                               "Age",
                                               renderer,
                                               "text", COL_AGE,
                                               NULL);

  model = create_and_fill_model ();

  gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);

  /* The tree view has acquired its own reference to the
   *  model, so we can drop ours. That way the model will
   *  be freed automatically when the tree view is destroyed */

  g_object_unref (model);

  return view;
}
/**
 * 
 * Helper function used to create the tests, it creates a treeview and
 * a treemodel, it returns the treeview with the treemodel associated.
 * 
 */
static GtkWidget *
create_view_and_model (void)
{
  GtkTreeViewColumn   *col;
  GtkCellRenderer     *renderer;
  GtkTreeModel        *model;
  GtkWidget           *view;

  view = gtk_tree_view_new ();

  /* --- Column #1 --- */

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
                                               -1,      
                                               "Name",  
                                               renderer,
                                               "text", COL_NAME,
                                               NULL);

  /* --- Column #2 --- */

  col = gtk_tree_view_column_new();

  renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
                                               -1,      
                                               "Age",  
                                               renderer,
                                               "text", COL_AGE,
                                               NULL);

  model = create_and_fill_model ();

  gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);

  g_object_unref (model); /* destroy model automatically with view */

  return view;
}
Ejemplo n.º 11
0
ReceiverWindow::ReceiverWindow()
{
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), "Выбор адресов получателей");
	gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
	/////////////////////////////////
	box[0] = gtk_hbox_new(0,5);
	box[1] = gtk_hbox_new(0,15);
	/////////////////////////////////
	model = create_and_fill_model();
	store = GTK_WIDGET(create_and_fill_store());
	/////////////////////////////////
	addButton = new_button("Добавить",receiver_add_signal,model);
	delButton = new_button("Удалить",del_signal,store);
	/////////////////////////////////
	okButton = new_button("_Готово",receiver_ok_signal,model,1);
	cancelButton = new_button("_Отмена",receiver_cancel_signal,model,1);
	/////////////////////////////////
	GTK_WIDGET_SET_FLAGS (okButton, GTK_CAN_DEFAULT);
	gtk_widget_grab_focus(okButton);
	/////////////////////////////////
	gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(receiver_destroy_signal), NULL);
	/////////////////////////////////////
	gtk_box_pack_start(GTK_BOX(box[0]),store,1,1,5);
	gtk_box_pack_start(GTK_BOX(box[1]),okButton,1,1,5);
	gtk_box_pack_start(GTK_BOX(box[1]),addButton,1,1,5);
	gtk_box_pack_start(GTK_BOX(box[1]),delButton,1,1,5);
	gtk_box_pack_start(GTK_BOX(box[1]),cancelButton,1,1,5);
	/////////////////////////////////////
	GtkWidget *vbox = gtk_vbox_new(0,5);
	for (int i=0; i<count; i++)
	{
		gtk_box_pack_start(GTK_BOX(vbox),box[i],1,0,5);
	}
	
	gtk_container_add(GTK_CONTAINER(window), vbox);
	
	gtk_widget_show_all(window);
}
Ejemplo n.º 12
0
static GtkWidget *create_view_and_model (void)
{
	GtkTreeViewColumn *col;
	GtkCellRenderer *renderer;
	GtkWidget *view;
	GtkTreeModel *model;

	view = gtk_tree_view_new();

	col = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(col, "UML Elements");
	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	gtk_tree_view_column_add_attribute(col, renderer, "text", COLUMN);

	model = create_and_fill_model();
	gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
	g_object_unref(model);

	return view;
}
Ejemplo n.º 13
0
void show_account_datedetailed_window ()
{
    GtkBuilder *gbuilder = gtk_builder_new();

    ex_builder_load_file (gbuilder, "account_datedetailed.ui");


    gtk_builder_connect_signals (gbuilder,NULL);
    window = GTK_WIDGET(gtk_builder_get_object (gbuilder, "window"));
    treeview = GTK_TREE_VIEW(gtk_builder_get_object (gbuilder, "treeview"));
    label_date = GTK_LABEL(gtk_builder_get_object (gbuilder, "label_date"));
    label_account = GTK_LABEL(gtk_builder_get_object (gbuilder, "label_account"));
    treestore = GTK_TREE_STORE(gtk_builder_get_object (gbuilder, "treestore"));

    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gtk_builder_get_object (gbuilder, "scrolledwindow")),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    gchar text[150];
    g_sprintf(text,_("Date: %s"), g_value_get_string(ex_grid_get_selected_row_value (grid_account_full,ACF_DATE_COL)));
    gtk_label_set_text(label_date, text);

    const GValue *account = db_get_value ("SELECT name FROM account WHERE id=##id::gint",
                                          "id", ex_grid_get_selected_row_value(grid_account_full, ACF_ID_COL),
                                          NULL
                                         );

    const gchar *account_str = g_value_get_string(account);

    g_sprintf(text, _("Account: %s"), account_str);
    gtk_label_set_text(label_account, text);

    create_and_fill_model();


    gtk_widget_show(window);
}
Ejemplo n.º 14
0
/** Create QTH list widgets. */
static GtkWidget *create_qth_list()
{
    GtkTreeModel   *model;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    qthlist = gtk_tree_view_new();

    model = create_and_fill_model();
    gtk_tree_view_set_model(GTK_TREE_VIEW(qthlist), model);
    g_object_unref(model);

    /* name column */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer,
                                                      "text",
                                                      QTH_LIST_COL_NAME, NULL);
    gtk_tree_view_column_set_expand(column, TRUE);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);

    /* location column */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("Location"), renderer,
                                                      "text", QTH_LIST_COL_LOC,
                                                      NULL);
    gtk_tree_view_column_set_expand(column, TRUE);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);

    /* lat column */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("Lat"), renderer,
                                                      "text", QTH_LIST_COL_LAT,
                                                      NULL);
    gtk_tree_view_column_set_alignment(column, 0.5);
    gtk_tree_view_column_set_cell_data_func(column,
                                            renderer,
                                            float_cell_data_function,
                                            GUINT_TO_POINTER(QTH_LIST_COL_LAT),
                                            NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);

    /* lon column */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("Lon"), renderer,
                                                      "text", QTH_LIST_COL_LON,
                                                      NULL);
    gtk_tree_view_column_set_alignment(column, 0.5);
    gtk_tree_view_column_set_cell_data_func(column,
                                            renderer,
                                            float_cell_data_function,
                                            GUINT_TO_POINTER(QTH_LIST_COL_LON),
                                            NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);

    /* alt column */
    renderer = gtk_cell_renderer_text_new();
    if (sat_cfg_get_bool(SAT_CFG_BOOL_USE_IMPERIAL))
    {
        column = gtk_tree_view_column_new_with_attributes(_("Alt\n(ft)"),
                                                          renderer,
                                                          "text",
                                                          QTH_LIST_COL_ALT,
                                                          NULL);
    }
    else
    {
        column =
            gtk_tree_view_column_new_with_attributes(_("Alt\n(m)"), renderer,
                                                     "text", QTH_LIST_COL_ALT,
                                                     NULL);
    }
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);
    gtk_tree_view_column_set_alignment(column, 0.5);

    /* locator */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("QRA"), renderer,
                                                      "text", QTH_LIST_COL_QRA,
                                                      NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);
    gtk_tree_view_column_set_alignment(column, 0.5);

    /* weather station */
    /*      renderer = gtk_cell_renderer_text_new (); */
    /*      column = gtk_tree_view_column_new_with_attributes (_("WX"), renderer, */
    /*                                       "text", QTH_LIST_COL_WX, */
    /*                                       NULL); */
    /*      gtk_tree_view_insert_column (GTK_TREE_VIEW (qthlist), column, -1); */
    /*      gtk_tree_view_column_set_alignment (column, 0.5); */

    /* default */
    renderer = gtk_cell_renderer_toggle_new();
    handler_id = g_signal_connect(renderer, "toggled",
                                  G_CALLBACK(default_toggled), model);

    column = gtk_tree_view_column_new_with_attributes(_("Default"), renderer,
                                                      "active",
                                                      QTH_LIST_COL_DEF, NULL);
    gtk_tree_view_append_column(GTK_TREE_VIEW(qthlist), column);
    gtk_tree_view_column_set_alignment(column, 0.5);

    g_signal_connect(qthlist, "row-activated", G_CALLBACK(row_activated_cb),
                     NULL);

#ifdef HAS_LIBGPS
    /* GPSD enabled */
    /*server */
    renderer = gtk_cell_renderer_text_new();
    column =
        gtk_tree_view_column_new_with_attributes(_("GPSD\nServer"), renderer,
                                                 "text",
                                                 QTH_LIST_COL_GPSD_SERVER,
                                                 NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);
    gtk_tree_view_column_set_alignment(column, 0.5);
    /*port */
    renderer = gtk_cell_renderer_text_new();
    column =
        gtk_tree_view_column_new_with_attributes(_("GPSD\nPort"), renderer,
                                                 "text",
                                                 QTH_LIST_COL_GPSD_PORT, NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);
    gtk_tree_view_column_set_alignment(column, 0.5);

    /*type */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(_("QTH\nType"), renderer,
                                                      "text",
                                                      QTH_LIST_COL_TYPE, NULL);
    gtk_tree_view_insert_column(GTK_TREE_VIEW(qthlist), column, -1);
    gtk_tree_view_column_set_alignment(column, 0.5);
#endif

    return qthlist;
}
Ejemplo n.º 15
0
static void tableRefresh(const gchar *addCommand){
	GtkTreeModel        *model = tableRemoveAll(NULL,NULL);		
	model = create_and_fill_model(addCommand);
	gtk_tree_view_set_model(GTK_TREE_VIEW(table->view), model);
	g_object_unref(model); // destroy model automatically with view 
}
Ejemplo n.º 16
0
/** \brief Create Radio configuration list widget.
 *
 */
static void create_rot_list ()
{
    GtkTreeModel      *model;
    GtkCellRenderer   *renderer;
    GtkTreeViewColumn *column;


    rotlist = gtk_tree_view_new ();
    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (rotlist), TRUE);

    model = create_and_fill_model ();
    gtk_tree_view_set_model (GTK_TREE_VIEW (rotlist), model);
    g_object_unref (model);

    /* Conf name */
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Config Name"), renderer,
                                                        "text", ROT_LIST_COL_NAME,
                                                        NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);

    /* Host */
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Host"), renderer,
                                                       "text", ROT_LIST_COL_HOST,
                                                        NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);
    
    /* port */
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Port"), renderer,
                                                       "text", ROT_LIST_COL_PORT,
                                                        NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);

    /* Az and el limits */
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Min Az"), renderer,
                                                       "text", ROT_LIST_COL_MINAZ,
                                                       NULL);
    gtk_tree_view_column_set_cell_data_func (column, renderer,
                                             render_angle,
                                             GUINT_TO_POINTER(ROT_LIST_COL_MINAZ),
                                             NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);

    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Max Az"), renderer,
                                                        "text", ROT_LIST_COL_MAXAZ,
                                                        NULL);
    gtk_tree_view_column_set_cell_data_func (column, renderer,
                                             render_angle,
                                             GUINT_TO_POINTER(ROT_LIST_COL_MAXAZ),
                                             NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);
    
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Min El"), renderer,
                                                        "text", ROT_LIST_COL_MINEL,
                                                        NULL);
    gtk_tree_view_column_set_cell_data_func (column, renderer,
                                             render_angle,
                                             GUINT_TO_POINTER(ROT_LIST_COL_MINEL),
                                             NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);

    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Max El"), renderer,
                                                    "text", ROT_LIST_COL_MAXEL,
                                                    NULL);
    gtk_tree_view_column_set_cell_data_func (column, renderer,
                                             render_angle,
                                             GUINT_TO_POINTER(ROT_LIST_COL_MAXEL),
                                             NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);
    
    /* Az type */
    renderer = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new_with_attributes (_("Azimuth Type"), renderer,
                                                      "text", ROT_LIST_COL_AZTYPE,
                                                       NULL);
    gtk_tree_view_column_set_cell_data_func (column, renderer,
                                             render_aztype,
                                             GUINT_TO_POINTER(ROT_LIST_COL_AZTYPE),
                                             NULL);
    gtk_tree_view_insert_column (GTK_TREE_VIEW (rotlist), column, -1);

    g_signal_connect (rotlist, "row-activated", G_CALLBACK (row_activated_cb), NULL);
}
Ejemplo n.º 17
0
static GtkWidget *create_view_and_model(struct ps *ps)
{
	GtkTreeViewColumn *col;
	GtkCellRenderer *renderer;
	GtkWidget *view;
	GtkTreeModel *model;

	view = gtk_tree_view_new();

	/* column one */
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(col, " Analysis ");

	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	gtk_tree_view_column_add_attribute(col, renderer, "text", NAME);


	/* column two */
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(col, " Active ");

	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	gtk_tree_view_column_add_attribute(col, renderer, "text", ACTIVE);


	/* column three */
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(col, " UpToDate ");

	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	gtk_tree_view_column_add_attribute(col, renderer, "text", UPTODATE);


	/* column four */
	col = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title(col, " Suggested ");

	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	renderer = gtk_cell_renderer_text_new();
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	gtk_tree_view_column_add_attribute(col, renderer, "text", SUGGESTED);


	model = create_and_fill_model(ps);
	gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
	g_object_unref(model);

	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), GTK_SELECTION_NONE);

	return view;
}