static void
remove_button_clicked (GtkButton         *button,
		       CcBackgroundPanel *panel)
{
  CcBackgroundItem *item;
  GtkListStore *store;
  GtkTreePath *path;
  CcBackgroundPanelPrivate *priv;

  priv = panel->priv;

  item = get_selected_item (panel);
  if (item == NULL)
    g_assert_not_reached ();

  bg_pictures_source_remove (panel->priv->pictures_source, item);
  g_object_unref (item);

  /* Are there any items left in the pictures tree store? */
  store = bg_source_get_liststore (BG_SOURCE (panel->priv->pictures_source));
  if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) == 0)
    gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("sources-combobox")), SOURCE_WALLPAPERS);

  path = gtk_tree_path_new_from_string ("0");
  gtk_icon_view_select_path (GTK_ICON_VIEW (WID ("backgrounds-iconview")), path);
  gtk_tree_path_free (path);
}
示例#2
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkIconView_gtk_1icon_1view_1select_1path
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlong _path
)
{
	GtkIconView* self;
	GtkTreePath* path;

	// convert parameter self
	self = (GtkIconView*) _self;

	// convert parameter path
	path = (GtkTreePath*) _path;

	// call function
	gtk_icon_view_select_path(self, path);

	// cleanup parameter self

	// cleanup parameter path
}
示例#3
0
文件: testiconview.c 项目: BYC/gtk
static void
select_nonexisting (GtkWidget *button, GtkIconView *icon_list)
{  
  GtkTreePath *path = gtk_tree_path_new_from_indices (999999, -1);
  gtk_icon_view_select_path (icon_list, path);
  gtk_tree_path_free (path);
}
示例#4
0
/**
 * Crée le GtkIconView
 *
 * \param nom de l'icône
 *
 * \return le GtkIconView rempli avec l'icône sélectionnée au premier plan
 *
 * */
