Exemplo n.º 1
0
static void
history_item_update_cb (GlobalHistory *gh, 
		        HistoryItem *item,
		        HistoryDialog *dialog)
{
	GtkTreeIter *host_iter, *iter;
	HistoryItem *host;

	host = global_history_get_host_from_site (dialog->priv->gh,
		  				  item);
		
	host_iter = history_dialog_find_host_iter (dialog, host);

	if (host_iter)
	{
		iter = history_dialog_find_site_iter (dialog, host_iter, item);
		if (iter)
		{
			history_dialog_update_host_item (dialog, host, host_iter);
			history_dialog_update_url_item (dialog, item, iter);
			gtk_tree_iter_free (iter);
		}
		gtk_tree_iter_free (host_iter);
	}
	
}
Exemplo n.º 2
0
static void
log_changed_cb (LogviewLog *log,
                gpointer user_data)
{
  LogviewLoglist *list = user_data;
  LogviewLog *active;
  GtkTreeIter *iter;

  active = logview_manager_get_active_log (list->priv->manager);

  if (log == active) {
    g_object_unref (active);
    return;
  }

  iter = logview_loglist_find_log (list, log);

  if (!iter) {
    return;
  }

  /* make the log bold in the list */
  gtk_tree_store_set (list->priv->model, iter,
                      LOG_WEIGHT, PANGO_WEIGHT_BOLD,
                      LOG_WEIGHT_SET, TRUE, -1);

  gtk_tree_iter_free (iter);
}
Exemplo n.º 3
0
static void
history_dialog_fill_view (HistoryDialog *dialog) 
{
	GList *list, *l;
	GtkTreeIter *iter;
	
	list = global_history_get_host_list (dialog->priv->gh);

	for (l = list; l != NULL; l = l->next)
	{
		GList *urls;
		HistoryItem *item = (HistoryItem *)(l->data);

		urls = global_history_get_urls_list (dialog->priv->gh,
						     item, 
						     &dialog->priv->filter);
		if (urls)
		{	
			iter = history_dialog_add_host_item (dialog,
							     item);
			history_dialog_add_url_items (dialog, urls, iter);
			g_list_free (urls);

			if (iter)
			{
				gtk_tree_iter_free (iter);
			}
		}
	}

	g_list_free (list);
}
Exemplo n.º 4
0
static void
history_item_add_cb (GlobalHistory *gh, 
		     HistoryItem *item,
		     HistoryDialog *dialog)
{
	GtkTreeIter *iter;
	HistoryItem *host;
	GList *urls_list;
	gboolean empty_list;
	
	host = global_history_get_host_from_site (dialog->priv->gh,
	  				          item);

	/* ignore urls that doesnt match current filter */
	urls_list = global_history_get_urls_list (dialog->priv->gh,
						  host,
						  &dialog->priv->filter);
	empty_list = !g_list_find (urls_list, item);
	g_list_free (urls_list);
	if (empty_list) return;
	
	iter = history_dialog_find_host_iter (dialog, host);
	if (!iter)
	{
		iter = history_dialog_add_host_item (dialog, 
						     host);
	}

	history_dialog_add_url_item (dialog, item, iter);

	if (iter)
	{
		gtk_tree_iter_free (iter);
	}
}
Exemplo n.º 5
0
static void
manager_log_closed_cb (LogviewManager *manager,
                       LogviewLog *log,
                       gpointer user_data)
{
  LogviewLoglist *list = user_data;
  GtkTreeIter *iter;
  gboolean res;

  iter = logview_loglist_find_log (list, log);

  if (!iter) {
    return;
  }

  g_signal_handlers_disconnect_by_func (log, log_changed_cb, list);

  res = gtk_tree_store_remove (list->priv->model, iter);
  if (res) {
    GtkTreeSelection *selection;

    /* iter now points to the next valid row */
    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
    gtk_tree_selection_select_iter (selection, iter);
  } else {
    /* FIXME: what shall we do here? */
  }

  gtk_tree_iter_free (iter);
}
Exemplo n.º 6
0
static void
handle_channel_deletes (ReaderEngine *engine,
                        gint sub)
{
	gchar *query;
	const gchar *subject;
	GtkTreeIter *iter;
	TrackerSparqlCursor *cursor;
	ReaderEnginePrivate *priv;

	priv = reader_engine_get_instance_private (engine);

	query = g_strdup_printf ("SELECT tracker:uri(%d) {}", sub);
	cursor = tracker_sparql_connection_query (priv->tracker, query, NULL, NULL);
	tracker_sparql_cursor_next (cursor, NULL, NULL);
	subject = tracker_sparql_cursor_get_string (cursor, 0, NULL);

	if (find_in_model (GTK_TREE_MODEL (priv->data), GD_MAIN_COLUMN_ID, subject, &iter)) {
		remove_channel_data (GTK_TREE_MODEL (priv->data), iter);
		gtk_list_store_remove (priv->data, iter);
		gtk_tree_iter_free (iter);
	}

	g_free (query);
	g_object_unref (cursor);
}
Exemplo n.º 7
0
/**
 * ag_chart_edit_country_changed_cb:
 * @country: the #GtkSearchEntry for country search
 * @chart_edit: the #AgChartEdit in which the event happens
 *
 * This function is called whenever the text in the country search entry is
 * changed.
 */
