void GtkCatalogModel_change_record(GtkCatalogModel * custom_list, gint recordIndex) {
    GtkTreeIter iter;
    GtkTreePath *path;
    CatalogRecord record;

    g_return_if_fail (GTKCATALOGMODEL_IS_LIST(custom_list));
    g_return_if_fail (recordIndex < CatalogDB_getRecordCount(custom_list->catalogDB));

    CatalogRecord_init(&record);
    CatalogDB_readRecord(custom_list->catalogDB, recordIndex, &record);
    if (CatalogRecord_edit(&record)) {
        CatalogDB_writeRecord(custom_list->catalogDB, recordIndex, &record);

        /* inform the tree view and other interested objects
         * (e.g. tree row references) that we have inserted
         * a new row, and where it was inserted */

        path = gtk_tree_path_new();
        gtk_tree_path_append_index(path, recordIndex);

        GtkCatalogModel_get_iter(GTK_TREE_MODEL(custom_list), &iter, path);

        gtk_tree_model_row_changed(GTK_TREE_MODEL(custom_list), path, &iter);

        gtk_tree_path_free(path);
    }
    CatalogRecord_finalize(&record);
}
예제 #2
0
bool gbase_list_change_record(GBaseList *self, const gchar *value, unsigned int row, unsigned int col) {
	g_return_val_if_fail(GBASE_IS_LIST(self), false);
	g_return_val_if_fail(col < BASE_COL_COUNT, false);

	bool ret = false;

	GtkTreePath *path = gtk_tree_path_new();
	gtk_tree_path_append_index(path, row);

	GtkTreeIter iter;
	gbase_list_get_iter(GTK_TREE_MODEL(self), &iter, path);

	base_entry_t *entry = base_iter_value(USER_DATA_2_BASE_ITER(iter.user_data));

	if (entry && base_entry_change(self->base_ctx, entry, value, col)) {
		gtk_tree_model_row_changed(GTK_TREE_MODEL(self), path, &iter);

		if (row == 0 && entry->number.len && entry->name.len && entry->fname.len) {
			base_prepend_placeholder(self->base_ctx);
			gbase_list_row_prepended(self);
			ret = true;
		}
	}

	gtk_tree_path_free(path);

	return ret;
}
예제 #3
0
static void
_diagram_change (DiaApplication   *app,
                 Diagram          *dia,
		 guint             flags,
		 gpointer          object,
	         DiagramTreeModel *dtm)
{
  GtkTreePath *path;
  GtkTreeIter _iter = {0,};
  GtkTreeIter *iter = &_iter;
  
  NODE_DIAGRAM(iter) = DIA_DIAGRAM_DATA(dia);

  if (flags & DIAGRAM_CHANGE_NAME)
    /* nothing special */;
  if (flags & DIAGRAM_CHANGE_LAYER)
    NODE_LAYER(iter) = object;
  if (flags & DIAGRAM_CHANGE_OBJECT) {
    NODE_OBJECT(iter) = object;
    NODE_LAYER(iter) = dia_object_get_parent_layer (object);
  }

  path = _dtm_get_path (GTK_TREE_MODEL (dtm), iter);
  gtk_tree_model_row_changed (GTK_TREE_MODEL (dtm), path, iter);
  gtk_tree_path_free (path);
}
static void
persona_set_active (EmpathyPersonaStore *self,
    FolksPersona *persona,
    gboolean active,
    gboolean set_changed)
{
  EmpathyPersonaStorePriv *priv;
  GtkTreePath *path;
  GtkTreeIter iter;

  priv = GET_PRIV (self);

  path = find_persona (self, persona);
  if (path == NULL)
    return;

  gtk_tree_model_get_iter (GTK_TREE_MODEL (self), &iter, path);
  gtk_list_store_set (GTK_LIST_STORE (self), &iter,
      EMPATHY_PERSONA_STORE_COL_IS_ACTIVE, active,
      -1);

  DEBUG ("Set item %s", active ? "active" : "inactive");

  if (set_changed)
    gtk_tree_model_row_changed (GTK_TREE_MODEL (self), path, &iter);

  gtk_tree_path_free (path);
}
예제 #5
0
파일: mon-gnome.c 프로젝트: aosm/distcc
static void
dcc_set_row_idle(GtkListStore *model,
                 GtkTreeIter *tree_iter)
{
     struct dcc_history *history;

     gtk_tree_model_get(GTK_TREE_MODEL (model), tree_iter,
                        COLUMN_HISTORY, &history,
                        -1);

     /* only write to the treemodel if it was previously non-idle */
     if (history->past_phases[history->now] != DCC_PHASE_DONE) {
          gtk_list_store_set (model, tree_iter,
                              COLUMN_FILE, NULL,
                              COLUMN_STATE, NULL, 
                              -1);
     } else {
          /* it still changed... */
          GtkTreePath *path;

          path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), tree_iter);
          gtk_tree_model_row_changed(GTK_TREE_MODEL(model), path, tree_iter);
          gtk_tree_path_free(path);
     }
     
     dcc_history_push(history, DCC_PHASE_DONE);
}
예제 #6
0
/* This is called only explicitly as we always know the enabled state changes
 * because we always do it and otherwise we would have to prevent recursion. */
