Ejemplo n.º 1
0
static GtkWidget *
get_contacts_widget (NstPlugin *plugin)
{
	GtkWidget *cb;
	GtkCellRenderer *renderer;
	GtkTreeStore *store;
	GtkTreeModel *model;
	GtkTreeIter *iter, *iter2;

	iter = g_malloc (sizeof(GtkTreeIter));
	iter2 = g_malloc (sizeof(GtkTreeIter));
	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
	add_pidgin_contacts_to_model (store, iter, iter2);
	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
					      GTK_SORT_ASCENDING);
	cb = gtk_combo_box_new_with_model (model);

	renderer = gtk_cell_renderer_pixbuf_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
				    renderer,
				    FALSE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
					renderer,
					"pixbuf", COL_ICON,
					NULL);
	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
					    customize,
					    (gboolean *)FALSE, NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
				    renderer,
				    TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
					renderer,
					"text", COL_ALIAS,
					NULL);
	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
					    customize,
					    (gboolean *)TRUE, NULL);

	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
	if (gtk_tree_model_iter_has_child (model, iter)) {
		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
		gtk_tree_model_get_iter (model, iter2, path);
		gtk_tree_path_free (path);
		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
	}

	g_free (iter);
	g_free (iter2);
	return cb;
}
Ejemplo n.º 2
0
static void
oauth_account_chooser_dialog_init (OAuthAccountChooserDialog *self)
{
	GtkWidget *content;

	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, OAUTH_TYPE_ACCOUNT_CHOOSER_DIALOG, OAuthAccountChooserDialogPrivate);
	self->priv->builder = _gtk_builder_new_from_file ("oauth-account-chooser.ui", "oauth");

	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
	gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
	gtk_container_set_border_width (GTK_CONTAINER (self), 5);

	content = _gtk_builder_get_widget (self->priv->builder, "account_chooser");
	gtk_container_set_border_width (GTK_CONTAINER (content), 5);
	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), content, TRUE, TRUE, 0);

	{
		GtkCellLayout   *cell_layout;
		GtkCellRenderer *renderer;

		cell_layout = GTK_CELL_LAYOUT (GET_WIDGET ("account_combobox"));

		renderer = gtk_cell_renderer_pixbuf_new ();
		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
		gtk_cell_layout_set_attributes (cell_layout, renderer,
						"icon-name", ACCOUNT_ICON_COLUMN,
						NULL);

		renderer = gtk_cell_renderer_text_new ();
		gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
		gtk_cell_layout_set_attributes (cell_layout, renderer,
						"text", ACCOUNT_NAME_COLUMN,
						NULL);
	}
	gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")),
					      row_separator_func,
					      self,
					      NULL);
	g_signal_connect (GET_WIDGET ("account_combobox"),
			  "changed",
			  G_CALLBACK (account_combobox_changed_cb),
			  self);

	gtk_dialog_add_button (GTK_DIALOG (self),
			       GTK_STOCK_NEW,
			       OAUTH_ACCOUNT_CHOOSER_RESPONSE_NEW);
	gtk_dialog_add_button (GTK_DIALOG (self),
			       GTK_STOCK_CANCEL,
			       GTK_RESPONSE_CANCEL);
	gtk_dialog_add_button (GTK_DIALOG (self),
			       GTK_STOCK_OK,
			       GTK_RESPONSE_OK);
	gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
}
static void
xkb_layout_chooser_available_layouts_fill (GtkBuilder *
					   chooser_dialog,
					   const gchar cblid[],
					   const gchar cbvid[],
					   LayoutIterFunc layout_iterator,
					   ConfigItemProcessFunc
					   layout_handler,
					   GCallback combo_changed_notify)
{
	GtkWidget *cbl = CWID (cblid);
	GtkWidget *cbev = CWID (cbvid);
	GtkCellRenderer *renderer;
	GtkListStore *list_store;

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

	gtk_combo_box_set_model (GTK_COMBO_BOX (cbl),
				 GTK_TREE_MODEL (list_store));

	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbl), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbl),
					renderer, "markup",
					COMBO_BOX_MODEL_COL_VISIBLE, NULL);

	layout_iterator (config_registry, layout_handler, list_store);

	/* Turn on sorting after filling the model since that's faster */
	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE
					      (list_store),
					      COMBO_BOX_MODEL_COL_SORT,
					      GTK_SORT_ASCENDING);

	g_signal_connect_swapped (G_OBJECT (cbl), "changed",
				  combo_changed_notify, chooser_dialog);

	/* Setup the variants combo */
	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbev),
				    renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbev),
					renderer, "markup",
					COMBO_BOX_MODEL_COL_VISIBLE, NULL);

	g_signal_connect_swapped (G_OBJECT (cbev), "changed",
				  G_CALLBACK
				  (xkb_layout_chooser_available_variant_changed),
				  chooser_dialog);
}
Ejemplo n.º 4
0
GtkWidget *getMouseCombo()
{
	GtkWidget *combo;
	GtkTreeIter iter;
	GtkListStore *store;
	gint i;

	char *modes[] = 
	{
		"ps2", _("PS/2 port mouse (most desktops and laptops)"),
		"imps2", _("Microsoft PS/2 Intellimouse"),
		"bare", _("2 button Microsoft compatible serial mouse"),
		"ms", _("3 button Microsoft compatible serial mouse"),
		"mman", _("Logitech serial MouseMan and similar devices"),
		"msc", _("MouseSystems serial (most 3 button serial mice)"),
		"pnp", _("Plug and Play (serial mice that do not work with ms)"),
		"usb", _("USB connected mouse"),
		"ms3", _("Microsoft serial Intellimouse"),
		"netmouse", _("Genius Netmouse on PS/2 port"),
		"logi", _("Some serial Logitech devices"),
		"logim", _("Make serial Logitech behave like msc"),
		"atibm", _("ATI XL busmouse (mouse card)"),
		"inportbm", _("Microsoft busmouse (mouse card)"),
		"logibm", _("Logitech busmouse (mouse card)"),
		"ncr", _("A pointing pen (NCR3125) on some laptops"),
		"twid", _("Twiddler keyboard, by HandyKey Corp"),
		"genitizer", _("Genitizer tablet (relative mode)"),
		"js", _("Use a joystick as a mouse"),
		"wacom", _("Wacom serial graphics tablet")
	};
	store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
	combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
	g_object_unref (GTK_TREE_MODEL (store));
	gtk_widget_set_size_request(combo, 350, 40);
	    
	GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,"text", 0, NULL);
    
	renderer = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,"text", 1, NULL);
	

	for (i = 0; i < 40; i+=2)
	{
		gtk_list_store_append (store, &iter);
		gtk_list_store_set (store, &iter, 0, modes[i], 1, modes[i+1], -1);
	}
	
	return combo;
}
Ejemplo n.º 5
0
static void
account_chooser_constructed (GObject *object)
{
  EmpathyAccountChooser *self = (EmpathyAccountChooser *) object;
  GtkListStore *store;
  GtkCellRenderer *renderer;
  GtkComboBox *combobox;

  if (G_OBJECT_CLASS (empathy_account_chooser_parent_class)->constructed)
    G_OBJECT_CLASS
      (empathy_account_chooser_parent_class)->constructed (object);

  /* Set up combo box with new store */
  combobox = GTK_COMBO_BOX (self);

  gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox));

  store = gtk_list_store_new (COL_ACCOUNT_COUNT,
      GDK_TYPE_PIXBUF,  /* Image */
      G_TYPE_STRING,    /* Name */
      G_TYPE_BOOLEAN,   /* Enabled */
      G_TYPE_UINT,      /* Row type */
      TP_TYPE_ACCOUNT);

  gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
    account_cmp, self, NULL);
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
    GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);

  gtk_combo_box_set_model (combobox, GTK_TREE_MODEL (store));

  renderer = gtk_cell_renderer_pixbuf_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
      "pixbuf", COL_ACCOUNT_IMAGE,
      "sensitive", COL_ACCOUNT_ENABLED,
      NULL);

  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
      "text", COL_ACCOUNT_TEXT,
      "sensitive", COL_ACCOUNT_ENABLED,
      NULL);

  /* Populate accounts */
  tp_proxy_prepare_async (self->priv->manager, NULL,
      account_manager_prepared_cb, self);

  g_object_unref (store);

}
Ejemplo n.º 6
0
/*! \brief Put the icons and the text into the sortorder combobox
 *  \par Function Description
 *  Load all bitmaps for the combobox and store them together with the label
 *  in a GtkListStore.
 */