GtkWidget * gsb_select_icon_create_icon_view ( gchar * name_icon )
{
    GtkTreePath * tree_path;

    /* construct the GtkIconView */
    icon_view = gtk_icon_view_new ();
    gtk_icon_view_set_margin ( GTK_ICON_VIEW ( icon_view ), 0 );
    gtk_icon_view_set_spacing (GTK_ICON_VIEW ( icon_view ), 0 );
    gtk_icon_view_set_selection_mode (GTK_ICON_VIEW ( icon_view ),
                            GTK_SELECTION_SINGLE );
    gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW ( icon_view ), PIXBUF_COLUMN);
    gtk_icon_view_set_text_column (GTK_ICON_VIEW ( icon_view ), TEXT_COLUMN);


    /* remplissage et positionnement initial du curseur dans le GtkIconView */
    tree_path = gsb_select_icon_fill_icon_view ( name_icon );

    gtk_icon_view_select_path ( GTK_ICON_VIEW ( icon_view ), tree_path );
    gtk_icon_view_set_cursor (GTK_ICON_VIEW ( icon_view ), tree_path,
                            NULL, TRUE);
    gtk_icon_view_scroll_to_path (GTK_ICON_VIEW ( icon_view ),
                            tree_path, TRUE, 0.5, 0 );

    return icon_view;
}
示例#5
0
static VALUE
iview_select_path(VALUE self, VALUE path)
{
    G_CHILD_SET(self, id_select_path, path);
    gtk_icon_view_select_path(_SELF(self), RVAL2GTKTREEPATH(path));
    return self;
}
示例#6
0
static void
load_themes (DialogData *data)
{
	GFile        *style_dir;
	GFile        *data_dir;
	char         *default_theme;
	GtkTreeModel *model;
	GtkTreeIter   iter;

	/* local themes */

	style_dir = gth_user_dir_get_file_for_read (GTH_DIR_DATA, PIX_DIR, "albumthemes", NULL);
	add_themes_from_dir (data, style_dir);
	g_object_unref (style_dir);

	/* system themes */

	data_dir = g_file_new_for_path (WEBALBUM_DATADIR);
	style_dir = _g_file_get_child (data_dir, "albumthemes", NULL);
	add_themes_from_dir (data, style_dir);
	g_object_unref (style_dir);
	g_object_unref (data_dir);

	/**/

	gtk_widget_set_size_request (GET_WIDGET ("theme_iconview"), (150 * 3), 140);
	gtk_widget_realize (GET_WIDGET ("theme_iconview"));

	default_theme = g_settings_get_string (data->settings, PREF_WEBALBUMS_THEME);

	model = GTK_TREE_MODEL (GET_WIDGET ("theme_liststore"));
	if (gtk_tree_model_get_iter_first (model, &iter)) {
		do {
			char *name;

			gtk_tree_model_get(model, &iter, THEME_COLUMN_ID, &name, -1);

			if (g_strcmp0 (name, default_theme) == 0) {
				GtkTreePath *path;

				path = gtk_tree_model_get_path (model, &iter);
				gtk_icon_view_select_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path);
				gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path, TRUE, 0.5, 0.5);

				gtk_tree_path_free (path);
				g_free (name);
				break;
			}

			g_free (name);
		}
		while (gtk_tree_model_iter_next (model, &iter));
	}

	g_free (default_theme);
}
static void
theme_select_iter (GtkIconView *icon_view, GtkTreeIter *iter)
{
  GtkTreePath *path;

  path = gtk_tree_model_get_path (gtk_icon_view_get_model (icon_view), iter);
  gtk_icon_view_select_path (icon_view, path);
  gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.5, 0.0);
  gtk_tree_path_free (path);
}
示例#8
0
static void
attachment_icon_view_select_path (EAttachmentView *view,
                                  GtkTreePath *path)
{
	GtkIconView *icon_view;

	icon_view = GTK_ICON_VIEW (view);

	gtk_icon_view_select_path (icon_view, path);
}
static void
fcitx_main_window_init(FcitxMainWindow* self)
{
    GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
    GtkWidget* hbox = gtk_hbox_new(FALSE, 0);

    self->pagestore = _fcitx_main_window_create_model();
    self->pageview = gtk_icon_view_new_with_model(GTK_TREE_MODEL(self->pagestore));

    gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_ICON);
    gtk_icon_view_set_text_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_NAME);
#if GTK_CHECK_VERSION(2, 22, 0)
    gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(self->pageview), GTK_ORIENTATION_VERTICAL);