static void
update_group_states(GtkTreeModel *model)
{
    GroupState group_states[GWY_GRAIN_VALUE_GROUP_USER+1];
    GrainValueStorePrivate *priv;
    GtkTreeIter iter;

    gwy_clear(group_states, GWY_GRAIN_VALUE_GROUP_USER+1);

    gtk_tree_model_foreach(model, update_state, group_states);
    if (!gtk_tree_model_get_iter_first(model, &iter))
        return;

    priv = g_object_get_qdata(G_OBJECT(model), priv_quark);
    do {
        GwyGrainValueGroup group;
        GtkTreePath *path;

        gtk_tree_model_get(model, &iter,
                           GWY_GRAIN_VALUE_STORE_COLUMN_GROUP, &group,
                           -1);
        if (group_states[group] != priv->group_states[group]) {
            priv->group_states[group] = group_states[group];
            path = gtk_tree_model_get_path(model, &iter);
            gtk_tree_model_row_changed(model, path, &iter);
            gtk_tree_path_free(path);
        }
    } while (gtk_tree_model_iter_next(model, &iter));
}
예제 #7
0
gboolean
is_store_set_enabled(IsStore *self,
		     GtkTreeIter *iter,
		     gboolean enabled)
{
	IsStorePrivate *priv;
	IsStoreEntry *entry = NULL;
	gboolean ret = FALSE;

	g_return_val_if_fail(IS_IS_STORE(self), FALSE);
	g_return_val_if_fail(iter != NULL, FALSE);

	priv = self->priv;

	g_return_val_if_fail(iter->stamp == priv->stamp, FALSE);
	g_return_val_if_fail(iter->user_data, FALSE);

	entry = (IsStoreEntry *)g_sequence_get(iter->user_data);
	if (entry->sensor && entry->enabled != enabled) {
		GtkTreePath *path;

		entry->enabled = enabled;

		path = gtk_tree_model_get_path(GTK_TREE_MODEL(self), iter);
		gtk_tree_model_row_changed(GTK_TREE_MODEL(self), path, iter);
		gtk_tree_path_free(path);

		ret = TRUE;
	}
	return ret;
}
예제 #8
0
static void
contact_list_store_contact_set_active (EmpathyContactListStore *store,
				       EmpathyContact          *contact,
				       gboolean                active,
				       gboolean                set_changed)
{
	EmpathyContactListStorePriv *priv;
	GtkTreeModel               *model;
	GList                      *iters, *l;

	priv = GET_PRIV (store);
	model = GTK_TREE_MODEL (store);

	iters = contact_list_store_find_contact (store, contact);
	for (l = iters; l; l = l->next) {
		GtkTreePath *path;

		gtk_tree_store_set (GTK_TREE_STORE (store), l->data,
				    EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, active,
				    -1);

		DEBUG ("Set item %s", active ? "active" : "inactive");

		if (set_changed) {
			path = gtk_tree_model_get_path (model, l->data);
			gtk_tree_model_row_changed (model, path, l->data);
			gtk_tree_path_free (path);
		}
	}

	g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
	g_list_free (iters);

}
예제 #9
0
static void
extract_toggled_cb (GtkCellRendererToggle *renderer, char *path_str, RBAudioCdSource *source)
{
	RhythmDBQueryModel *model;
	GtkTreePath *path;
	GtkTreeIter iter;

	g_object_get (source, "query-model", &model, NULL);

	path = gtk_tree_path_new_from_string (path_str);
	if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path)) {
		RhythmDBEntry *entry;

		entry = rhythmdb_query_model_iter_to_entry (model, &iter);
		if (entry != NULL) {
			RBAudioCDEntryData *extra_data;

			extra_data = RHYTHMDB_ENTRY_GET_TYPE_DATA (entry, RBAudioCDEntryData);
			extra_data->extract = !extra_data->extract;
			rhythmdb_entry_unref (entry);

			gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
		}
	}
	gtk_tree_path_free (path);
	g_object_unref (model);
}
예제 #10
0
파일: testgmenu.c 프로젝트: 3v1n0/gtk
static void
enabled_cell_toggled (GtkCellRendererToggle *cell,
                      const gchar           *path_str,
                      GtkTreeModel          *model)
{
  GActionGroup *group;
  GAction *action;
  gchar *name;
  GtkTreePath *path;
  GtkTreeIter iter;
  gboolean enabled;

  group = g_object_get_data (G_OBJECT (model), "group");
  path = gtk_tree_path_new_from_string (path_str);
  gtk_tree_model_get_iter (model, &iter, path);
  gtk_tree_model_get (model, &iter, 0, &name, -1);

  enabled = g_action_group_get_action_enabled (group, name);
  action = g_action_map_lookup_action (G_ACTION_MAP (group), name);
  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !enabled);

  gtk_tree_model_row_changed (model, path, &iter);

  g_free (name);
  gtk_tree_path_free (path);
}
예제 #11
0
static void
thunar_column_model_notify_visible_columns (ThunarPreferences *preferences,
                                            GParamSpec        *pspec,
                                            ThunarColumnModel *column_model)
{
  GtkTreePath *path;
  GtkTreeIter  iter;
  gint         n;

  _thunar_return_if_fail (THUNAR_IS_COLUMN_MODEL (column_model));
  _thunar_return_if_fail (THUNAR_IS_PREFERENCES (preferences));

  /* load the new list of visible columns */
  thunar_column_model_load_visible_columns (column_model);

  /* emit "row-changed" for all rows */
  for (n = 0; n < THUNAR_N_VISIBLE_COLUMNS; ++n)
    {
      path = gtk_tree_path_new_from_indices (n, -1);
      if (gtk_tree_model_get_iter (GTK_TREE_MODEL (column_model), &iter, path))
        gtk_tree_model_row_changed (GTK_TREE_MODEL (column_model), path, &iter);
      gtk_tree_path_free (path);
    }

  /* emit "columns-changed" */
  g_signal_emit (G_OBJECT (column_model), column_model_signals[COLUMNS_CHANGED], 0);
}
예제 #12
0
/* forward row changed signals */
static void replay_event_store_row_changed(ReplayEventStore *event_store,
                                       GtkTreePath *path,
                                       GtkTreeIter *iter,
                                       ReplayMessageTree *self)
{
  GtkTreePath *list_path;
  GtkTreePath *tree_path;

  list_path = gtk_tree_model_get_path(GTK_TREE_MODEL(event_store),
                                      iter);
  tree_path = replay_message_tree_get_tree_path_from_list_path(self, list_path);
  if (tree_path)
  {
    GtkTreeIter tree_iter;
    replay_message_tree_get_iter(GTK_TREE_MODEL(self),
                              &tree_iter,
                              tree_path);
    /* emit signal that row changed */
    gtk_tree_model_row_changed(GTK_TREE_MODEL(self),
                               tree_path,
                               &tree_iter);
    gtk_tree_path_free(tree_path);
  }
  gtk_tree_path_free(list_path);
}
예제 #13
0
void ptk_file_list_file_changed( VFSDir* dir,
                                 VFSFileInfo* file,
                                 PtkFileList* list )
{
    GList* l;
    GtkTreeIter it;
    GtkTreePath* path;

    if( ! list->show_hidden && vfs_file_info_get_name(file)[0] == '.' )
        return;
    l = g_list_find( list->files, file );

    if( ! l )
        return;

    it.stamp = list->stamp;
    it.user_data = l;
    it.user_data2 = l->data;

    path = gtk_tree_path_new_from_indices( g_list_index(list->files, l->data), -1 );

    gtk_tree_model_row_changed( GTK_TREE_MODEL(list), path, &it );

    gtk_tree_path_free( path );
}
예제 #14
0
static void
on_sequence_pattern_usage_changed (BtSequence * sequence, BtPattern * pattern,
    gpointer user_data)
{
  BtPatternListModel *model = BT_PATTERN_LIST_MODEL (user_data);
  BtMachine *machine;

  g_object_get (pattern, "machine", &machine, NULL);
  if (machine) {
    if (machine == model->priv->machine) {
      GSequence *seq = model->priv->seq;
      GtkTreeIter iter;
      GtkTreePath *path;

      // find the item by pattern
      iter.stamp = model->priv->stamp;
      iter.user_data = g_sequence_lookup (seq, pattern, model_item_cmp, NULL);
      path = gtk_tree_path_new ();
      gtk_tree_path_append_index (path,
          g_sequence_iter_get_position (iter.user_data));
      gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
      gtk_tree_path_free (path);
    }
    g_object_unref (machine);
  }
}
예제 #15
0
static void
on_pattern_name_changed (BtPattern * pattern, GParamSpec * arg,
    gpointer user_data)
{
  BtSequenceGridModel *model = BT_SEQUENCE_GRID_MODEL (user_data);
  BtCmdPattern *that_pattern;
  GtkTreePath *path;
  GtkTreeIter iter;
  gulong i, j;
  gulong length = model->priv->length;
  gulong tracks = model->priv->tracks;

  iter.stamp = model->priv->stamp;

  // find all affected rows and signal updates
  // FIXME(ensonic): skip tracks with wrong machine (do a first run and build a list of tracks)
  for (i = 0; i < length; i++) {
    for (j = 0; j < tracks; j++) {
      if ((that_pattern =
              bt_sequence_get_pattern (model->priv->sequence, i, j))) {
        if (that_pattern == (BtCmdPattern *) pattern) {
          iter.user_data = GUINT_TO_POINTER (i);
          path = gtk_tree_path_new ();
          gtk_tree_path_append_index (path, i);
          gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
          gtk_tree_path_free (path);
          g_object_unref (that_pattern);
          break;
        } else {
          g_object_unref (that_pattern);
        }
      }
    }
  }
}
예제 #16
0
gboolean
is_store_set_label(IsStore *self,
		   GtkTreeIter *iter,
		   const gchar *label)
{
	IsStorePrivate *priv;
	IsStoreEntry *entry = NULL;
	gboolean ret = FALSE;

	g_return_val_if_fail(IS_IS_STORE(self), FALSE);
	g_return_val_if_fail(iter != NULL, FALSE);

	priv = self->priv;

	g_return_val_if_fail(iter->stamp == priv->stamp, FALSE);
	g_return_val_if_fail(iter->user_data, FALSE);

	entry = (IsStoreEntry *)g_sequence_get(iter->user_data);
	if (entry->sensor &&
	    g_strcmp0(is_sensor_get_label(entry->sensor), label) != 0) {
		GtkTreePath *path;

		is_sensor_set_label(entry->sensor, label);

		path = gtk_tree_model_get_path(GTK_TREE_MODEL(self), iter);
		gtk_tree_model_row_changed(GTK_TREE_MODEL(self), path, iter);
		gtk_tree_path_free(path);

		ret = TRUE;
	}
	return ret;
}
예제 #17
0
void on_mount_added(GVolumeMonitor* vm, GMount* mount, gpointer user_data)
{
    FmPlacesModel* model = FM_PLACES_MODEL(user_data);
    GVolume* vol = g_mount_get_volume(mount);
    if(vol)
    {
        FmPlaceItem *item;
        GtkTreeIter it;
        item = find_vol(model, vol, &it);
        if(item && item->type == FM_PLACES_ITEM_VOL && !item->fi->path)
        {
            GtkTreePath* tp;
            GFile* gf = g_mount_get_root(mount);
            FmPath* path = fm_path_new_for_gfile(gf);
            g_debug("mount path: %s", path->name);
            g_object_unref(gf);
            fm_file_info_set_path(item->fi, path);
            if(path)
                fm_path_unref(path);
            item->vol_mounted = TRUE;

            /* inform the view to update mount indicator */
            tp = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &it);
            gtk_tree_model_row_changed(GTK_TREE_MODEL(model), tp, &it);
            gtk_tree_path_free(tp);
        }
        g_object_unref(vol);
    }
}
예제 #18
0
/**
 * unselect the current selection of the custom list
 *
 * \param
 *
 * \return
 * */
