示例#1
0
gchar*
xfsm_chooser_get_session (const XfsmChooser *chooser)
{
  GtkTreeSelection *selection;
  GtkTreeModel     *model;
  GtkTreeIter       iter;
  GValue            value;
  gchar            *name;

  bzero (&value, sizeof (value));
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chooser->tree));
  gtk_tree_selection_get_selected (selection, &model, &iter);
  gtk_tree_model_get_value (model, &iter, NAME_COLUMN, &value);
  name = g_value_dup_string (&value);
  g_value_unset (&value);

  return name;
}
示例#2
0
static void
edit_plugin_changed_cb (GtkWidget * w, gpointer data)
{
	GnomeUIInfo *curr_item;
	GValue val = {G_TYPE_INVALID};
	PluginEditorDialog *dlg = data;

	if (!dlg->do_redraw) return;
	if (FALSE == dlg->have_selection) return;
	
	gtk_tree_model_get_value (GTK_TREE_MODEL(dlg->treestore),
	                &dlg->curr_selection, PTRCOL, &val);
	curr_item = g_value_get_pointer(&val);

	/* Save current values of widgets to current item */
	edit_plugin_widgets_to_item (dlg, curr_item);
	edit_plugin_redraw_row (dlg, &dlg->curr_selection, curr_item);
}
示例#3
0
	// Get the value from the selected column
	int ModelSelector::getSelectedInteger (gint colNum)
	{
		// Get the selection
		GtkTreeIter iter;
		GtkTreeModel* model;

		if (gtk_tree_selection_get_selected(_selection, &model, &iter)) {
			// Get the value
			GValue val;
			val.g_type = 0;
			gtk_tree_model_get_value(model, &iter, colNum, &val);
			// Get the integer
			return g_value_get_int(&val);
		} else {
			// Nothing selected, return empty string
			return -1;
		}
	}