static void
ag_chart_edit_country_changed_cb(GtkSearchEntry *country,
                                 AgChartEdit    *chart_edit)
{
    struct cc_search search;
    GET_PRIV(chart_edit);

    search.target   = gtk_entry_get_text(GTK_ENTRY(country));
    search.ret_iter = NULL;

    gtk_tree_model_foreach(
            country_list,
            (GtkTreeModelForeachFunc)ag_chart_edit_find_country,
            &search
        );

    g_free(priv->selected_country);

    if (search.ret_iter != NULL) {
        g_debug("Country (entry-changed): %s", search.ret_code);
        gtk_tree_iter_free(search.ret_iter);
        priv->selected_country = search.ret_code;
    } else {
        priv->selected_country = NULL;
    }
}
Exemplo n.º 8
0
static void
filter_result_callback_data_free (FilterResultCallbackData *data)
{
  g_object_unref (data->self);
  g_object_unref (data->account);
  gtk_tree_iter_free (data->iter);
  g_slice_free (FilterResultCallbackData, data);
}
static void
fill_ppds_list (PpPPDSelectionDialog *dialog)
{
  GtkTreeSelection *selection;
  GtkListStore     *store;
  GtkTreePath      *path;
  GtkTreeView      *treeview;
  GtkTreeIter       iter;
  GtkTreeIter      *preselect_iter = NULL;
  GtkWidget        *widget;
  gint              i;

  widget = (GtkWidget*)
    gtk_builder_get_object (dialog->builder, "ppd-spinner");
  gtk_widget_hide (widget);
  gtk_spinner_stop (GTK_SPINNER (widget));

  widget = (GtkWidget*)
    gtk_builder_get_object (dialog->builder, "progress-label");
  gtk_widget_hide (widget);

  treeview = (GtkTreeView*)
    gtk_builder_get_object (dialog->builder, "ppd-selection-manufacturers-treeview");

  if (dialog->list)
    {
      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);

      for (i = 0; i < dialog->list->num_of_manufacturers; i++)
        {
          gtk_list_store_append (store, &iter);
          gtk_list_store_set (store, &iter,
                              PPD_MANUFACTURERS_NAMES_COLUMN, dialog->list->manufacturers[i]->manufacturer_name,
                              PPD_MANUFACTURERS_DISPLAY_NAMES_COLUMN, dialog->list->manufacturers[i]->manufacturer_display_name,
                              -1);

          if (g_strcmp0 (dialog->manufacturer,
                         dialog->list->manufacturers[i]->manufacturer_display_name) == 0)
            {
              preselect_iter = gtk_tree_iter_copy (&iter);
            }
        }

      gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));

      if (preselect_iter &&
          (selection = gtk_tree_view_get_selection (treeview)) != NULL)
        {
          gtk_tree_selection_select_iter (selection, preselect_iter);
          path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), preselect_iter);
          gtk_tree_view_scroll_to_cell (treeview, path, NULL, TRUE, 0.5, 0.0);
          gtk_tree_path_free (path);
          gtk_tree_iter_free (preselect_iter);
        }

      g_object_unref (store);
    }
}
Exemplo n.º 10
0
/**
 * Move account in list depending on direction and selected account
 */