void transaction_list_select_unselect (void)
{
    CustomRecord *record = NULL;
    GtkTreePath *path;
    GtkTreeIter iter;
    gint i;
    CustomList *custom_list;

    custom_list = transaction_model_get_model ();

    g_return_if_fail ( custom_list != NULL );
    g_return_if_fail ( custom_list -> selected_row != NULL );

    iter.stamp = custom_list->stamp;

    /* get the selected row */
    record = custom_list -> selected_row;

    if (record)
    {
        /* si l'opération n'est pas visible on sort */
        if ( ( record -> mother_row && record -> mother_row -> filtered_pos == -1 )
         ||
         record -> filtered_pos == -1 )
        {
            custom_list -> selected_row = NULL;
            return;
        }

        /* get the path of the row */
        path = gtk_tree_path_new ();
        if (record -> mother_row)
            /* it's a child, need to get the path of the mother */
            gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);

        gtk_tree_path_append_index (path, record -> filtered_pos);

        for (i=0 ; i < custom_list -> nb_rows_by_transaction ; i++)
        {
            record -> row_bg = record -> row_bg_save;
            record -> row_bg_save = NULL;

            /* inform the world that the row has changed */
            iter.user_data = record;
            gtk_tree_model_row_changed(GTK_TREE_MODEL(custom_list), path, &iter);

            /* if the selection was a child, we stop now, only 1 line */
            if (record -> mother_row)
            break;

            /* go to the next row of the transaction */
            record = custom_list -> visibles_rows [record -> filtered_pos + 1];
            gtk_tree_path_next (path);
        }
        gtk_tree_path_free (path);
    }
    custom_list -> selected_row = NULL;
}
예제 #19
0
static void
report_row_contents_changed (FMTreeModel *model, GtkTreeIter *iter)
{
	GtkTreePath *path;

	path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), iter);
	gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
	gtk_tree_path_free (path);
}
예제 #20
0
static gboolean
main_window_flash_foreach (GtkTreeModel *model,
			   GtkTreePath  *path,
			   GtkTreeIter  *iter,
			   gpointer      user_data)
{
	FlashForeachData *data = (FlashForeachData *) user_data;
	EmpathyContact   *contact;
	const gchar      *icon_name;
	GtkTreePath      *parent_path = NULL;
	GtkTreeIter       parent_iter;
	GdkPixbuf        *pixbuf = NULL;

	/* To be used with gtk_tree_model_foreach, update the status icon
	 * of the contact to show the event icon (on=TRUE) or the presence
	 * (on=FALSE) */
	gtk_tree_model_get (model, iter,
			    EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
			    -1);

	if (contact != data->event->contact) {
		if (contact) {
			g_object_unref (contact);
		}
		return FALSE;
	}

	if (data->on) {
		icon_name = data->event->icon_name;
		pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
	} else {
		pixbuf = contact_list_store_get_contact_status_icon (
						data->window->list_store,
						contact);
	}

	gtk_tree_store_set (GTK_TREE_STORE (model), iter,
			    EMPATHY_CONTACT_LIST_STORE_COL_ICON_STATUS, pixbuf,
			    -1);

	/* To make sure the parent is shown correctly, we emit
	 * the row-changed signal on the parent so it prompts
	 * it to be refreshed by the filter func.
	 */
	if (gtk_tree_model_iter_parent (model, &parent_iter, iter)) {
		parent_path = gtk_tree_model_get_path (model, &parent_iter);
	}
	if (parent_path) {
		gtk_tree_model_row_changed (model, parent_path, &parent_iter);
		gtk_tree_path_free (parent_path);
	}

	g_object_unref (contact);

	return FALSE;
}
예제 #21
0
void
xml_tree_model_add_xmldoc(xmlTreeModel * model, xmlDocPtr xmldoc) {
	g_return_if_fail (XML_IS_TREE_MODEL(model));
	g_return_if_fail (xmldoc != NULL);

	GtkTreeIter   iter;
	model->xmldoc = xmldoc;
	gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter);
	gtk_tree_model_row_changed(GTK_TREE_MODEL(model),gtk_tree_path_new_first(), &iter);
	g_signal_emit(model, xml_tree_model_signals[XML_TREE_MODEL_CHANGED],0,NULL);
}
예제 #22
0
void gTreeRow::update()
{
	GtkTreePath *path;
	
	path=gtk_tree_model_get_path(GTK_TREE_MODEL(tree->store),dataiter);
	if (path)
	{
		gtk_tree_model_row_changed (GTK_TREE_MODEL(tree->store),path,dataiter);
		gtk_tree_path_free(path);
	}
}
예제 #23
0
파일: dismodel.c 프로젝트: bpeel/eek
static void
dis_model_refresh_rows (DisModel *model)
{
  int row_num, got_bytes = 0;
  DisModelRowData row;
  guint16 address = model->address;
  GtkTreePath *path;
  GtkTreeIter iter;

  path = gtk_tree_path_new_first ();

  for (row_num = 0; row_num < DIS_MODEL_ROW_COUNT; row_num++)
  {
    if (model->electron == NULL)
    {
      row.address = 0;
      row.num_bytes = 0;
      row.mnemonic[0] = '\0';
      row.operands[0] = '\0';
      row.current = FALSE;
    }
    else
    {
      while (got_bytes < DISASSEMBLE_MAX_BYTES)
      {
        row.bytes[got_bytes] = electron_read_from_location (model->electron->data,
                                                            address + got_bytes);
        got_bytes++;
      }
      row.address = address;
      row.num_bytes = disassemble_instruction (address, row.bytes, row.mnemonic, row.operands);
      row.current = model->electron->data->cpu.pc == address ? TRUE : FALSE;
    }

    /* Only fire the changed signal if the row is actually different */
    if (row.address != model->rows[row_num].address
        || row.num_bytes != model->rows[row_num].num_bytes
        || memcmp (row.bytes, model->rows[row_num].bytes, row.num_bytes)
        || row.current != model->rows[row_num].current)
    {
      model->rows[row_num] = row;
      gtk_tree_path_get_indices (path)[0] = row_num;
      iter.user_data = GINT_TO_POINTER (row_num);
      iter.stamp = model->iter_stamp;
      gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
    }

    memmove (row.bytes, row.bytes + row.num_bytes, got_bytes = DISASSEMBLE_MAX_BYTES - row.num_bytes);
    address += row.num_bytes;
  }

  gtk_tree_path_free (path);
}
예제 #24
0
static void
object_updated_cb(Object_t *obj, gpointer data)
{
  Selection_t *selection = (Selection_t*) data;
  GtkTreeIter iter;

  if (selection_find_object (selection, obj, &iter)) {
    GtkTreePath *path;

    path = gtk_tree_model_get_path (GTK_TREE_MODEL (selection->store), &iter);
    gtk_tree_model_row_changed (GTK_TREE_MODEL (selection->store), path,
				&iter);
  }
}
예제 #25
0
/**
 * select the transaction by the record
 * static function
 *
 * \param record	the CustomRecord to select
 *
 * \return TRUE ok, FALSE problem
 * */