void autonumber_sortorder_create(GschemToplevel *w_current, GtkWidget *sort_order)
{
  GtkListStore *store;
  GtkTreeIter iter;
  GtkCellRenderer *renderer;
  GdkPixbuf *pixbuf;
  gchar *path;
  GError *error=NULL;

  gchar *filenames[] = {"gschem-diagonal.png", 
			"gschem-top2bottom.png", "gschem-bottom2top.png",
			"gschem-left2right.png", "gschem-right2left.png",
			"gschem-fileorder.png",
			NULL};
  gchar *names[] = {N_("Diagonal"),
		    N_("Top to bottom"), N_("Bottom to top"),
		    N_("Left to right"), N_("Right to left"),
		    N_("File order"),
		    NULL};
  gint i;

  store = gtk_list_store_new(2, G_TYPE_STRING, GDK_TYPE_PIXBUF); 

  for (i=0; filenames[i] != NULL; i++) {
    path=g_build_filename(w_current->toplevel->bitmap_directory,
		     filenames[i], NULL);
    pixbuf = gdk_pixbuf_new_from_file(path, &error);
    g_free(path);
    gtk_list_store_append(store, &iter);
    gtk_list_store_set(store, &iter, 
		       0, _(names[i]),
		       1, pixbuf,
		       -1);
  }

  gtk_combo_box_set_model(GTK_COMBO_BOX(sort_order), GTK_TREE_MODEL(store));
  renderer = gtk_cell_renderer_text_new ();

  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (sort_order),
			      renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (sort_order),
				  renderer, "text", 0, NULL);
  renderer = gtk_cell_renderer_pixbuf_new();
  g_object_set(G_OBJECT(renderer), "xpad", 5, "ypad", 5, NULL);

  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (sort_order),
			      renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (sort_order),
				  renderer, "pixbuf", 1, NULL);
}
static void
protocol_chooser_constructed (GObject *object)
{
  EmpathyProtocolChooser *protocol_chooser;
  EmpathyProtocolChooserPriv *priv;
  GtkCellRenderer *renderer;

  priv = GET_PRIV (object);
  protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object);

  /* set up combo box with new store */
  priv->store = gtk_list_store_new (COL_COUNT,
          G_TYPE_STRING,    /* Icon name */
          G_TYPE_STRING,    /* Label     */
          G_TYPE_OBJECT,    /* CM */
          G_TYPE_STRING,    /* protocol name  */
          G_TYPE_STRING);   /* service */

  /* Set the protocol sort function */
  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
      COL_PROTOCOL_NAME,
      protocol_chooser_sort_func,
      NULL, NULL);
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
      COL_PROTOCOL_NAME,
      GTK_SORT_ASCENDING);

  gtk_combo_box_set_model (GTK_COMBO_BOX (object),
      GTK_TREE_MODEL (priv->store));

  renderer = gtk_cell_renderer_pixbuf_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
      "icon-name", COL_ICON,
      NULL);
  g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);

  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
      "text", COL_LABEL,
      NULL);

  empathy_connection_managers_prepare_async (priv->cms,
      protocol_chooser_cms_prepare_cb, protocol_chooser);

  if (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed)
    G_OBJECT_CLASS
      (empathy_protocol_chooser_parent_class)->constructed (object);
}
Ejemplo n.º 8
0
static void
account_chooser_setup (EmpathyAccountChooser *chooser)
{
	EmpathyAccountChooserPriv *priv;
	GList                    *accounts;
	GtkListStore             *store;
	GtkCellRenderer          *renderer;
	GtkComboBox              *combobox;

	priv = GET_PRIV (chooser);

	/* Set up combo box with new store */
	combobox = GTK_COMBO_BOX (chooser);

	gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox));

	store = gtk_list_store_new (COL_ACCOUNT_COUNT,
				    G_TYPE_STRING,    /* Image */
				    G_TYPE_STRING,    /* Name */
				    G_TYPE_BOOLEAN,   /* Enabled */
				    EMPATHY_TYPE_ACCOUNT);

	gtk_combo_box_set_model (combobox, GTK_TREE_MODEL (store));

	renderer = gtk_cell_renderer_pixbuf_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, FALSE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
					"icon-name", COL_ACCOUNT_IMAGE,
					"sensitive", COL_ACCOUNT_ENABLED,
					NULL);
	g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);

	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
					"text", COL_ACCOUNT_TEXT,
					"sensitive", COL_ACCOUNT_ENABLED,
					NULL);

	/* Populate accounts */
	accounts = empathy_account_manager_dup_accounts (priv->manager);
	g_list_foreach (accounts,
			(GFunc) account_chooser_account_add_foreach,
			chooser);

	g_list_free (accounts);
	g_object_unref (store);
}
static void
photobucket_album_properties_dialog_init (PhotobucketAlbumPropertiesDialog *self)
{
	GtkWidget *content;

	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOBUCKET_TYPE_ALBUM_PROPERTIES_DIALOG, PhotobucketAlbumPropertiesDialogPrivate);
	self->priv->builder = _gtk_builder_new_from_file ("photobucket-album-properties.ui", "photobucket");

	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
	gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
	gtk_container_set_border_width (GTK_CONTAINER (self), 5);

	content = _gtk_builder_get_widget (self->priv->builder, "album_properties");
	gtk_container_set_border_width (GTK_CONTAINER (content), 5);
  	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), content, TRUE, TRUE, 0);

	gtk_dialog_add_buttons (GTK_DIALOG (self),
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				GTK_STOCK_OK, GTK_RESPONSE_OK,
				NULL);
	gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);


	{
		GtkCellLayout   *cell_layout;
		GtkCellRenderer *renderer;

		cell_layout = GTK_CELL_LAYOUT (GET_WIDGET ("album_combobox"));

		renderer = gtk_cell_renderer_pixbuf_new ();
		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
		gtk_cell_layout_set_attributes (cell_layout, renderer,
						"icon-name", ALBUM_ICON_COLUMN,
						NULL);

		renderer = gtk_cell_renderer_text_new ();
		gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
		gtk_cell_layout_set_attributes (cell_layout, renderer,
						"text", ALBUM_TITLE_COLUMN,
						NULL);

		renderer = gtk_cell_renderer_text_new ();
		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
		gtk_cell_layout_set_attributes (cell_layout, renderer,
						"text", ALBUM_N_PHOTOS_COLUMN,
						NULL);
	}
}
static void
pluma_encodings_combo_box_init (PlumaEncodingsComboBox *menu)
{
	GtkCellRenderer *text_renderer;

	menu->priv = PLUMA_ENCODINGS_COMBO_BOX_GET_PRIVATE (menu);

	menu->priv->store = gtk_list_store_new (N_COLUMNS,
						G_TYPE_STRING,
						G_TYPE_POINTER,
						G_TYPE_BOOLEAN);

	/* Setup up the cells */
	text_renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (menu),
				  text_renderer, TRUE);

	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (menu),
					text_renderer,
					"text",
					NAME_COLUMN,
					NULL);

	gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (menu),
					      separator_func, NULL,
					      NULL);

	menu->priv->changed_id = g_signal_connect (menu, "changed",
						   G_CALLBACK (add_or_remove),
						   menu->priv->store);

	update_menu (menu);
}
Ejemplo n.º 11
0
static GtkWidget* create_type_list(void){
	GtkListStore *store;
	GtkCellRenderer *renderer;
	GtkWidget *widget;
	store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
	widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
	gtk_combo_box_set_add_tearoffs(GTK_COMBO_BOX(widget), 0);
	renderer = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, 0);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget), renderer, "text", 0, nullptr);
	g_object_unref(GTK_TREE_MODEL(store));
	GtkTreeIter iter1;

	struct {
		const char *name;
		int type;
	} types[] = {
		{_("Protanomaly"), ColorVisionDeficiency::PROTANOMALY},
		{_("Deuteranomaly"), ColorVisionDeficiency::DEUTERANOMALY},
		{_("Tritanomaly"), ColorVisionDeficiency::TRITANOMALY},
		{_("Protanopia"), ColorVisionDeficiency::PROTANOPIA},
		{_("Deuteranopia"), ColorVisionDeficiency::DEUTERANOPIA},
		{_("Tritanopia"), ColorVisionDeficiency::TRITANOPIA},
	};

	for (int i = 0; i < ColorVisionDeficiency::DEFICIENCY_TYPE_COUNT; ++i){
		gtk_list_store_append(store, &iter1);
		gtk_list_store_set(store, &iter1,
			0, types[i].name,
			1, types[i].type,
		-1);
	}

	return widget;
}
Ejemplo n.º 12
0
void
init_object_combo_box(GtkWidget *cbox)
{
  GtkCellRenderer *rend;
  GtkTreeViewRowSeparatorFunc func;

  func = gtk_combo_box_get_row_separator_func(GTK_COMBO_BOX(cbox));
  if (func == NULL) {
    gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(cbox), combo_box_separator_func, NULL, NULL);
  }

  gtk_cell_layout_clear(GTK_CELL_LAYOUT(cbox));

  rend = gtk_cell_renderer_toggle_new();
  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE);
  gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cbox), rend,
				 "active", OBJECT_COLUMN_TYPE_TOGGLE,
				 "visible", OBJECT_COLUMN_TYPE_TOGGLE_VISIBLE,
				 "radio", OBJECT_COLUMN_TYPE_TOGGLE_IS_RADIO,
				 NULL);

  rend = gtk_cell_renderer_text_new();
  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE);
  gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(cbox), rend, "text", OBJECT_COLUMN_TYPE_STRING);

  rend = gtk_cell_renderer_pixbuf_new();
  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cbox), rend, FALSE);
  gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(cbox), rend, "pixbuf", OBJECT_COLUMN_TYPE_PIXBUF);
}
Ejemplo n.º 13
0
GtkWidget* basic_combo_id_name_create(const id_name const* idnames)
{
    int i;
    GtkTreeIter iter;
    GtkListStore* list;
    GtkWidget* combo;
    GtkCellRenderer* cell;

    list = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);

    for (i = 0; idnames[i].name != 0; ++i)
    {
        gtk_list_store_append(list, &iter);

        gtk_list_store_set( list,           &iter,
                            COLUMN_STRING,  idnames[i].name,
                            COLUMN_INT,     idnames[i].id,
                            -1);
    }

    combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
    gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);

    cell = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
    gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT(combo),
                                    cell, "text", 0, NULL );
    return combo;
}
Ejemplo n.º 14
0
static GtkWidget *create_lineend_menu(FileInfo *selected_fi)
{
	GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
	GtkTreeIter iter;
	GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
	GtkWidget *option_menu = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
	gint i;

	for (i = 0; i <= 2; i++) {
		gtk_list_store_append (store, &iter);
		gtk_list_store_set (store, &iter, 0, lineend_str[i], -1);
	}
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_menu), renderer, FALSE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (option_menu), renderer, "text", 0, NULL);

	g_signal_connect(G_OBJECT(option_menu), "changed",
		G_CALLBACK(cb_select_lineend), selected_fi);

	i = 0;
	switch (selected_fi->lineend) {
	case CR+LF:
		i = 1;
		break;
	case CR:
		i = 2;
	}
	gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), i);

	return option_menu;
}
Ejemplo n.º 15
0
void fill_cmbo(GtkWidget *cmbo)
{
    FILE *f;
    int i = 0;
    PangoFontDescription *pfd;
    GtkWidget *entry1;
    char buffer[1024]={0};
    char buffer1[1024]={0};
    char buffer2[1024]={0};
    GtkCellRenderer *renderer = NULL;
    renderer = gtk_cell_renderer_text_new();//gtk_cell_renderer_combo_new();
    g_object_set (G_OBJECT(renderer), "font", "Simsun 16","foreground", "RED",NULL );
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 0,NULL);
    
    f=fopen("res/data.txt","rb");
    if(f)
    {
        strncpy(g_context[g_context_item].id,"0000000000000000",17);
        strncpy(g_context[g_context_item].name,"全部",60);
        gtk_combo_box_text_append_text((GtkComboBoxText *)combo,g_context[g_context_item++].name);
        while(fgets(buffer,1024,f))
        {
            if(strlen(buffer) > 0 && (buffer[strlen(buffer) - 1] == '\n' || buffer[strlen(buffer) - 1] == '\r'))
            {
                buffer[strlen(buffer) - 1] = 0;
            }
            if(strlen(buffer) > 0 && (buffer[strlen(buffer) - 1] == '\n' || buffer[strlen(buffer) - 1] == '\r'))
            {
                buffer[strlen(buffer) - 1] = 0;
            }
            i = sscanf(buffer,"%s %s",buffer1,buffer2);
            if(i==2)
            {
                if(strlen(buffer1)==16)
                {
                    strncpy(g_context[g_context_item].id,buffer1,16);
                    g_print("====>>[%s]\n",g_context[g_context_item].id);
                    strncpy(g_context[g_context_item].name,buffer2,60);
                    gtk_combo_box_text_append_text((GtkComboBoxText *)combo,
                    g_convert(g_context[g_context_item].name,-1,"UTF-8", "GBK", NULL, NULL, NULL));
                    g_context_item++;
                    if(g_context_item >= 30)
                    {
                        break;
                    }
                }
            }
        }
        fclose(f);
    }
    entry1 = gtk_bin_get_child((GtkBin *)combo);
    gtk_editable_set_editable((GtkEditable *)entry1,FALSE);
    gtk_entry_set_text((GtkEntry *)entry1,g_convert(g_context[0].name,-1,"UTF-8", "GBK", NULL, NULL, NULL));

    pfd = pango_font_description_from_string("Simsun");
    pango_font_description_set_size (pfd, 20 * PANGO_SCALE);
    gtk_widget_modify_font(GTK_WIDGET(entry1),pfd);
    pango_font_description_free(pfd);
}
Ejemplo n.º 16
0
//分辨率窗口初始化
void create_gtkdemo_resolution (GtkWidget *window,int hCamera,tSdkCameraCapbility * pCameraInfo)
{
    GtkWidget               *combobox = NULL;
    GtkListStore            *store = NULL;
    GtkTreeIter             iter;
    GtkCellRenderer         *renderer = NULL;
    int                     i=0;
    tSdkImageResolution     *pImageSizeDesc=pCameraInfo->pImageSizeDesc;// 预设分辨率选择
    int                     iImageSizeDesc=pCameraInfo->iImageSizeDesc; // 预设分辨率的个数,即pImageSizeDesc数组的大小

    combobox = GTK_WIDGET(gtk_builder_get_object(Demo_builder, "res_combobox"));


    GLADE_HOOKUP_OBJECT (window, combobox, "res_combobox");

    store = gtk_list_store_new(1, G_TYPE_STRING);

//与SDK相关到操作需要获取参数
    for(i=0;i<iImageSizeDesc;i++){
        gtk_list_store_append((GtkListStore *)store, &iter);
        gtk_list_store_set((GtkListStore *)store, &iter, 0, pImageSizeDesc[i].acDescription, -1);
    }

    // 设置GtkTreeModel中的每一项数据如何在列表框中显示
    gtk_combo_box_set_model((GtkComboBox *)combobox,(GtkTreeModel *)store );

    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, TRUE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), renderer, "text", 0, NULL);
    gtk_signal_connect(GTK_OBJECT(combobox), "changed",G_CALLBACK (on_res_combobox_changed), NULL);


    return ;
}
Ejemplo n.º 17
0
static GtkWidget *
create_combo (const char *name,
	      gboolean is_list)
{
  GtkCellRenderer *cell_renderer;
  GtkWidget *combo;
  char *rc_string;
  
  rc_string = g_strdup_printf ("style \"%s-style\" {\n"
			       "  GtkComboBox::appears-as-list = %d\n"
			       "}\n"
			       "\n"
			       "widget \"*.%s\" style \"%s-style\"",
			       name, is_list, name, name);
  gtk_rc_parse_string (rc_string);
  g_free (rc_string);

  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
  cell_renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
				  "text", 0, NULL);

  gtk_widget_set_name (combo, name);
  
  return combo;
}
Ejemplo n.º 18
0
GtkWidget *
gtr_combo_box_new_enum (const char * text_1, ...)
{
  GtkWidget * w;
  GtkCellRenderer * r;
  GtkListStore * store;
  va_list vl;
  const char * text;
  va_start (vl, text_1);

  store = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);

  text = text_1;
  if (text != NULL) do
    {
      const int val = va_arg (vl, int);
      gtk_list_store_insert_with_values (store, NULL, INT_MAX, 0, val, 1, text, -1);
      text = va_arg (vl, const char *);
    }
  while (text != NULL);

  w = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
  r = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), r, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), r, "text", 1, NULL);

  /* cleanup */
  g_object_unref (store);
  return w;
}
static GtkWidget *
create_actions_combo (GsdWacomTabletButtonType type)
{
  GtkListStore    *model;
  GtkTreeIter      iter;
  GtkWidget       *combo;
  GtkCellRenderer *renderer;
  gint             i;

  model = gtk_list_store_new (ACTION_N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);

  for (i = 0; i < G_N_ELEMENTS (action_table); i++)
    {
      if ((type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
           type == WACOM_TABLET_BUTTON_TYPE_RING) &&
          action_table[i].action_type != GSD_WACOM_ACTION_TYPE_NONE &&
          action_table[i].action_type != GSD_WACOM_ACTION_TYPE_CUSTOM)
        continue;

      gtk_list_store_append (model, &iter);
      gtk_list_store_set (model, &iter,
                          ACTION_NAME_COLUMN, WACOM_C(action_table[i].action_name),
                          ACTION_TYPE_COLUMN, action_table[i].action_type, -1);
    }

  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));

  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
                                  "text", ACTION_NAME_COLUMN, NULL);


  return combo;
}
Ejemplo n.º 20
0
static GtkWidget*
get_provider_combo (TTXWindow *self)
{
	GtkWidget *combo;
	GtkListStore *model;
	GtkCellRenderer *render;

	model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);

	ttx_provider_mgr_foreach (self->priv->prov_mgr,
				  (TTXProviderForeachFunc)each_prov,
				  model);

	combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL(model));
	g_object_unref (model);

	gtk_combo_box_set_id_column (GTK_COMBO_BOX(combo), COL_PROVIDER_ID);
	render = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), render, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), render,
				       "text", COL_PROVIDER_NAME, NULL );

	g_signal_connect (G_OBJECT(combo), "changed", G_CALLBACK(on_combo_changed),
			  self);
	return combo;
}
Ejemplo n.º 21
0
static void
setup_combo (GtkWidget  *combo_box,
	     ComboItem  *items,
	     const char *context,
	     int         nb_items)
{
	GtkListStore          *model;
	GtkTreeIter            iter;
	GtkCellRenderer       *renderer;
	int                    i;

	model = gtk_list_store_new (NUMBER_COLUMNS,
				    G_TYPE_STRING,
				    G_TYPE_INT);

	gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box),
				 GTK_TREE_MODEL (model));


	for (i = 0; i < nb_items; i++) {
		gtk_list_store_append (model, &iter);
		gtk_list_store_set (model, &iter,
				    COLUMN_TEXT, g_dpgettext2 (NULL, context, items [i].name),
				    COLUMN_ITEM, items [i].value,
				    -1);
	}

	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box),
				    renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box),
					renderer, "text", COLUMN_TEXT, NULL);

	gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
}
Ejemplo n.º 22
0
/**
 * go_gtk_builder_combo_box_init_text:
 * @gui: the #GtkBuilder
 * @widget_name: the name of the combo box in the ui file.
 *
 * searches the #GtkComboBox in @gui and ensures it has a model and a
 * renderer appropriate for using with #gtk_combo_box_append_text and friends.
 *
 * Returns: (transfer none): the #GtkComboBox or NULL
 **/
