Example #1
0
static GtkWidget *
panda_combo_new (GladeXML *xml, GladeWidgetInfo *info)
{
	GtkWidget *combo = gtk_panda_combo_new();
	GList *tmp;

	for (tmp = info->attributes; tmp; tmp = tmp->next) {
		GladeAttribute *attr = tmp->data;

		switch (attr->name[0]) {
		case 'c':
			if (!strcmp(attr->name, "case_sensitive"))
				gtk_panda_combo_set_case_sensitive(GTK_PANDA_COMBO(combo),
							attr->value[0] == 'T');
			break;
		case 'i':
			if (!strcmp(attr->name, "items")) {
				gchar **items = g_strsplit(attr->value,"\n",0);
				if (items) {
					gtk_panda_combo_set_popdown_strings(GTK_PANDA_COMBO(combo),
						 items);
				}
				g_strfreev(items);
			}
			break;
		case 'u':
			if (!strcmp(attr->name, "use_arrows")) {
				gtk_panda_combo_set_use_arrows(GTK_PANDA_COMBO(combo),
							attr->value[0] == 'T');
			} else if (!strcmp(attr->name, "use_arrows_always")) {
				gtk_panda_combo_set_loop_selection(
					GTK_PANDA_COMBO(combo), attr->value[0]=='T');
			}
			break;
		case 'l':
			if (!strcmp(attr->name, "loop_selection")) {
				gtk_panda_combo_set_loop_selection(
					GTK_PANDA_COMBO(combo), attr->value[0]=='T');
			}
			break;
		}
	}

	return combo;
}
Example #2
0
static void
panda_combo_build_children (GladeXML *xml, GtkWidget *w,
			    GladeWidgetInfo *info, const char *longname)
{
	GList *tmp;
	GladeWidgetInfo *cinfo = NULL;
	GtkEntry *entry;

	for (tmp = info->children; tmp; tmp = tmp->next) {
		GList *tmp2;
		gchar *child_name = NULL;
		cinfo = tmp->data;
		for (tmp2 = cinfo->attributes; tmp2; tmp2 = tmp2->next) {
			GladeAttribute *attr = tmp2->data;
			if (!strcmp(attr->name, "child_name")) {
				child_name = attr->value;
				break;
			}
		}
		if (child_name && !strcmp(child_name, "GtkPandaCombo:entry"))
			break;
	}
	if (!tmp)
		return;
#if 1
	entry = GTK_ENTRY(GTK_PANDA_COMBO(w)->entry);
	for (tmp = cinfo->attributes; tmp; tmp = tmp->next) {
		GladeAttribute *attr = tmp->data;
		if (!strcmp(attr->name, "editable")) {
			gtk_entry_set_editable(entry, attr->value[0] == 'T');
		} else if (!strcmp(attr->name, "text_visible")) {
			gtk_entry_set_visibility(entry, attr->value[0] == 'T');
		} else if (!strcmp(attr->name, "text_max_length")) {
			gtk_entry_set_max_length(entry, strtol(attr->value,NULL, 0));
		} else if (!strcmp(attr->name, "max_length")) {
			gtk_entry_set_max_length(entry, strtol(attr->value,NULL, 0));
		} else if (!strcmp(attr->name, "text")) {
			gtk_entry_set_text(entry, attr->value);
		}
	}
#endif
	glade_xml_set_common_params(xml, GTK_PANDA_COMBO(w)->entry, cinfo, longname);
}
Example #3
0
static	void
SetPandaCombo(
	GtkWidget	*widget,
	WidgetData	*wdata,
	_Combo		*data)
{
	GtkPandaCombo	*combo;

ENTER_FUNC;
	SetCommon(widget,wdata);
	combo = GTK_PANDA_COMBO(widget);
	gtk_panda_combo_set_popdown_strings(combo,data->itemdata);
LEAVE_FUNC;
}