#endif

    _fcitx_main_window_add_im_page(self);
    _fcitx_main_window_add_config_file_page(self);
    _fcitx_main_window_add_addon_page(self);

    gtk_widget_set_size_request(GTK_WIDGET(self), -1, 500);

    self->vbox = gtk_vbox_new(FALSE, 0);
    self->pagelabel = gtk_label_new("");
    gtk_label_set_use_markup(GTK_LABEL(self->pagelabel), true);
    gtk_misc_set_alignment(GTK_MISC(self->pagelabel), 0, 0.5);

    gtk_box_pack_start(GTK_BOX(self->vbox), self->pagelabel, FALSE, FALSE, 14);
    GtkWidget* scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
    gtk_container_add(GTK_CONTAINER(scrolledwindow), self->pageview);
    gtk_box_pack_start(GTK_BOX(hbox), scrolledwindow, FALSE, TRUE, 4);
    gtk_box_pack_start(GTK_BOX(hbox), self->vbox, TRUE, TRUE, 8);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8);

    gtk_container_add(GTK_CONTAINER(self), vbox);

    gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(self->pageview), GTK_SELECTION_SINGLE);
    gtk_icon_view_set_item_padding(GTK_ICON_VIEW(self->pageview), 0);
    gtk_icon_view_set_margin(GTK_ICON_VIEW(self->pageview), 0);
    gtk_icon_view_set_column_spacing(GTK_ICON_VIEW(self->pageview), 0);
    gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(self->pageview), 0);
    gtk_icon_view_set_item_width(GTK_ICON_VIEW(self->pageview), 96);

    g_signal_connect_swapped(G_OBJECT(self), "destroy", G_CALLBACK(gtk_main_quit), NULL);
    g_signal_connect(G_OBJECT(self->pageview), "selection-changed",
                     G_CALLBACK(_fcitx_main_window_selection_changed_cb), self);

    GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(self->pagestore), &self->impage->iter);
    gtk_icon_view_select_path(GTK_ICON_VIEW(self->pageview), path);
    gtk_tree_path_free(path);

    gtk_window_set_icon_name(GTK_WINDOW(self), "fcitx-configtool");
    gtk_window_set_title(GTK_WINDOW(self), _("Fcitx Config"));
}
示例#10
0
static gboolean
focus_in (GtkWidget     *view,
          GdkEventFocus *event,
          gpointer       data)
{
  GtkTreePath *path;

  if (!gtk_icon_view_get_cursor (GTK_ICON_VIEW (view), &path, NULL))
    {
      path = gtk_tree_path_new_from_indices (0, -1);
      gtk_icon_view_set_cursor (GTK_ICON_VIEW (view), path, NULL, FALSE);
    }

  gtk_icon_view_select_path (GTK_ICON_VIEW (view), path);
  gtk_tree_path_free (path);

  return FALSE;
}
static gboolean
category_focus_in (GtkWidget          *view,
                   GdkEventFocus      *event,
                   CinnamonControlCenter *shell)
{
  GtkTreePath *path;

  if (!gtk_icon_view_get_cursor (GTK_ICON_VIEW (view), &path, NULL))
    {
      path = gtk_tree_path_new_from_indices (0, -1);
      gtk_icon_view_set_cursor (GTK_ICON_VIEW (view), path, NULL, FALSE);
    }

  gtk_icon_view_select_path (GTK_ICON_VIEW (view), path);
  gtk_tree_path_free (path);

  return FALSE;
}
static void
row_inserted (GtkTreeModel      *tree_model,
	      GtkTreePath       *path,
	      GtkTreeIter       *iter,
	      CcBackgroundPanel *panel)
{
  GtkListStore *store;
  CcBackgroundPanelPrivate *priv;

  priv = panel->priv;

  store = bg_source_get_liststore (BG_SOURCE (panel->priv->pictures_source));
  g_signal_handlers_disconnect_by_func (G_OBJECT (store), G_CALLBACK (row_inserted), panel);

  /* Change source */
  gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("sources-combobox")), SOURCE_PICTURES);

  /* And select the newly added item */
  gtk_icon_view_select_path (GTK_ICON_VIEW (WID ("backgrounds-iconview")), path);
}
/**
 * ppg_add_instrument_dialog_entry_changed:
 * @entry: (in): A #GtkEntry.
 * @dialog: (in): A #PpgAddInstrumentDialog.
 *
 * Handles the "changed" signal of @entry. The filter model used in the
 * icon-view is refiltered to match the search text.
 *
 * Returns: None.
 * Side effects: None.
 */
static void
ppg_add_instrument_dialog_entry_changed (GtkWidget              *entry,
                                         PpgAddInstrumentDialog *dialog)
{
	PpgAddInstrumentDialogPrivate *priv;
	GtkTreePath *path;
	GtkTreeIter iter;

	g_return_if_fail(PPG_IS_ADD_INSTRUMENT_DIALOG(dialog));

	priv = dialog->priv;
	gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(priv->filter));
	if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv->filter), NULL) == 1) {
		if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->filter), &iter)) {
			path = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->filter), &iter);
			gtk_icon_view_select_path(GTK_ICON_VIEW(priv->icon_view), path);
			gtk_tree_path_free(path);
		}
	}
}
static void select_item(AppearanceData* data, MateWPItem* item, gboolean scroll)
{
	GtkTreePath* path;

	g_return_if_fail(data != NULL);

	if (item == NULL)
		return;

	path = gtk_tree_row_reference_get_path(item->rowref);

	gtk_icon_view_select_path(data->wp_view, path);

	if (scroll)
	{
		gtk_icon_view_scroll_to_path(data->wp_view, path, FALSE, 0.5, 0.0);
	}

	gtk_tree_path_free(path);
}
示例#15
0
/**
 * gimp_page_selector_select_page:
 * @selector: Pointer to a #GimpPageSelector.
 * @page_no: The number of the page to select.
 *
 * Adds a page to the selection.
 *
 * Since: 2.4
 **/
