sinek/src prefs.c,1.24,1.25
[email protected] Fri, 17 Jan 2003 00:45:51 -0800
| Newsgroups | gmane.comp.video.sinek.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/sinek/sinek/src
In directory sc8-pr-cvs1:/tmp/cvs-serv9595
Modified Files:
prefs.c
Log Message:
gtkxine changes. yikes.
Index: prefs.c
===================================================================
RCS file: /cvsroot/sinek/sinek/src/prefs.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- prefs.c 3 Jan 2003 09:42:20 -0000 1.24
+++ prefs.c 17 Jan 2003 08:45:49 -0000 1.25
@@ -9,6 +9,7 @@
*/
#include "common.h"
+#include "gtkxine.h"
#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
@@ -28,7 +29,7 @@
struct cfgitem
{
char *label;
- xine_cfg_entry_t *entry;
+ const void *value;
GtkWidget *widget;
GList *subitems;
};
@@ -142,13 +143,12 @@
void print_version(void)
{
- int major, minor, sub;
-
- xine_get_version(&major, &minor, &sub);
printf(_("Sinek v%s (Video Player)\n"), VERSION);
printf(_("built with xine library v%d.%d.%d, using v%d.%d.%d.\n"),
XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION,
- major, minor, sub);
+ gtk_xine_get_major_version(GTK_XINE(sinek.xine)),
+ gtk_xine_get_minor_version(GTK_XINE(sinek.xine)),
+ gtk_xine_get_sub_version(GTK_XINE(sinek.xine)));
}
@@ -242,7 +242,6 @@
{
GList *page, *item;
struct cfgitem *citem;
- xine_cfg_entry_t entry;
page = g_list_first(page_list);
while(page)
@@ -250,31 +249,29 @@
item = g_list_first(((struct cfgitem *)page->data)->subitems);
while(item)
{
+ void *val;
citem = (struct cfgitem *)item->data;
- xine_config_lookup_entry(media->xine, citem->label, &entry);
- switch(entry.type)
+ switch (gtk_xine_config_get(GTK_XINE(sinek.xine), citem->label, val))
{
- case XINE_CONFIG_TYPE_STRING:
- entry.str_value = (char *) gtk_entry_get_text(GTK_ENTRY(citem->widget));
- xine_config_update_entry(media->xine, &entry);
+ case GTK_XINE_CONFIG_TYPE_STRING:
+ val = (char *) gtk_entry_get_text(GTK_ENTRY(citem->widget));
break;
case XINE_CONFIG_TYPE_BOOL:
- entry.num_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(citem->widget));
- xine_config_update_entry(media->xine, &entry);
+ val = (void *) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(citem->widget));
break;
case XINE_CONFIG_TYPE_ENUM:
- entry.num_value = gtk_option_menu_get_history(GTK_OPTION_MENU(citem->widget));
- xine_config_update_entry(media->xine, &entry);
+ val = (void *) gtk_option_menu_get_history(GTK_OPTION_MENU(citem->widget));
break;
case XINE_CONFIG_TYPE_NUM:
- entry.num_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(citem->widget));
- xine_config_update_entry(media->xine, &entry);
+ val = (void *) gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(citem->widget));
break;
case XINE_CONFIG_TYPE_RANGE:
- entry.num_value = ((GtkAdjustment *)citem->widget)->value;
- xine_config_update_entry(media->xine, &entry);
+ val = ((GtkAdjustment *)citem->widget)->value;
+ break;
+ default:
break;
}
+ gtk_xine_config_set(GTK_XINE(sinek.xine), citem->label, val);
item = g_list_next(item);
}
page = g_list_next(page);
@@ -288,7 +285,7 @@
prf_apply_changes();
tmp = g_strconcat(g_get_home_dir(), "/.xine/config", NULL);
- xine_config_save(media->xine, tmp);
+ gtk_xine_config_save(GTK_XINE(sinek.xine), tmp);
g_free(tmp);
gtk_widget_hide(win);
}
@@ -311,9 +308,9 @@
gtk_widget_show(t);
gtk_box_pack_start(GTK_BOX(box), t, FALSE, FALSE, 0);
t = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(t), citem->entry->str_value);
+ gtk_entry_set_text(GTK_ENTRY(t), (const char *) citem->value);
gtk_widget_show(t);
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), t, citem->entry->description, NULL);
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), t, "No description", NULL);
gtk_box_pack_start(GTK_BOX(box), t, TRUE, TRUE, 0);
citem->widget = t;
@@ -327,9 +324,9 @@
t = gtk_check_button_new_with_label(citem->label);
gtk_widget_show(t);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t), citem->entry->num_value);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t), (int) citem->value);
citem->widget = t;
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), t, citem->entry->description, NULL);
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), t, "No description", NULL);
return t;
}
@@ -338,7 +335,7 @@
static GtkWidget *build_option(struct cfgitem *citem)
{
GtkWidget *box, *opt, *m, *mi;
- char **enums;
+ const char **enums;
int i = 0;
box = gtk_hbox_new(FALSE, 5);
@@ -348,7 +345,7 @@
gtk_widget_show(m);
gtk_box_pack_start(GTK_BOX(box), m, FALSE, FALSE, 0);
- enums = citem->entry->enum_values;
+ gtk_xine_config_get_enums(GTK_XINE(sinek.xine), citem->label, &enums);
opt = gtk_option_menu_new();
gtk_widget_show(opt);
m = gtk_menu_new();
@@ -360,10 +357,10 @@
i++;
}
gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), m);
- gtk_option_menu_set_history(GTK_OPTION_MENU(opt), citem->entry->num_value);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(opt), (guint) citem->value);
gtk_box_pack_start(GTK_BOX(box), opt, TRUE, TRUE, 0);
citem->widget = opt;
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), opt, citem->entry->description, NULL);
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), opt, "No description", NULL);
return box;
}
@@ -381,12 +378,12 @@
gtk_widget_show(lab);
gtk_box_pack_start(GTK_BOX(box), lab, FALSE, FALSE, 0);
- adj = gtk_adjustment_new(citem->entry->num_value, INT_MIN, INT_MAX, 1, 0, 0);
+ adj = gtk_adjustment_new((int) citem->value, INT_MIN, INT_MAX, 1, 0, 0);
spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
gtk_widget_show(spin);
gtk_box_pack_start(GTK_BOX(box), spin, TRUE, TRUE, 0);
citem->widget = spin;
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), spin, citem->entry->description, NULL);
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), spin, "No description", NULL);
return box;
}
@@ -396,6 +393,7 @@
{
GtkObject *adj;
GtkWidget *box, *lab, *scale;
+ int min, max;
box = gtk_hbox_new(FALSE, 5);
gtk_widget_show(box);
@@ -404,13 +402,14 @@
gtk_widget_show(lab);
gtk_box_pack_start(GTK_BOX(box), lab, FALSE, FALSE, 0);
- adj = gtk_adjustment_new(citem->entry->num_value, citem->entry->range_min, citem->entry->range_max, 1, 0, 0);
+ gtk_xine_config_get_min_max(GTK_XINE(sinek.xine), citem->label, &min, &max);
+ adj = gtk_adjustment_new((int) citem->value, min, max, 1, 0, 0);
scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
gtk_widget_show(scale);
gtk_scale_set_digits(GTK_SCALE(scale), 0);
gtk_box_pack_start(GTK_BOX(box), scale, TRUE, TRUE, 0);
citem->widget = (GtkWidget *)adj;
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), scale, citem->entry->description, NULL);
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), scale, "No description", NULL);
return box;
}
@@ -421,7 +420,6 @@
GtkWidget *sw, *box, *w;
GList *item;
struct cfgitem *citem;
- xine_cfg_entry_t *entry;
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(sw);
@@ -435,20 +433,15 @@
while(item)
{
citem = (struct cfgitem *)item->data;
- entry = citem->entry;
- if(entry->description)
- {
- switch(entry->type)
- {
- case XINE_CONFIG_TYPE_STRING: w = build_string(citem); break;
- case XINE_CONFIG_TYPE_BOOL: w = build_checkbox(citem); break;
- case XINE_CONFIG_TYPE_ENUM: w = build_option(citem); break;
- case XINE_CONFIG_TYPE_NUM: w = build_numeric(citem); break;
- case XINE_CONFIG_TYPE_RANGE: w = build_scale(citem); break;
- default: w = NULL;
- }
- if(w) gtk_box_pack_start(GTK_BOX(box), w, FALSE, FALSE, 0);
+ switch (gtk_xine_config_get(GTK_XINE(sinek.xine), citem->label, (void **) &citem->value)) {
+ case GTK_XINE_CONFIG_TYPE_STRING: w = build_string(citem); break;
+ case GTK_XINE_CONFIG_TYPE_BOOL: w = build_checkbox(citem); break;
+ case GTK_XINE_CONFIG_TYPE_ENUM: w = build_option(citem); break;
+ case GTK_XINE_CONFIG_TYPE_NUM: w = build_numeric(citem); break;
+ case GTK_XINE_CONFIG_TYPE_RANGE: w = build_scale(citem); break;
+ default: w = NULL;
}
+ if(w) gtk_box_pack_start(GTK_BOX(box), w, FALSE, FALSE, 0);
item = g_list_next(item);
}
@@ -479,7 +472,8 @@
GtkTreeIter iter;
GList *item;
struct cfgitem *cpage, *citem;
- xine_cfg_entry_t entry;
+ const char *key, *nextkey;
+ const void *value;
gchar *p;
int r, len, num = 0;
@@ -490,18 +484,16 @@
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), col);
gtk_widget_show(list_view);
- r = xine_config_get_first_entry(media->xine, &entry);
- while (r)
- {
- p = strchr(entry.key, '.');
- if(p && entry.description)
- {
- len = p - entry.key;
+ r = gtk_xine_config_get_first(GTK_XINE(sinek.xine), &key, &value);
+ while (r != GTK_XINE_CONFIG_TYPE_NONE) {
+ p = strchr((char *) key, '.');
+ if (p) {
+ len = p - key;
cpage = NULL;
item = g_list_first(page_list);
while(item)
{
- if(strncmp(((struct cfgitem *)item->data)->label, entry.key, len) == 0)
+ if(strncmp(((struct cfgitem *)item->data)->label, key, len) == 0)
{
cpage = (struct cfgitem *)item->data;
break;
@@ -511,17 +503,18 @@
if(!cpage)
{
cpage = g_malloc0(sizeof(struct cfgitem));
- cpage->label = g_strndup(entry.key, len);
+ cpage->label = g_strndup(key, len);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, COL_NUM, num, COL_TITLE, (gpointer)cpage->label, -1);
num++;
page_list = g_list_append(page_list, (gpointer)cpage);
}
citem = g_malloc0(sizeof(struct cfgitem));
- citem->label = g_strdup(entry.key + len + 1);
+ citem->label = g_strdup(key + len + 1);
cpage->subitems = g_list_append(cpage->subitems, (gpointer)citem);
}
- r = xine_config_get_next_entry(media->xine, &entry);
+ r = gtk_xine_config_get_next(GTK_XINE(sinek.xine), key, &nextkey, &value);
+ key = nextkey;
}
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(list_view))), "changed", G_CALLBACK(cb_page), NULL);
-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en