static gboolean transaction_list_select_record ( CustomRecord *record )
{
    GtkTreePath *path;
    GtkTreeIter iter;
    gint i;
    gint selected_transaction;
    CustomList *custom_list;

    custom_list = transaction_model_get_model ();

    g_return_val_if_fail ( custom_list != NULL, FALSE );
    g_return_val_if_fail ( record != NULL, FALSE );

    /* get the transaction number */
    selected_transaction = gsb_data_transaction_get_transaction_number (record -> transaction_pointer);

    /* record is the first row of the transaction to select */
    custom_list -> selected_row = record;

    /* get the path of the row we want to select */
    path = gtk_tree_path_new ();
    if ( record -> mother_row )
        /* it's a child, need to get the path of the mother */
        gtk_tree_path_append_index (path, record -> mother_row -> filtered_pos);

    gtk_tree_path_append_index (path, record -> filtered_pos);

    /* colorize the record */
    for (i=0 ; i < custom_list -> nb_rows_by_transaction ; i++)
    {
	record -> row_bg_save = record -> row_bg;
	record -> row_bg = gsb_rgba_get_couleur ( "couleur_selection" );

	/* inform the world that the row has changed */
	iter.user_data = record;
	gtk_tree_model_row_changed(GTK_TREE_MODEL(custom_list), path, &iter);

	/* if the selection was a child, we stop now, only 1 line */
	if (record -> mother_row)
	    break;

	/* go to the next row of the transaction */
	record = custom_list -> visibles_rows [record -> filtered_pos + 1];
	gtk_tree_path_next (path);
    }

    /** update account and other stuff */
    gsb_transactions_list_selection_changed (selected_transaction);
    return TRUE;
}
예제 #26
0
void
egg_column_model_set_column_visible (EggColumnModel *model, GtkTreeIter *iter, gboolean visible)
{
  GtkTreeViewColumn *column;
  GtkTreePath *path;

  path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), iter);

  column = (GtkTreeViewColumn *)((GList *)iter->user_data)->data;

  gtk_tree_view_column_set_visible (column, visible);
  gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);

  gtk_tree_path_free (path);
}
예제 #27
0
static void
row_updated (EDateTimeList *date_time_list,
             gint n)
{
	GtkTreePath *path;
	GtkTreeIter  iter;

	path = gtk_tree_path_new ();
	gtk_tree_path_append_index (path, n);

	if (gtk_tree_model_get_iter (GTK_TREE_MODEL (date_time_list), &iter, path))
		gtk_tree_model_row_changed (GTK_TREE_MODEL (date_time_list), path, &iter);

	gtk_tree_path_free (path);
}
예제 #28
0
static void reload_thumbnail(FmFolderModel* model, GSequenceIter* seq_it, FmFolderItem* item)
{
    GtkTreeIter it;
    GtkTreePath* tp;
    if(item->is_thumbnail)
    {
        g_object_unref(item->icon);
        item->icon = NULL;
        it.stamp = model->stamp;
        it.user_data = seq_it;
        tp = fm_folder_model_get_path(GTK_TREE_MODEL(model), &it);
        gtk_tree_model_row_changed(GTK_TREE_MODEL(model), tp, &it);
        gtk_tree_path_free(tp);
    }
}
예제 #29
0
void reload_icons(FmFolderModel* model, enum ReloadFlags flags)
{
    /* reload icons */
    GSequenceIter* it = g_sequence_get_begin_iter(model->items);
    GtkTreePath* tp = gtk_tree_path_new_from_indices(0, -1);

    if(model->thumbnail_requests)
    {
        g_list_foreach(model->thumbnail_requests, (GFunc)fm_thumbnail_request_cancel, NULL);
        g_list_free(model->thumbnail_requests);
        model->thumbnail_requests = NULL;
    }

    for( ; !g_sequence_iter_is_end(it); it = g_sequence_iter_next(it) )
    {
        FmFolderItem* item = (FmFolderItem*)g_sequence_get(it);
        if(item->icon)
        {
            GtkTreeIter tree_it = {0};
            if((flags & RELOAD_ICONS && !item->is_thumbnail) ||
               (flags & RELOAD_THUMBNAILS && item->is_thumbnail))
            {
                g_object_unref(item->icon);
                item->icon = NULL;
                item->is_thumbnail = FALSE;
                item->thumbnail_loading = FALSE;
                tree_it.stamp = model->stamp;
                tree_it.user_data = it;
                gtk_tree_model_row_changed(GTK_TREE_MODEL(model), tp, &tree_it);
            }
        }
        gtk_tree_path_next(tp);
    }
    gtk_tree_path_free(tp);

    it = g_sequence_get_begin_iter(model->hidden);
    for( ; !g_sequence_iter_is_end(it); it = g_sequence_iter_next(it) )
    {
        FmFolderItem* item = (FmFolderItem*)g_sequence_get(it);
        if(item->icon)
        {
            g_object_unref(item->icon);
            item->icon = NULL;
            item->is_thumbnail = FALSE;
            item->thumbnail_loading = FALSE;
        }
    }
}
예제 #30
0
static void
gimp_component_editor_renderer_update (GimpViewRenderer    *renderer,
                                       GimpComponentEditor *editor)
{
  GimpChannelType channel = GIMP_VIEW_RENDERER_IMAGE (renderer)->channel;
  GtkTreeIter     iter;

  if (gimp_component_editor_get_iter (editor, channel, &iter))
    {
      GtkTreePath *path;

      path = gtk_tree_model_get_path (editor->model, &iter);
      gtk_tree_model_row_changed (editor->model, path, &iter);
      gtk_tree_path_free (path);
    }
}