void
gimp_page_selector_select_page (GimpPageSelector *selector,
                                gint              page_no)
{
    GimpPageSelectorPrivate *priv;
    GtkTreeIter              iter;
    GtkTreePath             *path;

    g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));

    priv = GIMP_PAGE_SELECTOR_GET_PRIVATE (selector);

    g_return_if_fail (page_no >= 0 && page_no < priv->n_pages);

    gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->store),
                                   &iter, NULL, page_no);
    path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);

    gtk_icon_view_select_path (GTK_ICON_VIEW (priv->view), path);

    gtk_tree_path_free (path);
}
static void
wp_remove_wallpaper (GtkWidget *widget,
                     AppearanceData *data)
{
  MateWPItem *item;
  GtkTreeIter iter;
  GtkTreePath *path;

  item = get_selected_item (data, &iter);

  if (item)
  {
    item->deleted = TRUE;

    if (gtk_list_store_remove (GTK_LIST_STORE (data->wp_model), &iter))
      path = gtk_tree_model_get_path (data->wp_model, &iter);
    else
      path = gtk_tree_path_new_first ();

    gtk_icon_view_select_path (data->wp_view, path);
    gtk_icon_view_set_cursor (data->wp_view, path, NULL, FALSE);
    gtk_tree_path_free (path);
  }
}
示例#17
0
void toolbar2___::with__(window___* w, void*shangji,void*ce,deque<string>* p, int addr_fmt, char*buf) {
	toolbar2_item___* item;
	if((*p)[1] == toolbar2_tag2_) {
		init__(w->box2__(), left_icon_item_);
		item = left_icon_item_;
	} else if((*p)[1] == toolbar2_tag3_) {
		init__(w->box2__(), tree_item_);
		item = tree_item_;
	} else if((*p)[1] == toolbar2_tag4_) {
		init__(w->box3__(), right_icon_item_);
		item = right_icon_item_;
	} else if((*p)[1] == toolbar2_tag5_) {
		init__(w->box4__(), bottom_icon_item_);
		item = bottom_icon_item_;
	} else if((*p)[1] == toolbar2_tag6_) {
		init__(w->box3__(), right_tree_item_);
		item = right_tree_item_;
	} else {
		init__(w->box__(), icon_item_);
		item = icon_item_;
	}
	for(size_t i2=2;i2<p->size();i2++){
		const string& p2=(*p)[i2];
		if(p2 == "选择") {
			GtkTreeModel *m = item->model__();
			GtkTreeIter i;
			GtkTreePath *path;
			for(size_t i3 = i2;i3 < p->size() - 1;) {
				int id2 = 0;
				if(!set__(i3, p, id2)) return;
				if(!iter_by_id__(m, id2, &i)) {
					buzhichi__(i3, p);
					return;
				}
				switch(item->tag_) {
				case 'i':
					path = gtk_tree_model_get_path (m, &i);
					gtk_icon_view_select_path (item->icon_view__(), path);
					gtk_tree_path_free (path);
					break;
				}
			}
			return;
		}
		if(p2 == "遍历") {
			if(buzu__(++i2, p)) return;
			item->for__((*p)[i2], ce, shangji);
			continue;
		}
		if(p2 == "设") {
			int id = 0;
			if(!set__(i2, p, id)) return;
			callback_item___* cbi = callback_item__(id);
			if(!cbi) {
				wufa__(p->size(), p);
				return;
			}
			GtkTreeModel *m = item->model__();
			GtkTreeIter i;
			for(i2++; i2 < p->size(); i2++) {
				const string& p3 = (*p)[i2];
				if(p3 == "名") {
					if(set__(i2, p, cbi->title_)) {
						if(!iter_by_id__(m, cbi->id_, &i)) {
							buzhichi__(i2, p);
							return;
						}
						switch(item->tag_) {
						case 'i':
							gtk_list_store_set(((icon_item___*)item)->store_, &i, TITLE_COLUMN, cbi->title_.c_str(), -1);
							continue;
						}
					}
					return;
				}
				if(p3 == "提示") {if(set__(i2, p, cbi->tooltip_)) continue; return;}
				if(p3 == "图标") {
					string name;
					if(!set__(i2, p, name)) return;
					GdkPixbuf *pixbuf = item->get_icon__(name);
					switch(item->tag_) {
					case 'i':
						gtk_list_store_set(((icon_item___*)item)->store_, &i, PIXBUF_COLUMN, pixbuf, -1);
						break;
					}
					g_object_unref (pixbuf);
					continue;
				}
				buzhichi__(i2, p);
			}
			break;
		}
		if(p2 == "获取") {
			string code3;
			if(!set__(i2, p, code3)) return;
			switch(item->tag_) {
			case 'i':
				icon_view_select__(item->icon_view__(), code3.c_str(), shangji, ce);
				break;
			}
			continue;
		}
#ifdef ver_gtk3_
		if(p2 == "宽") {
			if(buzu__(++i2, p)) return;
			gtk_scrolled_window_set_min_content_width(item->scrolled__(), s2i__((*p)[i2]));
			continue;
		}
		if(p2 == "高") {
			if(buzu__(++i2, p)) return;
			gtk_scrolled_window_set_min_content_height(item->scrolled__(), s2i__((*p)[i2]));
			continue;
		}
#endif
		if(p2 == "名") {
			if(buzu__(++i2, p)) return;
			if(item->label_) {
				gtk_label_set_markup(GTK_LABEL(item->label_), (*p)[i2].c_str());
			}
			continue;
		}
		if(p2 == "钮宽") {if(set__(i2, p, item->btn_width_)) continue; return;}
		if(p2 == "钮高") {if(set__(i2, p, item->btn_height_)) continue; return;}
		if(p2 == "名提示") {item->title_tooltip_ = true; continue;}
		if(p2 == "可拖动") {
			switch(item->tag_) {
			case 'i':
				gtk_icon_view_set_reorderable(item->icon_view__(), true);
				break;
			case 't':
				gtk_tree_view_set_reorderable(item->tree_view__(), true);
				break;
			}
			continue;
		}
		if(p2 == "可选择") {
			int i;
			if(!set__(i2, p, i)) return;
			switch(item->tag_) {
			case 'i':
				gtk_icon_view_set_selection_mode(item->icon_view__(), (GtkSelectionMode)i);
				break;
			}
			continue;
		}
		if(p2 == "无标题") {
			if(item->tag_ == 'i') {
				//gtk_icon_view_set_text_column (item->icon_view__(), -1);
				gtk_icon_view_set_markup_column (item->icon_view__(), -1);
				continue;
			}
			buzhichi__(i2, p);
			return;
		}
		//gtk_icon_view_set_selection_mode (iconview__(), GTK_SELECTION_MULTIPLE);
		if(p2 == "列头") {
			if(buzu__(++i2, p)) return;
			if(item->tag_ == 't') {
				tree_item___* ti = (tree_item___*)item;
				gtk_tree_view_column_set_title(ti->col_, (*p)[i2].c_str());
				continue;
			}
			buzhichi__(i2, p);
			return;
		}
		if(p2 == "删钮") {
			GtkTreeModel *m = item->model__();
			GtkTreeIter i;
			for(size_t i3 = i2;i3 < p->size() - 1;) {
				int id2 = 0;
				if(!set__(i3, p, id2)) return;
				if(!iter_by_id__(m, id2, &i)) {
					buzhichi__(i3, p);
					return;
				}
				item->store_del__(&i);
			}
			break;
		}
		if(p2 == "加钮") {
			string title, tooltip, code, arg, code2, arg2, code3_2;
			string set_up;
			int posi = -1;
			for(i2++;i2<p->size();i2++){
				const string& p3=(*p)[i2];
				if(p3 == "名") {if(set__(i2, p, title)) continue; return;}
				if(p3 == "提示") {if(set__(i2, p, tooltip)) continue; return;}
				if(p3 == "代码") {if(set__(i2, p, code)) continue; return;}
				if(p3 == "附") {if(set__(i2, p, arg)) continue; return;}
				if(p3 == "位置") {if(set__(i2, p, posi)) continue; return;}
				if(p3 == "缺省代码") {if(set__(i2, p, item->def_code_)) continue; return;}
				if(p3 == "缺省附") {if(set__(i2, p, item->def_arg_)) continue; return;}
				if(p3 == "双击代码") {if(set__(i2, p, code2)) continue; return;}
				if(p3 == "双击附") {if(set__(i2, p, arg2)) continue; return;}
				if(p3 == "缺省双击代码") {if(set__(i2, p, item->def_code2_)) continue; return;}
				if(p3 == "缺省双击附") {if(set__(i2, p, item->def_arg2_)) continue; return;}
				if(p3 == "右击代码") {if(set__(i2, p, code3_2)) continue; return;}
				if(p3 == "缺省右击代码") {if(set__(i2, p, item->def_code3_2_)) continue; return;}
				if(p3 == "设置上") {if(set__(i2, p, set_up)) continue; return;}
				if(p3 == "恢复上") {
					if(item->tag_ == 't') {
						string restore_up;
						if(set__(i2, p, restore_up)) {
							int err;
							const char* ret = call4__(ce, restore_up, shangji, 0, NULL, &err);
							if(err) return;
							((tree_item___*)item)->up_ = ret;
						}
					} else {
						buzhichi__(i2, p);
					}
					return;
				}
				if(p3 == "大小") {
					if(buzu__(++i2, p)) return;
					item->btn_width_ = item->btn_height_ = s2i__((*p)[i2]) * 8;
					continue;
				}
				if(p3 == "-") continue;

				GdkPixbuf *pixbuf = item->get_icon__(p3);

				callback_item___* si = new callback_item___(title,
						!code.empty() ? code : item->def_code_,
						!arg.empty() ? arg : item->def_arg_,
								tooltip.empty() && item->title_tooltip_ ? title : tooltip);
				si->add_code__(!code2.empty() ? code2 : item->def_code2_);
				si->add_arg__(!arg2.empty() ? arg2 : item->def_arg2_);
				si->add_code__(!code3_2.empty() ? code3_2 : item->def_code3_2_);
				item->store_add__(si, pixbuf, posi);

				g_object_unref (pixbuf);

				if(!set_up.empty()) {
					if(item->tag_ == 't') {
						tree_item___* ti = (tree_item___*)item;
						const char* argv[] = {ti->up_.c_str()};
						int err;
						call4__(ce, set_up, shangji, 1, argv, &err);
						if(err)
							return;
						ti->up_ = ti->last_;
					} else {
						buzhichi__(i2, p);
						return;
					}
					set_up.clear();
				}
				code.clear();
				arg.clear();
				tooltip.clear();
				code2.clear();
				arg2.clear();
				code3_2.clear();
				posi = -1;
			}
			break;
		}
		if(p2 == "清空") {
			switch(item->tag_) {
			case 'i':
				gtk_list_store_clear (((icon_item___*)item)->store_);
				continue;
			}
		}
		if(p2 == "地址") {
			if(addr_fmt == 16)
				l2x__((long)item->scrolled_, buf);
			else
				l2s__((long)item->scrolled_, buf);
			continue;
		}
		buzhichi__(i2, p);
		return;
	}
}
static void
theme_set_custom_from_theme (const MateThemeMetaInfo *info, AppearanceData *data)
{
  MateThemeMetaInfo *custom = data->theme_custom;
  GtkIconView *icon_view = GTK_ICON_VIEW (appearance_capplet_get_widget (data, "theme_list"));
  GtkTreeModel *model;
  GtkTreeIter iter;
  GtkTreePath *path;

  if (info == custom)
    return;

  /* if info is not NULL, we'll copy those theme settings over */
  if (info != NULL) {
    g_free (custom->gtk_theme_name);
    g_free (custom->icon_theme_name);
    g_free (custom->marco_theme_name);
    g_free (custom->gtk_color_scheme);
    g_free (custom->cursor_theme_name);
    g_free (custom->application_font);
    custom->gtk_color_scheme = NULL;
    custom->application_font = NULL;

    /* these settings are guaranteed to be non-NULL */
    custom->gtk_theme_name = g_strdup (info->gtk_theme_name);
    custom->icon_theme_name = g_strdup (info->icon_theme_name);
    custom->marco_theme_name = g_strdup (info->marco_theme_name);
    custom->cursor_theme_name = g_strdup (info->cursor_theme_name);
    custom->cursor_size = info->cursor_size;

    /* these can be NULL */
    if (info->gtk_color_scheme)
      custom->gtk_color_scheme = g_strdup (info->gtk_color_scheme);
    else
      custom->gtk_color_scheme = get_default_string_from_key (data->client, COLOR_SCHEME_KEY);

    if (info->application_font)
      custom->application_font = g_strdup (info->application_font);
    else
      custom->application_font = get_default_string_from_key (data->client, APPLICATION_FONT_KEY);
  }

  /* select the custom theme */
  model = gtk_icon_view_get_model (icon_view);
  if (!theme_find_in_model (model, custom->name, &iter)) {
    GtkTreeIter child;

    gtk_list_store_insert_with_values (data->theme_store, &child, 0,
        COL_LABEL, custom->readable_name,
        COL_NAME, custom->name,
        COL_THUMBNAIL, data->theme_icon,
        -1);
    gtk_tree_model_sort_convert_child_iter_to_iter (
        GTK_TREE_MODEL_SORT (model), &iter, &child);
  }

  path = gtk_tree_model_get_path (model, &iter);
  gtk_icon_view_select_path (icon_view, path);
  gtk_icon_view_scroll_to_path (icon_view, path, FALSE, 0.5, 0.0);
  gtk_tree_path_free (path);

  /* update the theme thumbnail */
  theme_thumbnail_generate (custom, data);
}
示例#19
0
void
cheese_thumb_view_remove_item (CheeseThumbView *thumb_view, GFile *file)
{
    CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view);

    gchar *filename;
    GtkTreeIter iter;
    gboolean found = FALSE;

    filename = g_file_get_path (file);

    if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter))
    {
        gchar *col_filename;

        gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
                            THUMBNAIL_URL_COLUMN, &col_filename, -1);

        /* FIXME: col_filename is in GLib filename encoding, not ASCII. */
        if (g_ascii_strcasecmp (col_filename, filename))
        {
            while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store),
                                             &iter))
            {
                g_free (col_filename);

                gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
                                    THUMBNAIL_URL_COLUMN, &col_filename, -1);

                /* FIXME: col_filename is in GLib filename encoding, not ASCII. */
                if (!g_ascii_strcasecmp (col_filename, filename))
                {
                    found = TRUE;
                    break;
                }
            }
        }
        else
        {
            found = TRUE;
        }

            g_free (col_filename);
            g_free (filename);
    }
    else
    {
        /* A single item was in the thumbview but it's been already removed. */
        g_free (filename);
        return;
    }

  if (!found) return;

  gboolean valid = gtk_list_store_remove (priv->store, &iter);
  if (!valid)
  {
    int len = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
    if (len <= 0)
      return;

    valid = gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->store), &iter, NULL, len - 1);
  }
  GtkTreePath *tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);
  gtk_icon_view_select_path (GTK_ICON_VIEW (thumb_view), tree_path);
  gtk_tree_path_free (tree_path);
}