示例#4
0
/* returns a borrowed reference. */
static GObject *get_object_from_model(
	GtkTreeModel *model,
	GtkTreeIter *iter,
	int col_ix)
{
	GObject *ret;
	GValue val = { 0 };
	gtk_tree_model_get_value(model, iter, 0, &val);
	if(!G_VALUE_HOLDS(&val, G_TYPE_OBJECT)) {
		g_warning("%s: called for type `%s', not `%s'",
			__func__, G_VALUE_TYPE_NAME(&val), g_type_name(G_TYPE_OBJECT));
		ret = NULL;
	} else {
		ret = g_value_get_object(&val);
	}
	g_value_unset(&val);
	return ret;
}
示例#5
0
static void _map_source_changed(GtkWidget *widget, gpointer data)
{
  GtkTreeIter iter;

  if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter) == TRUE)
  {
    GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
    GValue value = {
      0,
    };
    OsmGpsMapSource_t map_source;

    gtk_tree_model_get_value(model, &iter, 1, &value);
    map_source = g_value_get_int(&value);
    g_value_unset(&value);
    dt_view_map_set_map_source(darktable.view_manager, map_source);
  }
}
示例#6
0
static const gchar *
gtk_combo_box_accessible_get_name (AtkObject *obj)
{
    GtkWidget *widget;
    GtkComboBox *combo_box;
    GtkComboBoxAccessible *accessible;
    GtkTreeIter iter;
    const gchar *name;
    GtkTreeModel *model;
    gint n_columns;
    gint i;

    name = ATK_OBJECT_CLASS (_gtk_combo_box_accessible_parent_class)->get_name (obj);
    if (name)
        return name;

    widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
    if (widget == NULL)
        return NULL;

    combo_box = GTK_COMBO_BOX (widget);
    accessible = GTK_COMBO_BOX_ACCESSIBLE (obj);
    if (gtk_combo_box_get_active_iter (combo_box, &iter))
    {
        model = gtk_combo_box_get_model (combo_box);
        n_columns = gtk_tree_model_get_n_columns (model);
        for (i = 0; i < n_columns; i++)
        {
            GValue value = G_VALUE_INIT;

            gtk_tree_model_get_value (model, &iter, i, &value);
            if (G_VALUE_HOLDS_STRING (&value))
            {
                g_free (accessible->name);
                accessible->name =  g_strdup (g_value_get_string (&value));
                g_value_unset (&value);
                break;
            }
            else
                g_value_unset (&value);
        }
    }
    return accessible->name;
}
示例#7
0
//Draws the text for the 'type' column.
void type_data_func(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{
    GValue val_str, val_type;
    char str[32];
    int type;
    
    memset(&val_str, 0, sizeof(val_str));
    memset(&val_type, 0, sizeof(val_type));
    g_value_init(&val_str, G_TYPE_STRING);
    
    gtk_tree_model_get_value(tree_model, iter, Col_Type, &val_type);
    type = g_value_get_int(&val_type);
    
    strncpy(str, type_name[type & ~Type_pointer], sizeof(str));
    if(type & Type_pointer) strcat(str, "*");
    
    g_value_set_string(&val_str, str);
    g_object_set_property(G_OBJECT(cell), "text", &val_str);
}
示例#8
0
static void
gtk_cell_view_set_cell_data (GtkCellView *cellview)
{
  GList *i;
  GtkTreeIter iter;
  GtkTreePath *path;

  g_return_if_fail (cellview->priv->displayed_row != NULL);
  
  path = gtk_tree_row_reference_get_path (cellview->priv->displayed_row);
  gtk_tree_model_get_iter (cellview->priv->model, &iter, path);
  gtk_tree_path_free (path);

  for (i = cellview->priv->cell_list; i; i = i->next)
    {
      GSList *j;
      GtkCellViewCellInfo *info = i->data;

      g_object_freeze_notify (G_OBJECT (info->cell));

      for (j = info->attributes; j && j->next; j = j->next->next)
        {
          gchar *property = j->data;
          gint column = GPOINTER_TO_INT (j->next->data);
          GValue value = {0, };

          gtk_tree_model_get_value (cellview->priv->model, &iter,
                                    column, &value);
          g_object_set_property (G_OBJECT (info->cell),
                                 property, &value);
          g_value_unset (&value);
        }

      if (info->func)
	(* info->func) (GTK_CELL_LAYOUT (cellview),
			info->cell,
			cellview->priv->model,
			&iter,
			info->func_data);

      g_object_thaw_notify (G_OBJECT (info->cell));
    }
}
示例#9
0
static void gui_contact_sms_selected_callback(GtkTreeView *view, GtkLabel *textLabel)
{
	GtkTreePath *path;
	gtk_tree_view_get_cursor(view,&path,NULL);
	debug("gui_contact_sms_selected_callback\n");
	if(path){
		GtkTreeModel *model=gtk_tree_view_get_model (view);
		GtkTreeIter iter;
		GValue value={0};
		gtk_tree_model_get_iter(GTK_TREE_MODEL(model),&iter,path);
		gtk_tree_path_free(path);
		gtk_tree_model_get_value(model,&iter,SPHONE_STORE_TREE_MODEL_COLUMN_INTERACTION_ID,&value);
		gint id=g_value_get_int(&value);
		gchar *content=store_interaction_sms_get_by_id(id);
		gtk_label_set_text(textLabel,content);
		g_free(content);
		g_value_unset(&value);
	}
}
示例#10
0
static void rename_cb (GtkWidget *button, GtkTreeSelection *sel)
{
  GtkTreeModel *model;
  GtkTreeIter iter;
  GValue val;
  struct widget *w;
        
  gtk_tree_selection_get_selected (sel, &model, &iter);
  val.g_type = 0;
  gtk_tree_model_get_value (model, &iter, 1, &val);
  w = g_value_get_pointer(&val);
	
  purple_request_input(NULL, 
    _("Rename Widget"), NULL,
    _("Enter a new name for this widget."), w->alias, 
    FALSE, FALSE, NULL,
    _("Rename"), G_CALLBACK(widget_popup_rename_cb),
    _("Cancel"), NULL, NULL, NULL, NULL, w);
}
示例#11
0
static char *
fi_gui_get_alias(GtkWidget *widget)
{
	GtkTreeModel *model;
	GtkTreeIter iter;

	g_return_val_if_fail(widget, NULL);

	if (drag_get_iter(GTK_TREE_VIEW(widget), &model, &iter)) {
		static const GValue zero_value;
		GValue value;

		value = zero_value;
		gtk_tree_model_get_value(model, &iter, 0, &value);
		return g_strdup(g_value_get_string(&value));
	} else {
		return NULL;
	}
}
示例#12
0
static gboolean set_one_dive(GtkTreeModel *model,
			     GtkTreePath *path,
			     GtkTreeIter *iter,
			     gpointer data)
{
	GValue value = {0, };
	struct dive *dive;

	/* Get the dive number */
	gtk_tree_model_get_value(model, iter, DIVE_INDEX, &value);
	dive = get_dive(g_value_get_int(&value));
	if (!dive)
		return TRUE;
	if (data && dive != data)
		return FALSE;

	fill_one_dive(dive, model, iter);
	return dive == data;
}
示例#13
0
gboolean __new_req_window_lookup_country (GtkTreeModel *model,
                                          GtkTreePath *path,
                                          GtkTreeIter *iter,
                                          gpointer data)
{
        gchar *country = (gchar *) data;
        GValue *value = g_new0(GValue, 1);
        
        gtk_tree_model_get_value (model, iter, 1, value);
        if (! strcmp (country, g_value_get_string(value))) {
                gtk_combo_box_set_active_iter (GTK_COMBO_BOX(gtk_builder_get_object(new_req_window_gtkb,"country_combobox1")), iter);
		g_free (value);
                return TRUE;
        }
        
	g_free(value);
        return FALSE;

}
示例#14
0
文件: colors.c 项目: laubstein/pw3270
 static int SaveColors(GtkComboBox *combo)
 {
	int 			f;
	gchar			clr[4096];
	GtkTreeIter 	iter;

#if GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 12
	gchar			*ptr;
#else
	int				sz;
#endif

	*clr = 0;

 	for(f=0;f < TERMINAL_COLOR_COUNT;f++)
 	{
 		if(f > 0)
			g_strlcat(clr,",",4095);

#if GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 12
		ptr = gdk_color_to_string(color+f);
		g_strlcat(clr,ptr,4095);
		g_free(ptr);
#else
		sz = strlen(clr);
		g_snprintf(clr+sz,4094-sz,"#%04x%04x%04x",(color+f)->red,(color+f)->green,(color+f)->blue);
#endif

 	}

	SetString("Terminal","Colors",clr);

 	if(gtk_combo_box_get_active_iter(combo,&iter))
 	{
		GValue		value	= { 0, };

		gtk_tree_model_get_value(gtk_combo_box_get_model(combo),&iter,1,&value);
		SetString("Terminal","ColorScheme",g_value_get_string(&value));
 	}

 	return 0;
 }
示例#15
0
/**
@brief copy a liststore or treestore
This is for when reffing is not enough e.g. need independent sorting in
attached views. Pointers to data are simply copied, so if the "source" data will
be cleared before fhe new store, then all such data must be replicated or otherwise
preserved by code elsewhere which understands what that data really is.
Officially, the new store will be unsorted, though in practice it will be the
same as the old store.
@param model treemodel of the store being copied
@param treetype TRUE for treestore, FALSE for liststore
@param newstore store for pointer to new store

@a return
*/
void e2_tree_store_copy (GtkTreeModel *model, gboolean treetype, gpointer *newstore)
{
	GtkTreeIter src;
	gint i, ncols = gtk_tree_model_get_n_columns (model);
	gint colnums[ncols];
	GType types[ncols];
	GValue values[ncols];

	for (i = 0; i < ncols; i++)
	{
		colnums[i] = i;
		types[i] = gtk_tree_model_get_column_type (model, i);
		memset (&values[i], 0, sizeof (GValue));
	}

	if (treetype)
	{
		GtkTreeStore *newtstore = gtk_tree_store_newv (ncols, types);
		if (gtk_tree_model_get_iter_first (model, &src))
			_e2_tree_copy_descendants (model, NULL, newtstore, NULL,
						ncols, colnums, types, values);

		*newstore = newtstore;
	}
	else
	{
		GtkListStore *newlstore = gtk_list_store_newv (ncols, types);
		if (gtk_tree_model_get_iter_first (model, &src))
		{
			GtkTreeIter dest;
			do
			{
				for (i = 0; i < ncols; i++)
					gtk_tree_model_get_value (model, &src, i, &values[i]);
				gtk_list_store_insert_with_valuesv (newlstore, &dest, -1, colnums, values, ncols);
				for (i = 0; i < ncols; i++)
					g_value_unset (&values[i]);
			} while (gtk_tree_model_iter_next (model, &src));
		}
		*newstore = newlstore;
	}
}
示例#16
0
文件: wldlg.c 项目: jheusala/freeciv
/****************************************************************
  Insert item to queue
*****************************************************************/
static void queue_insert(struct worklist_data *ptr, bool prepend)
{
  GtkTreeModel *model;
  GtkTreeIter it;
  GtkTreePath *path;

  GtkTreeModel *src_model, *dst_model;
  GtkTreeIter src_it, dst_it;
  gint i, ncols;

  if (!gtk_widget_is_sensitive(ptr->dst_view)) {
    return;
  }

  if (!gtk_tree_selection_get_selected(ptr->src_selection, &model, &it)) {
    return;
  }

  path = gtk_tree_model_get_path(model, &it);

  src_model = GTK_TREE_MODEL(ptr->src);
  dst_model = GTK_TREE_MODEL(ptr->dst);

  gtk_tree_model_get_iter(src_model, &src_it, path);
  if (prepend) {
    gtk_list_store_prepend(GTK_LIST_STORE(dst_model), &dst_it);
  } else {
    gtk_list_store_append(GTK_LIST_STORE(dst_model), &dst_it);
  }

  ncols = gtk_tree_model_get_n_columns(src_model);

  for (i = 0; i < ncols; i++) {
    GValue value = { 0, };

    gtk_tree_model_get_value(src_model, &src_it, i, &value);
    gtk_list_store_set_value(GTK_LIST_STORE(dst_model), &dst_it, i, &value);
  }
  commit_worklist(ptr);

  gtk_tree_path_free(path);
}
示例#17
0
char *list_get_digest(const unsigned int row, const enum hash_func_e id)
{
	g_assert(row <= list.rows);
	g_assert(HASH_FUNC_IS_VALID(id));

	GtkTreeIter iter;

	if (!gtk_tree_model_iter_nth_child(gui.treemodel, &iter, NULL, row))
		return NULL;

	char *digest;
	GValue value = G_VALUE_INIT;

	gtk_tree_model_get_value(gui.treemodel, &iter, list_priv.hash_cols[id],
		&value);
	digest = g_value_dup_string(&value);
	g_value_unset(&value);

	return digest;
}
示例#18
0
wxString wxChoice::GetString(unsigned int n) const
{
    wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid control") );

    wxString str;

    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
    GtkTreeModel *model = gtk_combo_box_get_model( combobox );
    GtkTreeIter iter;
    if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
    {
        GValue value = G_VALUE_INIT;
        gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
        wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
        g_value_unset( &value );
        return tmp;
    }

    return str;
}
示例#19
0
static void print_date (GtkTreeViewColumn *tree_column,
                        GtkCellRenderer *cell,
                        GtkTreeModel *tree_model,
                        GtkTreeIter *iter,
                        gpointer data)
{
    GValue value = { 0 };
    time64 doc_date_time;
    gchar *doc_date_str;

    g_return_if_fail (cell && iter && tree_model);


    gtk_tree_model_get_value (tree_model, iter, 0, &value);
    doc_date_time = (time64) g_value_get_int64 (&value);
    g_value_unset (&value);
    doc_date_str = qof_print_date (doc_date_time);
    g_object_set (G_OBJECT (cell), "text", doc_date_str, NULL);
    g_free (doc_date_str);
}
/* Get selected account string field from treeview
 * @return newly allocated string, must be freed by caller */
static gchar *
get_selected_account_column(GtkTreeView *tree_view, column_t column)
{
    g_assert(column == COLUMN_ACCOUNT_ALIAS || column == COLUMN_ACCOUNT_ID);

    GtkTreeModel *model = gtk_tree_view_get_model(tree_view);
    GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);

    // Find selected iteration and create a copy
    GtkTreeIter iter;
    gtk_tree_selection_get_selected(selection, &model, &iter);
    // The Gvalue will be initialized in the following function
    GValue val;
    memset(&val, 0, sizeof(val));
    gtk_tree_model_get_value(model, &iter, column, &val);

    gchar *result = g_strdup(g_value_get_string(&val));
    g_value_unset(&val);
    return result;
}
static void
gtk_combo_box_entry_active_changed(GtkComboBox * combo_box,
                                   gpointer user_data)
{
    GtkTreeModel *model;
    GtkTreeIter iter;
    gboolean editableEntry = TRUE;

    if (gtk_combo_box_get_active_iter(combo_box, &iter)) {
        GtkEntry *entry =
            trg_destination_combo_get_entry(TRG_DESTINATION_COMBO
                                            (combo_box));

        if (entry) {
            GValue value = { 0, };
            guint type;

            model = gtk_combo_box_get_model(combo_box);

            gtk_tree_model_get_value(model, &iter, DEST_COLUMN_LABEL,
                                     &value);
            gtk_tree_model_get(model, &iter, DEST_COLUMN_TYPE, &type, -1);

            g_object_set_property(G_OBJECT(entry), "text", &value);
            g_value_unset(&value);

            if (type == DEST_LABEL)
                editableEntry = FALSE;
        }
    }
#if GTK_CHECK_VERSION( 3, 0, 0 )
    gtk_editable_set_editable(GTK_EDITABLE
                              (trg_destination_combo_get_entry
                               (TRG_DESTINATION_COMBO(combo_box))),
                              editableEntry);
#else
    gtk_entry_set_editable(trg_destination_combo_get_entry
                           (TRG_DESTINATION_COMBO(combo_box)),
                           editableEntry);
#endif
}
示例#22
0
void
gnome_prefs_string_option_menu_remove (GtkWidget *option_menu,
				       const gchar *option)
{
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;
  int cpt = 0;
  int active = 0;

  if (!option)
    return;

  model = gtk_combo_box_get_model (GTK_COMBO_BOX (option_menu));
  active = gtk_combo_box_get_active (GTK_COMBO_BOX (option_menu));

  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) {

    do {
      gchar *value_string = NULL;
      GValue value = { 0, {{0}, {0}} };
      gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter, 0, &value);
      value_string = (gchar *) g_value_get_string (&value);
      if (g_ascii_strcasecmp  (value_string, option) == 0) {

        if (cpt == active) {
          gtk_list_store_set (GTK_LIST_STORE (model), &iter, 
                              COLUMN_SENSITIVE, FALSE,
                              -1);
        }
        else {
          gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
        }
        g_value_unset(&value);
        break;
      }
      g_value_unset(&value);
      cpt++;

    } while (gtk_tree_model_iter_next(GTK_TREE_MODEL (model), &iter));
  }
}
void FormatDialog::cbFormatChangedCb(GtkComboBox* widget, FormatDialog* dlg)
{
	XOJ_CHECK_TYPE_OBJ(dlg, FormatDialog);

	GtkTreeIter iter;

	if (gtk_combo_box_get_active_iter(widget, &iter))
	{
		GtkTreeModel* model = gtk_combo_box_get_model(widget);

		GValue value = { 0 };
		gtk_tree_model_get_value(model, &iter, 1, &value);

		if (G_VALUE_HOLDS_POINTER(&value))
		{
			GtkPaperSize* s = (GtkPaperSize*) g_value_get_pointer(&value);

			if (s == NULL)
			{
				return;
			}

			double width = gtk_paper_size_get_width(s, GTK_UNIT_POINTS) / dlg->scale;
			double height = gtk_paper_size_get_height(s, GTK_UNIT_POINTS) / dlg->scale;

			if (dlg->orientation == ORIENTATION_LANDSCAPE)
			{
				double tmp = width;
				width = height;
				height = tmp;
			}
			else
			{
				dlg->setOrientation(ORIENTATION_PORTRAIT);
			}

			gtk_spin_button_set_value(GTK_SPIN_BUTTON(dlg->get("spinWidth")), width);
			gtk_spin_button_set_value(GTK_SPIN_BUTTON(dlg->get("spinHeight")), height);
		}
	}
}
示例#24
0
文件: helper.c 项目: RobertDash/pspp
/* Create a deep copy of SRC */
GtkListStore *
clone_list_store (const GtkListStore *src)
{
  GtkTreeIter src_iter;
  gboolean ok;
  gint i;
  const gint n_cols =  gtk_tree_model_get_n_columns (GTK_TREE_MODEL (src));
  GType *types = g_malloc (sizeof (*types) *  n_cols);

  int row = 0;
  GtkListStore *dest;

  for (i = 0 ; i < n_cols; ++i )
    types[i] = gtk_tree_model_get_column_type (GTK_TREE_MODEL (src), i);

  dest = gtk_list_store_newv (n_cols, types);

  for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (src),
					   &src_iter);
       ok;
       ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (src), &src_iter))
    {
      GtkTreeIter dest_iter;
      gtk_list_store_append  (dest, &dest_iter);

      for (i = 0 ; i < n_cols; ++i )
	{
	  GValue val = {0};

	  gtk_tree_model_get_value (GTK_TREE_MODEL (src), &src_iter, i, &val);
	  gtk_list_store_set_value (dest, &dest_iter, i, &val);

	  g_value_unset (&val);
	}
      row++;
    }

  g_free (types);

  return dest;
}
示例#25
0
wxString wxComboBox::GetString(unsigned int n) const
{
    wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") );

    wxString str;

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        GtkTreeModel *model = gtk_combo_box_get_model( combobox );
        GtkTreeIter iter;
        if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
        {
            GValue value = { 0, };
            gtk_tree_model_get_value( model, &iter, 0, &value );
            wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
            g_value_unset( &value );
            return tmp;
        }
    }
    else