GtkComboBox *
go_gtk_builder_combo_box_init_text (GtkBuilder *gui, char const *widget_name)
{
	GtkComboBox *box;
	GList *cells;
	g_return_val_if_fail (gui != NULL, NULL);
	box = GTK_COMBO_BOX (gtk_builder_get_object (gui, widget_name));
	/* search for the model and create one if none exists */
	g_return_val_if_fail (box != NULL, NULL);
	if (gtk_combo_box_get_model (box) == NULL) {
		GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
		gtk_combo_box_set_model (box, GTK_TREE_MODEL (store));
		g_object_unref (store);
	}
	cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (box));
	if (g_list_length (cells) == 0) {
		/* populate the cell layout */
		GtkCellRenderer *cell = gtk_cell_renderer_text_new ();
		gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (box), cell, TRUE);
		gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (box), cell,
						"text", 0, NULL);
	}
	g_list_free (cells);
	return box;
}
Ejemplo n.º 23
0
static void
set_up_combo_box (app_t *app, const char *box_name,
                  int n_entries, const named_int_t table[])
{
    GtkWidget *widget = get_widget (app, box_name);
    GtkListStore *model;
    GtkCellRenderer *cell;
    int i;

    model = gtk_list_store_new (1, G_TYPE_STRING);
    
    cell = gtk_cell_renderer_text_new ();
    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), cell, TRUE);
    gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), cell,
				    "text", 0,
				    NULL);

    gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (model));
    
    for (i = 0; i < n_entries; ++i)
    {
	const named_int_t *info = &(table[i]);
	GtkTreeIter iter;

	gtk_list_store_append (model, &iter);
	gtk_list_store_set (model, &iter, 0, info->name, -1);
    }

    gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);

    g_signal_connect (widget, "changed", G_CALLBACK (rescale), app);
}
Ejemplo n.º 24
0
static GtkWidget *create_position_combo(void)
{
  GtkWidget *combo;
  GtkListStore *list_store;
  GtkCellRenderer *cell;
  GtkTreeIter iter;

  list_store = gtk_list_store_new(1, G_TYPE_STRING);

  gtk_list_store_append(list_store, &iter);
  gtk_list_store_set (list_store, &iter, 0, "Top Left", -1);
  gtk_list_store_append(list_store, &iter);
  gtk_list_store_set (list_store, &iter, 0, "Bottom Left", -1);
  gtk_list_store_append(list_store, &iter);
  gtk_list_store_set (list_store, &iter, 0, "Top Right", -1);
  gtk_list_store_append(list_store, &iter);
  gtk_list_store_set (list_store, &iter, 0, "Bottom Right", -1);

  combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list_store));