static void
account_move(gboolean move_up, gpointer data)
{
    // Get view, model and selection of account
    GtkTreeView *tree_view = GTK_TREE_VIEW(data);
    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);
    GtkTreeIter *iter_copy;
    iter_copy = gtk_tree_iter_copy(&iter);

    // Find path of iteration
    gchar *path = gtk_tree_model_get_string_from_iter(model, &iter);

    // The first real account in the list can't move up because of the IP2IP account
    // It can still move down though
    if (g_strcmp0(path, "1") == 0 && move_up)
        return;

    GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
    gint *indices = gtk_tree_path_get_indices(tree_path);
    const gint pos = indices[0] - 1; /* black magic : gtk tree order is not account queue order */

    // Depending on button direction get new path
    if (move_up)
        gtk_tree_path_prev(tree_path);
    else
        gtk_tree_path_next(tree_path);

    gtk_tree_model_get_iter(model, &iter, tree_path);

    // Swap iterations if valid
    if (gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter))
        gtk_list_store_swap(GTK_LIST_STORE(model), &iter, iter_copy);

    // Scroll to new position
    gtk_tree_view_scroll_to_cell(tree_view, tree_path, NULL, FALSE, 0, 0);

    // Free resources
    gtk_tree_path_free(tree_path);
    gtk_tree_iter_free(iter_copy);
    g_free(path);

    // Perpetuate changes in account queue
    if (move_up)
        account_list_move_up(pos);
    else
        account_list_move_down(pos);

    // Set the order in the configuration file
    gchar *ordered_account_list = account_list_get_ordered_list();
    dbus_set_accounts_order(ordered_account_list);
    g_free(ordered_account_list);
}
Exemplo n.º 11
0
static void status_icon_info_delete (gpointer data)
{
  g_return_if_fail (data != NULL);
  StatusIconInfo *info = (StatusIconInfo*) data;

  gtk_tree_iter_free (info->iter);

  delete info;
}
Exemplo n.º 12
0
static void
pass_channels (ReaderEngine *engine,
               TrackerSparqlCursor *cursor)
{
	const gchar *subject;
	const gchar *title;
	const gchar *url;
	gint64 unread;
	GtkTreeModel *model;
	GtkTreeIter *iter;
	GtkTreeIter iter2;
	GtkTreeStore *items_model;
	GdkPixbuf *icon;
	ReaderEnginePrivate *priv;

	if (cursor != NULL) {
		priv = reader_engine_get_instance_private (engine);
		model = GTK_TREE_MODEL (priv->data);

		while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
			subject = tracker_sparql_cursor_get_string (cursor, 0, NULL);
			title = tracker_sparql_cursor_get_string (cursor, 1, NULL);
			unread = tracker_sparql_cursor_get_integer (cursor, 2);
			url = tracker_sparql_cursor_get_string (cursor, 4, NULL);

			if (find_in_model (model, GD_MAIN_COLUMN_ID, subject, &iter)) {
				gtk_list_store_set (GTK_LIST_STORE (model), iter,
							GD_MAIN_COLUMN_PRIMARY_TEXT, title,
							EXTRA_COLUMN_UNREADS, unread, -1);
				gtk_tree_iter_free (iter);
			}
			else {
				items_model = gtk_tree_store_new (ITEM_COLUMN_LAST,
				                                  G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
				                                  G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING);

				g_signal_connect (items_model, "row-changed", G_CALLBACK (model_item_changed), engine);

				icon = get_icon_for_channel (tracker_sparql_cursor_get_string (cursor, 3, NULL));

				gtk_list_store_append (GTK_LIST_STORE (model), &iter2);
				gtk_list_store_set (GTK_LIST_STORE (model), &iter2,
				                    GD_MAIN_COLUMN_ID, subject,
				                    GD_MAIN_COLUMN_PRIMARY_TEXT, title,
				                    GD_MAIN_COLUMN_ICON, icon,
				                    EXTRA_COLUMN_UNREADS, unread,
				                    EXTRA_COLUMN_URL, url,
				                    EXTRA_COLUMN_FEEDS_MODEL, items_model, -1);
			}

			collect_items (engine, subject, NULL);
		}

		g_object_unref (cursor);
	}
}
Exemplo n.º 13
0
static void
codec_moved_cb (GtkWidget *widget, 
                gpointer data)
{ 	
  CodecsBox *self = NULL;

  GtkTreeIter iter;
  GtkTreeIter *iter2 = NULL;
  GtkTreeModel *model = NULL;
  GtkTreeSelection *selection = NULL;
  GtkTreePath *tree_path = NULL;

  std::list<std::string> list;

  gchar *path_str = NULL;

  self = CODECS_BOX (data);

  model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list));
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->codecs_list));
  if (!gtk_tree_selection_get_selected (GTK_TREE_SELECTION (selection), 
                                        NULL, &iter))
    return;

  /* Update the tree view */
  iter2 = gtk_tree_iter_copy (&iter);
  path_str = gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL (model), 
                                                  &iter);
  tree_path = gtk_tree_path_new_from_string (path_str);
  if (!g_strcmp0 ((gchar *) g_object_get_data (G_OBJECT (widget), "operation"), 
               "up"))
    gtk_tree_path_prev (tree_path);
  else
    gtk_tree_path_next (tree_path);

  gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, tree_path);
  if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), &iter)
      && gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), iter2))
    gtk_list_store_swap (GTK_LIST_STORE (model), &iter, iter2);

  /* Scroll to the new position */
  gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (self->priv->codecs_list), 
                                tree_path, NULL, FALSE, 0, 0);

  gtk_tree_path_free (tree_path);
  gtk_tree_iter_free (iter2);
  g_free (path_str);

  /* Update the key */
  list = codecs_box_to_list (self);
  if (self->priv->type == Ekiga::Call::Audio)
    self->priv->audio_settings->set_string_list ("media-list", list);
  else if (self->priv->type == Ekiga::Call::Video)
    self->priv->video_settings->set_string_list ("media-list", list);
}
Exemplo n.º 14
0
static void
update_openfiles_dialog (GsmTreeView *tree)
{
    ProcInfo *info;
    GtkTreeModel *model;
    glibtop_open_files_entry *openfiles;
    glibtop_proc_open_files procmap;
    GHashTable *new_maps;
    guint i;

    pid_t pid = GPOINTER_TO_UINT(static_cast<pid_t*>(g_object_get_data (G_OBJECT (tree), "selected_info")));
    info = GsmApplication::get()->processes.find(pid);


    if (!info)
        return;

    model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));

    openfiles = glibtop_get_proc_open_files (&procmap, info->pid);

    if (!openfiles)
        return;

    new_maps = static_cast<GHashTable *>(g_hash_table_new_full (g_str_hash, compare_open_files,
                                                                NULL, NULL));
    for (i=0; i < procmap.number; i++)
        g_hash_table_insert (new_maps, openfiles + i, openfiles + i);

    gtk_tree_model_foreach (model, classify_openfiles, new_maps);

    g_hash_table_foreach (new_maps, add_new_files, model);

    while (old_maps) {
        GtkTreeIter *iter = static_cast<GtkTreeIter*>(old_maps->data);
        glibtop_open_files_entry *openfiles = NULL;

        gtk_tree_model_get (model, iter,
                            COL_OPENFILE_STRUCT, &openfiles,
                            -1);

        gtk_list_store_remove (GTK_LIST_STORE (model), iter);
        gtk_tree_iter_free (iter);
        g_free (openfiles);

        old_maps = g_list_next (old_maps);

    }

    g_hash_table_destroy (new_maps);
    g_free (openfiles);
}
Exemplo n.º 15
0
void __new_req_populate_ca_treeview (GtkTreeView *treeview)
{
	GtkCellRenderer * renderer = NULL;
        __NewReqWindowRefreshModelAddCaUserData pdata;

	guint column_number;

	new_req_ca_list_model = gtk_tree_store_new (NEW_REQ_CA_MODEL_COLUMN_NUMBER, G_TYPE_UINT64, G_TYPE_STRING, G_TYPE_STRING,
						    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

        pdata.new_model = new_req_ca_list_model;
        pdata.last_parent_iter = NULL;
        pdata.last_ca_iter = NULL;

	ca_file_foreach_ca (__new_req_window_refresh_model_add_ca, &pdata);

        if (pdata.last_parent_iter)
                gtk_tree_iter_free (pdata.last_parent_iter);

        if (pdata.last_ca_iter)
                gtk_tree_iter_free (pdata.last_ca_iter);

	g_dataset_destroy (new_req_ca_list_model);

	renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new());

	column_number = gtk_tree_view_insert_column_with_attributes (treeview,
								     -1, _("Subject"), renderer,
								     "markup", NEW_REQ_CA_MODEL_COLUMN_SUBJECT,
								     NULL);

	
	gtk_tree_view_set_model (treeview, GTK_TREE_MODEL(new_req_ca_list_model));

	gtk_tree_view_expand_all (treeview);

	return;

}
Exemplo n.º 16
0
static void
gimp_int_store_finalize (GObject *object)
{
  GimpIntStore *store = GIMP_INT_STORE (object);

  if (store->empty_iter)
    {
      gtk_tree_iter_free (store->empty_iter);
      store->empty_iter = NULL;
    }

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
photos_organize_collection_model_object_removed (PhotosBaseManager *manager, GObject *object, gpointer user_data)
{
  PhotosOrganizeCollectionModel *self = PHOTOS_ORGANIZE_COLLECTION_MODEL (user_data);
  GtkTreeIter *iter;

  iter = photos_organize_collection_model_find_collection_iter (self, PHOTOS_BASE_ITEM (object));
  if (iter == NULL)
    return;

  gtk_list_store_remove (GTK_LIST_STORE (self), iter);
  gtk_tree_iter_free (iter);
}
Exemplo n.º 18
0
static void
ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
{
	/* Add preferences */
	SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (ipref);
	GtkCellRenderer* renderer_name = gtk_cell_renderer_text_new ();
	GtkCellRenderer* renderer_desc = gtk_cell_renderer_text_new ();
	GtkTreeIter* iter = NULL;
	GError* error = NULL;
	builder = gtk_builder_new ();
	if (!gtk_builder_add_from_file(builder, PREFS_GLADE, &error))
	{
		DEBUG_PRINT ("Could load sourceview preferences: %s", error->message);
		g_error_free (error);
		return;
	}
	anjuta_preferences_add_from_builder (prefs,
	                                     builder,
	                                     plugin->settings,
	                                     "Editor",
	                                     _("GtkSourceView Editor"),
	                                     ICON_FILE);

	plugin->check_font = GTK_WIDGET (gtk_builder_get_object (builder,
	                                                         FONT_USE_THEME_BUTTON));
	g_signal_connect(G_OBJECT(plugin->check_font), "toggled",
	                 G_CALLBACK(on_font_check_toggled), builder);
	on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), builder);

	/* Init styles combo */
	plugin->combo_styles = GTK_WIDGET (gtk_builder_get_object (builder, COMBO_STYLES));
	gtk_combo_box_set_model (GTK_COMBO_BOX (plugin->combo_styles),
							 create_style_model(plugin->settings, &iter));
	g_signal_connect (plugin->combo_styles, "changed", G_CALLBACK (on_style_changed), plugin);

	gtk_cell_layout_clear (GTK_CELL_LAYOUT(plugin->combo_styles));
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name, TRUE);
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc, FALSE);
	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name,
								   "text", COLUMN_NAME);
	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc,
								   "text", COLUMN_DESC);
	g_object_set (renderer_desc,
				  "style", PANGO_STYLE_ITALIC, NULL);
	if (iter)
	{
		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (plugin->combo_styles),
									   iter);
		gtk_tree_iter_free (iter);
	}
}
Exemplo n.º 19
0
static void
history_item_remove_cb (GlobalHistory *gh, 
		        HistoryItem *item,
		        HistoryDialog *dialog)
{
	GtkTreeIter *host_iter, *iter;
	HistoryItem *host;
	GList *urls_list;
	gboolean remove_parent;
	
	host = global_history_get_host_from_site (dialog->priv->gh,
		  				  item);
	
	urls_list = global_history_get_urls_list (dialog->priv->gh,
						  host,
						  &dialog->priv->filter);
	
	remove_parent = (g_list_length (urls_list) == 1);
	g_list_free (urls_list);
	
	host_iter = history_dialog_find_host_iter (dialog, host);
	if (host_iter)
	{
		iter = history_dialog_find_site_iter (dialog, host_iter, item);
		if (iter)
		{
			history_dialog_remove_item (dialog, item, iter);
			gtk_tree_iter_free (iter);
		}

		if (remove_parent)
		{
			history_dialog_remove_item (dialog, item, iter);
		}
			
		gtk_tree_iter_free (host_iter);
	}
}
Exemplo n.º 20
0
void
logview_loglist_update_lines (LogviewLoglist *loglist, LogviewLog *log)
{
  GSList *days;
  GtkTreeIter *parent;

  g_assert (LOGVIEW_IS_LOGLIST (loglist));
  g_assert (LOGVIEW_IS_LOG (log));

  days = logview_log_get_days_for_cached_lines (log);
  parent = logview_loglist_find_log (loglist, log);
  update_days_and_lines_for_log (loglist, parent, days);

  gtk_tree_iter_free (parent);
}
Exemplo n.º 21
0
static void
history_dialog_add_url_item (HistoryDialog *dialog,
			     HistoryItem *item,
			     GtkTreeIter *parent_iter)
{
	GtkTreeIter iter;
	GtkTreeIter *tmp;
	gtk_tree_store_insert (GTK_TREE_STORE (dialog->priv->model), 
                               &iter,
                               parent_iter,
                               0);
	
	tmp = gtk_tree_iter_copy (&iter);
	history_dialog_update_url_item (dialog, item, tmp);
 	gtk_tree_iter_free (tmp);
}
Exemplo n.º 22
0
static void
gimp_int_store_row_inserted (GtkTreeModel *model,
                             GtkTreePath  *path,
                             GtkTreeIter  *iter)
{
  GimpIntStore *store = GIMP_INT_STORE (model);

  if (parent_iface->row_inserted)
    parent_iface->row_inserted (model, path, iter);

  if (store->empty_iter &&
      memcmp (iter, store->empty_iter, sizeof (GtkTreeIter)))
    {
      gtk_list_store_remove (GTK_LIST_STORE (store), store->empty_iter);
      gtk_tree_iter_free (store->empty_iter);
      store->empty_iter = NULL;
    }
}
static void 
xfce_cell_renderer_pixbuf_on_demand_finalize(GObject *object)
{
	XfceCellRendererPixbufOnDemand *aXfceCellRendererPixbufOnDemand;
	XfceCellRendererPixbufOnDemandPrivate *priv;

	g_return_if_fail(object != NULL);
	g_return_if_fail(IS_XFCE_CELL_RENDERER_PIXBUF_ON_DEMAND(object));

	aXfceCellRendererPixbufOnDemand = XFCE_CELL_RENDERER_PIXBUF_ON_DEMAND(object);
	priv = aXfceCellRendererPixbufOnDemand->priv;
	
	if (priv->iter) {
		gtk_tree_iter_free (priv->iter);
		priv->iter = NULL;
	}

	if (priv->pixbuf) {
		g_object_unref (G_OBJECT (priv->pixbuf));
		priv->pixbuf = NULL;
	}
	
	if (priv->fallback_pixbuf) {
		g_object_unref (G_OBJECT (priv->fallback_pixbuf));
		priv->fallback_pixbuf = NULL;
	}

	if (priv->path) {
		g_free (priv->path);
		priv->path = NULL;
	}

#if 0
	if (priv->dummypix) {
		g_object_unref (G_OBJECT (priv->dummypix));
		priv->dummypix = NULL;
	}
#endif
	
	if (G_OBJECT_CLASS(parent_class)->finalize)
	        (* G_OBJECT_CLASS(parent_class)->finalize)(object);

	g_free(priv);
}
Exemplo n.º 24
0
static void
manager_active_changed_cb (LogviewManager *manager,
                           LogviewLog *log,
                           LogviewLog *old_log,
                           gpointer user_data)
{
  LogviewLoglist *list = user_data;
  GtkTreeIter * iter, sel_iter;
  GtkTreeSelection * selection;

  if (list->priv->selection && 
      gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->model),
                               &sel_iter, list->priv->selection))
  {
    Day *day;

    iter = gtk_tree_iter_copy (&sel_iter);

    gtk_tree_model_get (GTK_TREE_MODEL (list->priv->model), iter,
                        LOG_DAY, &day, -1);

    if (day) {
      g_signal_emit (list, signals[DAY_SELECTED], 0, day, NULL);
    }

    gtk_tree_path_free (list->priv->selection);
    list->priv->selection = NULL;
  } else {
    iter = logview_loglist_find_log (list, log);
  }

  if (!iter) {
    return;
  }

  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
  g_signal_handlers_block_by_func (selection, tree_selection_changed_cb, list);

  gtk_tree_selection_select_iter (selection, iter);

  g_signal_handlers_unblock_by_func (selection, tree_selection_changed_cb, list);
  gtk_tree_iter_free (iter);
}
static void
photos_organize_collection_model_fetch_collection_state_executed (GHashTable *collection_state, gpointer user_data)
{
  PhotosOrganizeCollectionModel *self = PHOTOS_ORGANIZE_COLLECTION_MODEL (user_data);
  GHashTableIter collection_state_iter;
  const gchar *idx;
  gpointer value;

  photos_organize_collection_model_remove_placeholder (self);

  g_hash_table_iter_init (&collection_state_iter, collection_state);
  while (g_hash_table_iter_next (&collection_state_iter, (gpointer) &idx, (gpointer) &value))
    {
      GtkTreeIter *iter;
      PhotosBaseItem *collection;
      gint state = GPOINTER_TO_INT (value);

      if (state & PHOTOS_COLLECTION_STATE_HIDDEN)
        continue;

      collection = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id (self->priv->manager, idx));
      iter = photos_organize_collection_model_find_collection_iter (self, collection);
      if (iter == NULL)
        {
          GtkTreeIter tmp;

          gtk_list_store_append (GTK_LIST_STORE (self), &tmp);
          iter = gtk_tree_iter_copy (&tmp);
        }

      gtk_list_store_set (GTK_LIST_STORE (self),
                          iter,
                          PHOTOS_ORGANIZE_MODEL_ID, idx,
                          PHOTOS_ORGANIZE_MODEL_NAME, photos_base_item_get_name (collection),
                          PHOTOS_ORGANIZE_MODEL_STATE, state,
                          -1);
      gtk_tree_iter_free (iter);
    }

  g_object_unref (self);
}
Exemplo n.º 26
0
gTreeRow::~gTreeRow()
{
	GList *iter=NULL;
	
	if (tree->onRemove)
		(*tree->onRemove)(tree, _key);
	
	if (dataiter) gtk_tree_iter_free(dataiter);
	if (data) iter=g_list_first(data);
	
	while (iter)
	{
		delete (gTreeCell*)iter->data;
		iter=g_list_next(iter);
	}
	
	if (data) g_list_free(data);
	
	//fprintf(stderr, "free key: (%p) %s\n", _key, _key);
	g_free(_key);
}
Exemplo n.º 27
0
char *gTreeRow::parent()
{
	GtkTreeIter *iter = gtk_tree_iter_copy(dataiter);
	char *key;
	//GtkTreePath* path;
	
	if (!gtk_tree_model_iter_parent(GTK_TREE_MODEL(tree->store), iter, dataiter))
		key = NULL;
	else
		key = tree->iterToKey(iter);
	
	gtk_tree_iter_free(iter);
	return key;
	
	/*path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree->store), dataiter);
	if (!path)
		return NULL;
	
	if (!gtk_tree_path_up(path))
		return NULL;
		
	return tree->pathToKey(path);*/
}
Exemplo n.º 28
0
static void device_changed (GtkTreeModel *model,
			     GtkTreePath  *path,
			     GtkTreeIter  *_iter,
			     gpointer      data)
{
	GtkTreeIter iter, *default_iter;
	gboolean powered, cont;

	default_iter = NULL;
	num_adapters_present = num_adapters_powered = 0;

	cont = gtk_tree_model_get_iter_first (model, &iter);
	while (cont) {
		gboolean is_default;

		num_adapters_present++;

		gtk_tree_model_get (model, &iter,
				    BLUETOOTH_COLUMN_DEFAULT, &is_default,
				    BLUETOOTH_COLUMN_POWERED, &powered,
				    -1);
		if (powered)
			num_adapters_powered++;
		if (is_default && powered)
			default_iter = gtk_tree_iter_copy (&iter);

		cont = gtk_tree_model_iter_next (model, &iter);
	}

	update_discoverability (default_iter);
	update_icon_visibility ();
	update_menu_items ();
	update_device_list (default_iter);

	if (default_iter != NULL)
		gtk_tree_iter_free (default_iter);
}
Exemplo n.º 29
0
static void
on_down_clicked( GtkButton *button, BaseWindow *window )
{
	GtkTreeView *treeview;
	GtkTreeSelection *selection;
	GtkTreeModel *model;
	GtkTreeIter iter_selected;
	GtkTreeIter *iter_next;
	GtkTreePath *path_next;

	treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW ));
	selection = gtk_tree_view_get_selection( treeview );
	if( gtk_tree_selection_get_selected( selection, &model, &iter_selected )){
		iter_next = gtk_tree_iter_copy( &iter_selected );
		if( gtk_tree_model_iter_next( model, iter_next )){
			path_next = gtk_tree_model_get_path( model, iter_next );
			gtk_list_store_move_after( GTK_LIST_STORE( model ), &iter_selected, iter_next );
			gtk_tree_selection_unselect_all( selection );
			gtk_tree_selection_select_path( selection, path_next );
			gtk_tree_path_free( path_next );
		}
		gtk_tree_iter_free( iter_next );
	}
}
Exemplo n.º 30
0
static gboolean
repair_dialog_on_idle_update(GtkDialog* dialog)
{
    GtkTreeIter iter;
    GtkTreeIter* parent_iter;
    char* name;
    char* display_name;
    char* new_name;
    GFile* file;
    GFileType ftype;
    UpdateContext* context;
    gint n;
    int i;

    context = repair_dialog_get_update_context(dialog);

    if (context == NULL) {
	return FALSE;
    }

    for (i = 0; i < 500; i++) {
	if (context->file_stack == NULL) {
	    repair_dialog_set_update_context(dialog, NULL);
	    repair_dialog_on_update_end(dialog, context->success_all);
	    update_context_free(context);
	    return FALSE;
	}

	file = context->file_stack->data;

	if (context->enum_stack != NULL) {
	    GFileInfo* info;
	    GFileEnumerator* e;

	    parent_iter = context->iter_stack->data;
	    e = context->enum_stack->data;

	    info = g_file_enumerator_next_file(e, NULL, NULL);
	    if (info != NULL) {
		const char* name_const;
		name_const = g_file_info_get_name(info);
		display_name = get_display_name(name_const);
		new_name = get_new_name(name_const, context->encoding);

		file_list_model_append(context->store, &iter, parent_iter,
			NULL, name_const, display_name, new_name);
		if (new_name == NULL)
		    context->success_all = FALSE;

		ftype = g_file_info_get_file_type(info);
		if (ftype == G_FILE_TYPE_DIRECTORY) {
		    GFile* child;
		    GFileEnumerator* child_e;
		    GtkTreeIter* tmp_iter;

		    tmp_iter = gtk_tree_iter_copy(&iter);
		    child = g_file_get_child(file, name_const);
		    child_e = g_file_enumerate_children(child,
			    G_FILE_ATTRIBUTE_STANDARD_NAME ","
			    G_FILE_ATTRIBUTE_STANDARD_TYPE,
			    G_FILE_QUERY_INFO_NONE, NULL, NULL);
		    
		    update_context_push(context, child, tmp_iter, child_e);
		}

		g_object_unref(info);
		g_free(display_name);
		g_free(new_name);

		n = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(context->store), parent_iter);
		if (n == 1) {
		    GtkTreePath* path;
		    path = gtk_tree_model_get_path(GTK_TREE_MODEL(context->store), parent_iter);
		    gtk_tree_view_expand_row(context->treeview, path, FALSE);
		    gtk_tree_path_free(path);
		}
	    } else {
		g_object_unref(file);
		gtk_tree_iter_free(parent_iter);
		g_object_unref(e);
		update_context_pop(context);
	    }
	} else {
	    context->file_stack = g_slist_delete_link(context->file_stack, context->file_stack);

	    name = g_file_get_basename(file);
	    display_name = get_display_name(name);
	    new_name = get_new_name(name, context->encoding);

	    file_list_model_append(context->store, &iter, NULL,
		    file, name, display_name, new_name);

	    if (new_name == NULL)
		context->success_all = FALSE;

	    if (context->include_subdir) {
		ftype = g_file_query_file_type(file, G_FILE_QUERY_INFO_NONE, NULL);
		if (ftype == G_FILE_TYPE_DIRECTORY) {
		    GtkTreeIter* tmp_iter;
		    GFileEnumerator* e;

		    tmp_iter = gtk_tree_iter_copy(&iter);
		    e = g_file_enumerate_children(file,
			    G_FILE_ATTRIBUTE_STANDARD_NAME ","
			    G_FILE_ATTRIBUTE_STANDARD_TYPE,
			    G_FILE_QUERY_INFO_NONE, NULL, NULL);

		    update_context_push(context, file, tmp_iter, e);
		}
	    }

	    g_free(name);
	    g_free(display_name);
	    g_free(new_name);
	}
    }

    return TRUE;
}