#endif
    {
        GtkWidget *list = GTK_COMBO(m_widget)->list;

        GList *child = g_list_nth( GTK_LIST(list)->children, n );
        if (child)
        {
            GtkBin *bin = GTK_BIN( child->data );
            GtkLabel *label = GTK_LABEL( bin->child );
            str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
        }
        else
        {
            wxFAIL_MSG( wxT("wxComboBox: wrong index") );
        }
    }

    return str;
}
示例#26
0
static
void cb_custom_edited(GtkCellRendererText *renderer, char *path, char *str, gpointer data)
{
	GtkTreeIter iter;
	GtkTreeModel *model = (GtkTreeModel*) data;
	if (gtk_tree_model_get_iter_from_string(model, &iter, path)) {
                PurpleAccount *account;
                GValue value;
                memset(&value, 0, sizeof(value));
                gtk_tree_model_get_value(model, &iter, 5, &value);
                assert(G_VALUE_HOLDS_POINTER(&value));
                account = g_value_get_pointer(&value);
                g_value_unset(&value);

		char pref[STRLEN];
		build_pref(pref, PREF_CUSTOM_FORMAT, purple_account_get_username(account), purple_account_get_protocol_name(account));

		gtk_list_store_set(GTK_LIST_STORE(model), &iter, 2, str, -1);
		purple_prefs_set_string(pref, str);
	}
}
示例#27
0
bool wxCheckListBox::IsChecked(unsigned int index) const
{
    wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid checklistbox") );

    GtkTreeIter iter;
    gboolean res = gtk_tree_model_iter_nth_child(
                        GTK_TREE_MODEL(m_liststore),
                        &iter, NULL, //NULL = parent = get first
                        index
                   );
    if(!res)
        return false;

    GValue value = {0, };
    gtk_tree_model_get_value(GTK_TREE_MODEL(m_liststore),
                             &iter,
                             0, //column
                             &value);

    return g_value_get_boolean(&value) != 0;
}
示例#28
0
	void EntityClassChooser::callbackSelectionChanged (GtkWidget* widget, EntityClassChooser* self)
	{
		// Check for a selection
		GtkTreeIter iter;
		if (gtk_tree_selection_get_selected(self->_selection, NULL, &iter)) {

			// There is a selection, so make the Add button active and update the
			// usage information
			gtk_widget_set_sensitive(self->_addButton, TRUE);

			// Get the selected classname
			GValue val;
			val.g_type = 0;
			gtk_tree_model_get_value(GTK_TREE_MODEL(self->_treeStore), &iter, 0, &val);

			// Set the panel text
			self->updateUsageInfo(g_value_get_string(&val));
		} else {
			gtk_widget_set_sensitive(self->_addButton, FALSE);
		}
	}