#ifdef DRMR_UI_ZERO_SAMP
  gtk_combo_box_set_active(GTK_COMBO_BOX(combo),DRMR_UI_ZERO_SAMP);
#else
  gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
#endif


  g_object_unref(list_store);

  cell = gtk_cell_renderer_text_new();
  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
  gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "text", 0, NULL);

  return combo;
}
Ejemplo n.º 25
0
static GtkWidget *create_list_guessmethods()
{
        GtkTreeIter iter;
        GtkTreeStore *store;
	GtkTreeModel *model;
	GtkWidget *combobox;
	GtkCellRenderer *renderer;
	gint i;
        GtkTreeIter iter0;

	store = gtk_tree_store_new (1,G_TYPE_STRING);

	for(i=0;i<numberOfGuessMethods;i++)
	{
        	gtk_tree_store_append (store, &iter, NULL);
		if(i==0) iter0 = iter;
        	gtk_tree_store_set (store, &iter, 0, listGuessMethodView[i], -1);
	}

        model = GTK_TREE_MODEL (store);
	combobox = gtk_combo_box_new_with_model (model);
	/*
	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
	*/
	g_object_unref (model);
	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementGuessMethod), NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);

	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);

	return combobox;
}
Ejemplo n.º 26
0
static void preferences_max_int_combo_box_setup(PreferencesDialog *prefs, GtkComboBox *int_combo_box, gint max_int_value, const gchar *int_label){
	debug("Setting-up maximum %s preference combo box", int_label);
	
	GtkListStore *list_store=gtk_list_store_new(COLUMN_COMBO_COUNT, G_TYPE_STRING, G_TYPE_INT);
	
	gtk_combo_box_set_model(GTK_COMBO_BOX(int_combo_box), GTK_TREE_MODEL(list_store));
	
	GtkCellRenderer *renderer=gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(int_combo_box), renderer, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(int_combo_box), renderer, "text", COLUMN_COMBO_NAME, NULL);
	
	if(max_int_value < maximum_entries[0].value)
		max_int_value=maximum_entries[G_N_ELEMENTS(maximum_entries)-1].value;
	
	for(gint i=0; i<G_N_ELEMENTS(maximum_entries) && maximum_entries[i].value <= max_int_value; i++){
		GtkTreeIter	*iter=g_new0(GtkTreeIter, 1);
		gtk_list_store_append(list_store, iter);
		gchar *combo_box_rows_label=g_strdup_printf("%d %s", maximum_entries[i].value, int_label);
		gtk_list_store_set(
					list_store, iter,
						COLUMN_COMBO_NAME, combo_box_rows_label,
						COLUMN_COMBO_VALUE, maximum_entries[i].value,
					-1
		);
		uber_free(combo_box_rows_label);
		uber_free(iter);
	}
	
	uber_object_unref(list_store);
}/*preferences_max_int_combo_box_setup(prefs, GtkComboBox *int_combo_box, const gchar *int_label);*/
Ejemplo n.º 27
0
static GtkWidget *
create_combo (const char *name,
	      gboolean is_list)
{
  GtkCellRenderer *cell_renderer;
  GtkWidget *combo;
  GtkCssProvider *provider;
  GtkStyleContext *context;
  gchar *css_data;

  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
  cell_renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
				  "text", 0, NULL);

  gtk_widget_set_name (combo, name);

  context = gtk_widget_get_style_context (combo);

  provider = gtk_css_provider_new ();
  css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
                              name, is_list ? "true" : "false");
  gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
  g_free (css_data);

  gtk_style_context_add_provider (context,
                                  GTK_STYLE_PROVIDER (provider),
                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

  return combo;
}
Ejemplo n.º 28
0
static GObject *
gtk_combo_box_text_constructor (GType                  type,
                                guint                  n_construct_properties,
                                GObjectConstructParam *construct_properties)
{
  GObject    *object;
  const gint text_column = 0;

  object = G_OBJECT_CLASS (gtk_combo_box_text_parent_class)->constructor
    (type, n_construct_properties, construct_properties);

  gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object), text_column);
  gtk_combo_box_set_id_column (GTK_COMBO_BOX (object), 1);

  if (!gtk_combo_box_get_has_entry (GTK_COMBO_BOX (object)))
    {
      GtkCellRenderer *cell;

      cell = gtk_cell_renderer_text_new ();
      gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell, TRUE);
      gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell,
                                      "text", text_column,
                                      NULL);
    }

  return object;
}
Ejemplo n.º 29
0
static GtkWidget *
create_effects_combo (void)
{
  GtkWidget *retval;
  GtkListStore *model;
  GtkCellRenderer *renderer;
  gint i;

  model = gtk_list_store_new (N_COLUMNS,
                              G_TYPE_STRING,
                              G_TYPE_STRING,
                              G_TYPE_UINT);
  
  for (i = 0; i < n_effects; i++)
    {
      GtkTreeIter iter;

      gtk_list_store_insert (model, &iter, i);
      gtk_list_store_set (model, &iter,
                          COLUMN_ID, effects[i].id,
                          COLUMN_LABEL, gettext (effects[i].label),
                          COLUMN_NICK, effects[i].nick,
                          -1);
    }

  retval = gtk_combo_box_new ();
  gtk_combo_box_set_model (GTK_COMBO_BOX (retval),
                           GTK_TREE_MODEL (model));
  g_object_unref (model);

  switch (border_effect[0])
    {
    case 's': /* shadow */
      gtk_combo_box_set_active (GTK_COMBO_BOX (retval),
                                SCREENSHOT_EFFECT_SHADOW);
      break;
    case 'b': /* border */
      gtk_combo_box_set_active (GTK_COMBO_BOX (retval),
                                SCREENSHOT_EFFECT_BORDER);
      break;
    case 'n': /* none */
      gtk_combo_box_set_active (GTK_COMBO_BOX (retval),
                                SCREENSHOT_EFFECT_NONE);
      break;
    default:
      break;
    }
  
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (retval), renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (retval), renderer,
                                  "text", COLUMN_LABEL,
                                  NULL);

  g_signal_connect (retval, "changed",
                    G_CALLBACK (effect_combo_changed_cb),
                    NULL);

  return retval;
}
Ejemplo n.º 30
0
/* Build the composite widget */
static void avahibrowser_init(AvahiBrowser * ab)
{
	GtkCellRenderer *cell;

	/* Create model */
	ab->data =
	    gtk_list_store_new(7, G_TYPE_STRING, G_TYPE_STRING,
			       G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
			       G_TYPE_STRING, G_TYPE_STRING);
	ab->combo_box =
	    gtk_combo_box_new_with_model(GTK_TREE_MODEL(ab->data));

	cell = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ab->combo_box), cell,
				   TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ab->combo_box),
				       cell, "text", 6, NULL);

	gtk_widget_show(ab->combo_box);
	gtk_widget_set_tooltip_text(ab->combo_box,
				    _
				    ("Select an automatically discovered game"));
	gtk_table_resize(GTK_TABLE(ab), 1, 1);
	gtk_table_attach_defaults(GTK_TABLE(ab), ab->combo_box, 0, 1, 0,
				  1);
}