static SteadyflowCoreIDownloadFile* steadyflow_file_list_controller_file_from_iter (SteadyflowFileListController* self, GtkTreeIter* iter) {
	SteadyflowCoreIDownloadFile* result = NULL;
	GValue value = {0};
	GtkListStore* _tmp0_;
	GtkTreeIter _tmp1_;
	GValue _tmp2_ = {0};
	GObject* _tmp3_ = NULL;
	SteadyflowCoreIDownloadFile* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (iter != NULL, NULL);
	_tmp0_ = self->priv->model;
	_tmp1_ = *iter;
	gtk_tree_model_get_value ((GtkTreeModel*) _tmp0_, &_tmp1_, 0, &_tmp2_);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp2_;
	_tmp3_ = g_value_get_object (&value);
	_tmp4_ = _g_object_ref0 (STEADYFLOW_CORE_IDOWNLOAD_FILE (_tmp3_));
	result = _tmp4_;
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	return result;
}
示例#30
0
static void
select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, struct datawindow_priv *win)
{
	char *cols[20];
	GtkTreeIter iter;
	GtkTreeModel *model;
	int i;

	dbg(0,"win=%p\n", win);

	model=gtk_tree_view_get_model(tree);
	gtk_tree_model_get_iter(model, &iter, path);

	for (i=0;i<gtk_tree_model_get_n_columns(model);i++) {
		gtk_tree_model_get_value(model, &iter, i, &value);
		cols[i]=g_strdup_value_contents(&value)+1;
		cols[i][strlen(cols[i])-1]='\0';
		g_value_unset(&value);
	}
	callback_call_1(win->click, cols);
}