[telegnome] Reorder functions to allow making more of them static. Remove some prototypes for non-existent func
- From: Colin Watson <cjwatson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [telegnome] Reorder functions to allow making more of them static. Remove some prototypes for non-existent func
- Date: Fri, 1 Feb 2013 01:42:33 +0000 (UTC)
commit bf347d3f24a4045449fac1774f8c186222e8994c
Author: Colin Watson <cjwatson debian org>
Date: Fri Feb 1 01:42:21 2013 +0000
Reorder functions to allow making more of them static. Remove some
prototypes for non-existent functions.
ChangeLog | 5 +
src/gui.c | 688 +++++++++++++++++++++++++++++------------------------------
src/gui.h | 5 -
src/prefs.c | 448 ++++++++++++++++++--------------------
4 files changed, 554 insertions(+), 592 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 262e3d7..0a050c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-02-01 Colin Watson <cjwatson debian org>
+ Reorder functions to allow making more of them static. Remove some
+ prototypes for non-existent functions.
+
+2013-02-01 Colin Watson <cjwatson debian org>
+
* src/gui.c (load_channels_from_config, cb_quit): Cast channel_free
to GDestroyNotify.
diff --git a/src/gui.c b/src/gui.c
index 1fd0dc9..b731b96 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -36,133 +36,73 @@
static Gui gui;
-void prefs_close_cb();
-void update_title_bar();
-void refresh_timer();
-
-gint gui_keyboard_timer(gpointer g);
-gint gui_logo_timer(gpointer g);
-gint gui_pager_timer(gpointer g);
-void gui_restore_session(void);
-void gui_save_session(void);
-void cb_toggle_paging(GtkWidget *w, gpointer data);
-
-void die (GnomeClient *client, gpointer client_data);
-int
-save_yourself(GnomeClient *client, int phase, GnomeSaveStyle save_style, int shutdown,
- GnomeInteractStyle interact_style, int fast, gpointer client_data);
-
-void load_channels_from_config();
-GtkWidget *create_channel_menu();
-void gui_channel_select(GtkWidget *w, gpointer data);
-void refresh_channel_menu();
-
-/*******************************
- * return the app gui, with startpage or NULL
- */
-GtkWidget *
-new_gui (gchar* startpage)
+static void
+update_title_bar()
{
- GtkWidget *app, *toolbar, *statusbar;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
- /* the app */
- app= gnome_app_new (PACKAGE, _("TeleGNOME: Teletext for GNOME"));
- /* gtk_window_set_policy(GTK_WINDOW (app), FALSE, FALSE, TRUE); */
- gtk_widget_realize(GTK_WIDGET(app));
-
- toolbar= new_toolbar();
-
- /* attach a keyboard event */
- g_signal_connect (G_OBJECT (app),
- "key_press_event",
- G_CALLBACK (cb_keypress), NULL);
-
- /* attach the menu */
- gnome_app_create_menus(GNOME_APP(app), menubar);
-
- gnome_app_add_toolbar(GNOME_APP(app), GTK_TOOLBAR(toolbar), "nav_toolbar", 0, BONOBO_DOCK_TOP, 2, 0, 0);
-
- /* the view */
- currentview = tele_view_new();
-
- tele_view_set_error_handler(currentview, print_in_statusbar);
- /* the statusbar */
- statusbar= gnome_appbar_new(TRUE,TRUE,GNOME_PREFERENCES_NEVER);
- gnome_app_set_statusbar(GNOME_APP(app), statusbar);
-
- /* make menu hints display on the appbar */
- gnome_app_install_menu_hints(GNOME_APP(app), menubar);
-
- /* all the contents */
- gnome_app_set_contents(GNOME_APP(app), tele_view_get_widget(currentview));
-
- /* save some pointers for reference later */
-
- gui.statusbar= statusbar;
- gui.app= app;
-
- g_signal_connect (G_OBJECT (app), "delete_event",
- G_CALLBACK (cb_quit),
- NULL);
-
- gui.client = gnome_master_client();
- g_signal_connect (G_OBJECT (gui.client), "save_yourself",
- G_CALLBACK (save_yourself),
- NULL); /* fixme? */
- g_signal_connect (G_OBJECT (gui.client), "die",
- G_CALLBACK (die), NULL);
-
-
- gtk_widget_show_all(app);
+ char buf[100];
+ /* update the title bar */
+ if ((currentview != NULL) && (currentview->channel != NULL) &&
+ (currentview->channel->name != NULL) && (currentview->channel->desc != NULL)) {
+ sprintf(buf, _("TeleGNOME: %s (%s)"), currentview->channel->name->str, currentview->channel->desc->str);
+ gtk_window_set_title(GTK_WINDOW(gui.app), buf);
+ }
+}
- gui_restore_session();
+/* removes the logo from the screen and goes to a page */
+static gint
+gui_logo_timer(gpointer g)
+{
+ if (gui.logo_timer != -1)
+ gtk_timeout_remove(gui.logo_timer);
+ gui.logo_timer = -1;
+ get_the_page(FALSE);
+ return 0;
+}
- gui.channels = NULL;
- gui.channel_menu = NULL;
+static void
+gui_restore_session(void)
+{
+ /* the kb timer */
+ gui.kb_timer = -1;
+ gui.kb_status = INPUT_NEW;
- refresh_channel_menu();
+ gui.page_progress = 0;
+ gui.page_timer = -1;
+ gui.page_status = FALSE;
+ gui.default_server = gnome_config_get_int_with_default("/telegnome/Default/server=0", NULL);
- /* FIXME: */
- /* set the current view, at elem 0 */
- currentview->channel = (Channel *)g_slist_nth_data(gui.channels, gui.default_server);
+ gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
+ gui.progress = gnome_appbar_get_progress(GNOME_APPBAR(gui.statusbar));
+ gtk_progress_bar_set_fraction(gui.progress, 0.0);
- update_title_bar();
+ /* the zoom button */
+ /* FIXME */ /*
+ currentview->zoom_factor=gnome_config_get_int_with_default("/telegnome/Zooming/factor=1", NULL);
+ gtk_label_set(GTK_LABEL(gui.zoomlabel), currentview->zoom_factor==1?"100%":"400%");
+ if (currentview->zoom_factor==2) gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(gui.zoombutton));
+ */
- /* check if we are connected to a session manager. If so,
- load up the last page we were visiting. Otherwise,
- start with a logo */
- update_entry(0,0);
- pixbuf = gdk_pixbuf_new_from_file(
- gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP,
- TG_LOGO_PIXMAP, TRUE, NULL),
- &error);
- tele_view_update_pixmap(currentview, pixbuf);
- g_object_unref(pixbuf);
-
- /* only auto-change to a page if it was saved the last time */
+ /* the current page */
+ currentview->page_nr = gnome_config_get_int_with_default("/telegnome/Paging/page_nr=-1", NULL);
+ currentview->subpage_nr = gnome_config_get_int_with_default("/telegnome/Paging/subpage_nr=-1", NULL);
- if (currentview->page_nr >0 )
- gui.logo_timer = gtk_timeout_add(TG_LOGO_TIMEOUT,gui_logo_timer, NULL);
- else
- gui.logo_timer = -1;
-
- /*
- if (GNOME_CLIENT_CONNECTED (gui.client)) {
- update_entry(currentview->page_nr, currentview->subpage_nr);
- get_the_page(TRUE);
- g_print("we are connected to a session manager");
- } else {
- g_print("we are NOT connected to a session manager");
- }
- */
+ /* g_print("Number: %d/%d\n", currentview->page_nr, currentview->subpage_nr); */
+}
- return app;
+static void
+gui_save_session(void)
+{
+ gnome_config_set_bool("/telegnome/Paging/enabled", gui.page_status);
+ gnome_config_set_int("/telegnome/Paging/interval", gui.page_msecs);
+ gnome_config_set_int("/telegnome/Paging/page_nr", currentview->page_nr);
+ gnome_config_set_int("/telegnome/Paging/subpage_nr", currentview->subpage_nr);
+ gnome_config_set_int("/telegnome/Zooming/factor", currentview->zoom_factor);
+ gnome_config_set_int("/telegnome/Default/server", gui.default_server);
+ gnome_config_sync();
}
/* SESSION MANAGEMENT CALLS */
-void
+static void
die (GnomeClient *client, gpointer client_data)
{
/* Just exit in a friendly way. We don't need to
@@ -172,7 +112,7 @@ die (GnomeClient *client, gpointer client_data)
gtk_exit (0);
}
-int
+static int
save_yourself(GnomeClient *client, int phase,
GnomeSaveStyle save_style, int shutdown,
GnomeInteractStyle interact_style, int fast,
@@ -205,53 +145,183 @@ save_yourself(GnomeClient *client, int phase,
gnome_client_set_restart_command (client, 1, argv);
return TRUE;
- }
-void
-gui_restore_session(void)
+}
+
+/* changes the channel */
+static void
+gui_channel_select(GtkWidget *w, gpointer data)
{
- /* the kb timer */
- gui.kb_timer = -1;
- gui.kb_status = INPUT_NEW;
+ Channel *channel;
+ g_assert(data != NULL);
- gui.page_progress = 0;
- gui.page_timer = -1;
- gui.page_status = FALSE;
- gui.default_server = gnome_config_get_int_with_default("/telegnome/Default/server=0", NULL);
+ channel = (Channel *)data;
- gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
- gui.progress = gnome_appbar_get_progress(GNOME_APPBAR(gui.statusbar));
- gtk_progress_bar_set_fraction(gui.progress, 0.0);
+ currentview->channel = channel;
+ currentview->page_nr = 100;
+ currentview->subpage_nr = 0;
- /* the zoom button */
- /* FIXME */ /*
- currentview->zoom_factor=gnome_config_get_int_with_default("/telegnome/Zooming/factor=1", NULL);
- gtk_label_set(GTK_LABEL(gui.zoomlabel), currentview->zoom_factor==1?"100%":"400%");
- if (currentview->zoom_factor==2) gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(gui.zoombutton));
- */
+ update_title_bar();
- /* the current page */
- currentview->page_nr = gnome_config_get_int_with_default("/telegnome/Paging/page_nr=-1", NULL);
- currentview->subpage_nr = gnome_config_get_int_with_default("/telegnome/Paging/subpage_nr=-1", NULL);
+ /* g_print("Channel Selected: %s (%s)\n", channel->name->str, channel->desc->str); */
+ get_the_page(FALSE);
+}
- /* g_print("Number: %d/%d\n", currentview->page_nr, currentview->subpage_nr); */
+/*************************
+ * create the channel menu
+ */
+static GtkWidget *
+create_channel_menu()
+{
+ GtkWidget *menu, *item;
+ int i;
+ Channel *channel;
+
+ g_assert(gui.channels != NULL);
+ menu = gtk_menu_new();
+
+ for (i=0; i<g_slist_length(gui.channels); i++) {
+ channel = (Channel *)g_slist_nth_data(gui.channels, i);
+
+ item = gtk_menu_item_new_with_label(channel->name->str);
+
+ g_signal_connect(G_OBJECT(item), "activate",
+ G_CALLBACK(gui_channel_select), (gpointer)channel);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ gtk_widget_show(item);
+ }
+
+ item = gtk_menu_item_new_with_label(_("Channels"));
+ gtk_widget_show(item);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
+
+ return item;
}
-void gui_save_session(void)
+/*************************
+ * Loads all the channels from the config and puts them in the gui.channels GSList
+ */
+static void
+load_channels_from_config()
{
- gnome_config_set_bool("/telegnome/Paging/enabled", gui.page_status);
- gnome_config_set_int("/telegnome/Paging/interval", gui.page_msecs);
- gnome_config_set_int("/telegnome/Paging/page_nr", currentview->page_nr);
- gnome_config_set_int("/telegnome/Paging/subpage_nr", currentview->subpage_nr);
- gnome_config_set_int("/telegnome/Zooming/factor", currentview->zoom_factor);
- gnome_config_set_int("/telegnome/Default/server", gui.default_server);
- gnome_config_sync();
+ int count,i;
+ Channel *channel;
+
+ if (gui.channels != NULL) {
+ g_slist_free_full(gui.channels, (GDestroyNotify)channel_free);
+ gui.channels = NULL;
+ }
+
+ count = gnome_config_get_int_with_default("/telegnome/Channels/count=0", NULL);
+ if (count > 0) {
+ for (i=0; i<count; i++) {
+ channel = channel_new_from_config(i);
+ gui.channels = g_slist_append(gui.channels, (gpointer)channel);
+ }
+ } else {
+ /* nothing set up yet, fill in some default */
+ count = 1;
+ channel = channel_new(0, "NOS Teletext", "The Dutch teletext pages",
+ "http://teletekst.nos.nl/cgi-bin/tt/nos/gif/%d/",
+ "http://teletekst.nos.nl/cgi-bin/tt/nos/gif/%d-%d",
+ "nl");
+ gui.channels = g_slist_append(gui.channels, (gpointer)channel);
+ /* ...and save it to the config */
+ gnome_config_set_int("/telegnome/Channels/count", 1);
+ channel_save_to_config(channel);
+ }
+}
+
+static void
+refresh_channel_menu()
+{
+ /* dispose the menu if it was already added */
+ if (gui.channel_menu != NULL) {
+ g_object_unref(gui.channel_menu);
+ }
+
+ /* load the channels from disk */
+ load_channels_from_config();
+
+ /* create the menu */
+ gui.channel_menu = create_channel_menu();
+
+ /* and add it to the menu bar */
+ gtk_menu_shell_insert(GTK_MENU_SHELL(GNOME_APP(gui.app)->menubar), gui.channel_menu, 2);
+}
+
+/*******************************
+ * print a string in the statusbar
+ */
+static void
+print_in_statusbar(const char *buf) /*FIXME: buffersize*/
+{
+ g_assert(buf != NULL);
+ gnome_appbar_set_status(GNOME_APPBAR(gui.statusbar), buf);
+ gtk_widget_show(GTK_WIDGET(gui.statusbar));
+}
+
+/*******************************
+ * create a new entry
+ */
+static GtkWidget *
+new_entry ()
+{
+ GtkWidget *entry=NULL;
+ entry=gtk_entry_new();
+ gtk_entry_set_max_length(GTK_ENTRY(entry),
+ TG_PAGE_SIZE + 1 + TG_SUBPAGE_SIZE);
+
+ /* hack */
+ gtk_widget_set_usize(GTK_WIDGET(entry),
+ (8 * (TG_PAGE_SIZE + 1 + TG_SUBPAGE_SIZE)),20);
+
+ /*gtk_entry_set_text(GTK_ENTRY(entry), startpage);*/
+
+ g_signal_connect(G_OBJECT(entry), "activate",
+ G_CALLBACK(cb_goto_page),NULL);
+
+ /* save entry for later ref */
+ gui.entry= entry;
+
+ return entry;
+}
+
+
+static gint
+gui_pager_timer(gpointer g)
+{
+ gui.page_progress += gui.page_msecs/100;
+ gtk_progress_bar_set_fraction(gui.progress, gui.page_progress / (gdouble)gui.page_msecs);
+
+ if (gui.page_progress >= gui.page_msecs) {
+ gui.page_progress = 0;
+ gtk_progress_bar_set_fraction(gui.progress, 0.0);
+ cb_next_page(NULL, NULL);
+ }
+ return 1;
}
+static void
+cb_toggle_paging(GtkWidget *w, gpointer data)
+{
+ gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
+ gtk_progress_bar_set_fraction(gui.progress, 0.0);
+ if (gui.page_status==TRUE) {
+ if (gui.page_timer != -1) gtk_timeout_remove(gui.page_timer);
+ gui.page_timer = -1;
+ gui.page_status = FALSE;
+ gui.page_progress = 0;
+ } else {
+ gui.page_progress = 0;
+ gui.page_status = TRUE;
+ gui.page_timer = gtk_timeout_add(gui.page_msecs/100, gui_pager_timer, NULL);
+ }
+}
/*******************************
* create a new toolbar
*/
-GtkWidget *
+static GtkWidget *
new_toolbar ()
{
GtkWidget *icon, *toolbar, *entry, *hbox, *w;
@@ -321,136 +391,111 @@ new_toolbar ()
return toolbar;
}
-/*************************
- * Loads all the channels from the config and puts them in the gui.channels GSList
+/*******************************
+ * return the app gui, with startpage or NULL
*/
-void
-load_channels_from_config()
+GtkWidget *
+new_gui (gchar* startpage)
{
- int count,i;
- Channel *channel;
+ GtkWidget *app, *toolbar, *statusbar;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
- if (gui.channels != NULL) {
- g_slist_free_full(gui.channels, (GDestroyNotify)channel_free);
- gui.channels = NULL;
- }
+ /* the app */
+ app= gnome_app_new (PACKAGE, _("TeleGNOME: Teletext for GNOME"));
+ /* gtk_window_set_policy(GTK_WINDOW (app), FALSE, FALSE, TRUE); */
+ gtk_widget_realize(GTK_WIDGET(app));
- count = gnome_config_get_int_with_default("/telegnome/Channels/count=0", NULL);
- if (count > 0) {
- for (i=0; i<count; i++) {
- channel = channel_new_from_config(i);
- gui.channels = g_slist_append(gui.channels, (gpointer)channel);
- }
- } else {
- /* nothing set up yet, fill in some default */
- count = 1;
- channel = channel_new(0, "NOS Teletext", "The Dutch teletext pages",
- "http://teletekst.nos.nl/cgi-bin/tt/nos/gif/%d/",
- "http://teletekst.nos.nl/cgi-bin/tt/nos/gif/%d-%d",
- "nl");
- gui.channels = g_slist_append(gui.channels, (gpointer)channel);
- /* ...and save it to the config */
- gnome_config_set_int("/telegnome/Channels/count", 1);
- channel_save_to_config(channel);
- }
-}
+ toolbar= new_toolbar();
-/*************************
- * create the channel menu
- */
-GtkWidget *
-create_channel_menu()
-{
- GtkWidget *menu, *item;
- int i;
- Channel *channel;
+ /* attach a keyboard event */
+ g_signal_connect (G_OBJECT (app),
+ "key_press_event",
+ G_CALLBACK (cb_keypress), NULL);
+
+ /* attach the menu */
+ gnome_app_create_menus(GNOME_APP(app), menubar);
- g_assert(gui.channels != NULL);
- menu = gtk_menu_new();
+ gnome_app_add_toolbar(GNOME_APP(app), GTK_TOOLBAR(toolbar), "nav_toolbar", 0, BONOBO_DOCK_TOP, 2, 0, 0);
- for (i=0; i<g_slist_length(gui.channels); i++) {
- channel = (Channel *)g_slist_nth_data(gui.channels, i);
+ /* the view */
+ currentview = tele_view_new();
- item = gtk_menu_item_new_with_label(channel->name->str);
+ tele_view_set_error_handler(currentview, print_in_statusbar);
+ /* the statusbar */
+ statusbar= gnome_appbar_new(TRUE,TRUE,GNOME_PREFERENCES_NEVER);
+ gnome_app_set_statusbar(GNOME_APP(app), statusbar);
- g_signal_connect(G_OBJECT(item), "activate",
- G_CALLBACK(gui_channel_select), (gpointer)channel);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
- gtk_widget_show(item);
- }
+ /* make menu hints display on the appbar */
+ gnome_app_install_menu_hints(GNOME_APP(app), menubar);
- item = gtk_menu_item_new_with_label(_("Channels"));
- gtk_widget_show(item);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
+ /* all the contents */
+ gnome_app_set_contents(GNOME_APP(app), tele_view_get_widget(currentview));
- return item;
-}
+ /* save some pointers for reference later */
-void update_title_bar()
-{
- char buf[100];
- /* update the title bar */
- if ((currentview != NULL) && (currentview->channel != NULL) &&
- (currentview->channel->name != NULL) && (currentview->channel->desc != NULL)) {
- sprintf(buf, _("TeleGNOME: %s (%s)"), currentview->channel->name->str, currentview->channel->desc->str);
- gtk_window_set_title(GTK_WINDOW(gui.app), buf);
- }
-}
+ gui.statusbar= statusbar;
+ gui.app= app;
-void refresh_channel_menu()
-{
- /* dispose the menu if it was already added */
- if (gui.channel_menu != NULL) {
- g_object_unref(gui.channel_menu);
- }
-
- /* load the channels from disk */
- load_channels_from_config();
+ g_signal_connect (G_OBJECT (app), "delete_event",
+ G_CALLBACK (cb_quit),
+ NULL);
+
+ gui.client = gnome_master_client();
+ g_signal_connect (G_OBJECT (gui.client), "save_yourself",
+ G_CALLBACK (save_yourself),
+ NULL); /* fixme? */
+ g_signal_connect (G_OBJECT (gui.client), "die",
+ G_CALLBACK (die), NULL);
- /* create the menu */
- gui.channel_menu = create_channel_menu();
- /* and add it to the menu bar */
- gtk_menu_shell_insert(GTK_MENU_SHELL(GNOME_APP(gui.app)->menubar), gui.channel_menu, 2);
-}
+ gtk_widget_show_all(app);
-/*******************************
- * create a new entry
- */
-GtkWidget *
-new_entry ()
-{
- GtkWidget *entry=NULL;
- entry=gtk_entry_new();
- gtk_entry_set_max_length(GTK_ENTRY(entry),
- TG_PAGE_SIZE + 1 + TG_SUBPAGE_SIZE);
-
- /* hack */
- gtk_widget_set_usize(GTK_WIDGET(entry),
- (8 * (TG_PAGE_SIZE + 1 + TG_SUBPAGE_SIZE)),20);
-
- /*gtk_entry_set_text(GTK_ENTRY(entry), startpage);*/
-
- g_signal_connect(G_OBJECT(entry), "activate",
- G_CALLBACK(cb_goto_page),NULL);
+ gui_restore_session();
- /* save entry for later ref */
- gui.entry= entry;
+ gui.channels = NULL;
+ gui.channel_menu = NULL;
- return entry;
-}
+ refresh_channel_menu();
-/*******************************
- * print a string in the statusbar
- */
-void
-print_in_statusbar(const char *buf) /*FIXME: buffersize*/
-{
- g_assert(buf != NULL);
- gnome_appbar_set_status(GNOME_APPBAR(gui.statusbar), buf);
- gtk_widget_show(GTK_WIDGET(gui.statusbar));
+ /* FIXME: */
+ /* set the current view, at elem 0 */
+ currentview->channel = (Channel *)g_slist_nth_data(gui.channels, gui.default_server);
+
+ update_title_bar();
+
+ /* check if we are connected to a session manager. If so,
+ load up the last page we were visiting. Otherwise,
+ start with a logo */
+ update_entry(0,0);
+ pixbuf = gdk_pixbuf_new_from_file(
+ gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP,
+ TG_LOGO_PIXMAP, TRUE, NULL),
+ &error);
+ tele_view_update_pixmap(currentview, pixbuf);
+ g_object_unref(pixbuf);
+
+ /* only auto-change to a page if it was saved the last time */
+
+ if (currentview->page_nr >0 )
+ gui.logo_timer = gtk_timeout_add(TG_LOGO_TIMEOUT,gui_logo_timer, NULL);
+ else
+ gui.logo_timer = -1;
+
+ /*
+ if (GNOME_CLIENT_CONNECTED (gui.client)) {
+ update_entry(currentview->page_nr, currentview->subpage_nr);
+ get_the_page(TRUE);
+ g_print("we are connected to a session manager");
+ } else {
+ g_print("we are NOT connected to a session manager");
+ }
+ */
+
+ return app;
}
+
/*******************************
* update the entry box with the current values of page & subpage
*/
@@ -556,7 +601,31 @@ cb_about (GtkWidget* widget, gpointer data)
gtk_widget_show(about);
}
-void
+static void
+refresh_timer()
+{
+ gdouble perc = gtk_progress_bar_get_fraction(gui.progress);
+
+ gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
+ gui.progress = gnome_appbar_get_progress(GNOME_APPBAR(gui.statusbar));
+ gtk_progress_bar_set_fraction(gui.progress, perc);
+
+ if (gui.page_status == TRUE) {
+ gtk_timeout_remove(gui.page_timer);
+ gui.page_timer = gtk_timeout_add(gui.page_msecs/100, gui_pager_timer, NULL);
+ }
+
+ gui.page_progress =(int)((gui.page_msecs/100)*perc);
+}
+
+static void
+prefs_close_cb()
+{
+ refresh_channel_menu();
+ refresh_timer();
+}
+
+void
cb_preferences (GtkWidget* widget, gpointer data)
{
prefs_show();
@@ -657,6 +726,15 @@ cb_drag (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection
}
}
+static gint
+gui_keyboard_timer(gpointer g)
+{
+ gtk_timeout_remove(gui.kb_timer);
+ gui.kb_timer = -1;
+ gui.kb_status = INPUT_NEW;
+ return 0;
+}
+
gint
cb_keypress (GtkWidget *widget, GdkEventKey *event)
{
@@ -680,97 +758,3 @@ cb_keypress (GtkWidget *widget, GdkEventKey *event)
gui.kb_status = INPUT_CONTINUED;
return 0;
}
-
-gint
-gui_keyboard_timer(gpointer g)
-{
- gtk_timeout_remove(gui.kb_timer);
- gui.kb_timer = -1;
- gui.kb_status = INPUT_NEW;
- return 0;
-}
-
-
-void
-cb_toggle_paging(GtkWidget *w, gpointer data)
-{
- gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
- gtk_progress_bar_set_fraction(gui.progress, 0.0);
- if (gui.page_status==TRUE) {
- if (gui.page_timer != -1) gtk_timeout_remove(gui.page_timer);
- gui.page_timer = -1;
- gui.page_status = FALSE;
- gui.page_progress = 0;
- } else {
- gui.page_progress = 0;
- gui.page_status = TRUE;
- gui.page_timer = gtk_timeout_add(gui.page_msecs/100, gui_pager_timer, NULL);
- }
-}
-
-gint
-gui_pager_timer(gpointer g)
-{
- gui.page_progress += gui.page_msecs/100;
- gtk_progress_bar_set_fraction(gui.progress, gui.page_progress / (gdouble)gui.page_msecs);
-
- if (gui.page_progress >= gui.page_msecs) {
- gui.page_progress = 0;
- gtk_progress_bar_set_fraction(gui.progress, 0.0);
- cb_next_page(NULL, NULL);
- }
- return 1;
-}
-
-
-/* removes the logo from the screen and goes to a page */
-gint
-gui_logo_timer(gpointer g)
-{
- if (gui.logo_timer != -1)
- gtk_timeout_remove(gui.logo_timer);
- gui.logo_timer = -1;
- get_the_page(FALSE);
- return 0;
-}
-
-/* changes the channel */
-void
-gui_channel_select(GtkWidget *w, gpointer data)
-{
- Channel *channel;
- g_assert(data != NULL);
-
- channel = (Channel *)data;
-
- currentview->channel = channel;
- currentview->page_nr = 100;
- currentview->subpage_nr = 0;
-
- update_title_bar();
-
- /* g_print("Channel Selected: %s (%s)\n", channel->name->str, channel->desc->str); */
- get_the_page(FALSE);
-}
-
-void refresh_timer()
-{
- gdouble perc = gtk_progress_bar_get_fraction(gui.progress);
-
- gui.page_msecs = gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL, NULL);
- gui.progress = gnome_appbar_get_progress(GNOME_APPBAR(gui.statusbar));
- gtk_progress_bar_set_fraction(gui.progress, perc);
-
- if (gui.page_status == TRUE) {
- gtk_timeout_remove(gui.page_timer);
- gui.page_timer = gtk_timeout_add(gui.page_msecs/100, gui_pager_timer, NULL);
- }
-
- gui.page_progress =(int)((gui.page_msecs/100)*perc);
-}
-
-void prefs_close_cb()
-{
- refresh_channel_menu();
- refresh_timer();
-}
diff --git a/src/gui.h b/src/gui.h
index 8d63928..4cbddcf 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -37,13 +37,8 @@
#define TG_MAX_CHANNELS 100
GtkWidget *new_gui();
-GtkWidget *new_toolbar(void);
-GtkWidget *new_entry ();
-GtkWidget *new_pixmap(GdkWindow *window);
-void print_in_statusbar (const char *buf);
int update_entry (gint page_nr, gint subpage_nr);
-gint update_pixmap (char *filename, gboolean redraw);
void get_the_page(gboolean redraw);
diff --git a/src/prefs.c b/src/prefs.c
index 0c7e54f..f7a6583 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -30,27 +30,6 @@
#include "channel.h"
#include "main.h"
-/* not a good idea to have a 'misc' page, but i cant come up with a better name */
-GtkWidget *construct_misc_page();
-GtkWidget *construct_channels_page();
-
-gboolean edit_channel(Channel *orig); /* makes an edit dialog for the channel */
-void edit_channel_changed(GtkWidget *dialog, gpointer data); /* callback for changed */
-
-void prefs_cancel_cb(void);
-void prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num);
-
-void prefs_channel_add_cb(void);
-void prefs_channel_move_up_cb(void);
-void prefs_channel_move_down_cb(void);
-void prefs_channel_edit_cb(void);
-void prefs_channel_delete_cb(void);
-
-
-void prefs_channel_list_click_cb( GtkWidget *clist, gint row, gint column,
- GdkEventButton *event, gpointer data);
-void fill_channel_list();
-void prefs_channels_renum();
typedef struct _PrefsWindow {
GnomePropertyBox *box;
@@ -76,56 +55,7 @@ void set_close_cb( void (*c)() )
prefs_window->close_callback = c;
}
-void
-prefs_show(void)
-{
- GtkWidget *page;
-
- if (prefs_window != NULL) {
- gdk_window_show(gtk_widget_get_window(GTK_WIDGET(prefs_window->box)));
- gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(prefs_window->box)));
- } else {
- prefs_window = g_malloc(sizeof(PrefsWindow));
-
- prefs_window->box = GNOME_PROPERTY_BOX (gnome_property_box_new());
- gtk_window_set_title (GTK_WINDOW(prefs_window->box), _("TeleGNOME: Preferences"));
-
- page = construct_channels_page();
- gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
- page,
- gtk_label_new(_("Channels")));
-
- page = construct_misc_page();
- gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
- page,
- gtk_label_new(_("Misc")));
-
-
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK(prefs_window->box->notebook),
- TRUE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK(prefs_window->box->notebook),
- TRUE);
-
- g_signal_connect (G_OBJECT (prefs_window->box), "apply",
- G_CALLBACK (prefs_apply_cb), NULL);
- g_signal_connect (G_OBJECT (prefs_window->box), "destroy",
- G_CALLBACK (prefs_cancel_cb), NULL);
-
- g_signal_connect_swapped(G_OBJECT(prefs_window->interval_entry), "changed",
- G_CALLBACK(gnome_property_box_changed),
- G_OBJECT(prefs_window->box));
-
- g_signal_connect_swapped(G_OBJECT(prefs_window->proxy_entry), "changed",
- G_CALLBACK(gnome_property_box_changed),
- G_OBJECT(prefs_window->box));
-
-
- /* and, show them all */
- gtk_widget_show_all(GTK_WIDGET(prefs_window->box));
- }
-}
-
-void
+static void
fill_channel_list()
{
int i, newrow;
@@ -148,115 +78,7 @@ fill_channel_list()
gtk_clist_thaw(GTK_CLIST(prefs_window->channel_list));
}
-GtkWidget *
-construct_misc_page()
-{
- GtkWidget *table, *frame, *label, *entry, *proxy_label, *proxy_entry;
- GtkAdjustment *adj;
-
- g_assert(prefs_window != NULL);
-
- table = gtk_table_new(2,2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 5);
- gtk_table_set_col_spacings(GTK_TABLE(table), 5);
-
- label = gtk_label_new(_("Paging interval"));
- gtk_widget_set_tooltip_text(label, _("Specifies the interval for the auto-pager, in milliseconds."));
-
- adj = GTK_ADJUSTMENT(gtk_adjustment_new(8000.0, 1000.0, 60000.0, 1000.0, 10.0, 0.0));
- entry = gtk_spin_button_new(adj, 0.5, 0);
-
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 0,1);
- gtk_table_attach_defaults(GTK_TABLE(table), entry, 1,2, 0,1);
-
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry),
- gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL,NULL));
- proxy_label = gtk_label_new(_("Proxy server"));
- proxy_entry = gtk_entry_new();
- gtk_entry_set_max_length(GTK_ENTRY(proxy_entry), 100);
- gtk_entry_set_text(GTK_ENTRY(proxy_entry),
- gnome_config_get_string_with_default("/telegnome/Proxy/http_proxy=" "",NULL));
-
- gtk_table_attach_defaults(GTK_TABLE(table), proxy_label, 0,1, 1,2);
- gtk_table_attach_defaults(GTK_TABLE(table), proxy_entry, 1,2, 1,2);
-
- frame = gtk_frame_new(_("Miscelaneous"));
-
- gtk_container_set_border_width( GTK_CONTAINER(frame), 5);
- gtk_container_set_border_width( GTK_CONTAINER(table), 5);
- gtk_container_add( GTK_CONTAINER(frame), table);
-
- prefs_window->interval_entry = entry;
- prefs_window->proxy_entry = proxy_entry;
- return frame;
-}
-
-GtkWidget *
-construct_channels_page()
-{
- GtkWidget *hbox, *vbox, *btn;
- char *titles[2] = { N_("Country"), N_("Name") };
- g_assert(prefs_window != NULL);
-
- hbox = gtk_hbox_new(FALSE, 0);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- /* the clist */
- prefs_window->channel_list = gtk_clist_new_with_titles( 2, titles );
- gtk_box_pack_start(GTK_BOX(vbox), prefs_window->channel_list, TRUE, TRUE, 0);
-
- /* label for descriptions and stuff */
- prefs_window->channel_label = gtk_label_new("");
- gtk_container_set_border_width( GTK_CONTAINER(vbox), 10);
- gtk_box_pack_start(GTK_BOX(vbox), prefs_window->channel_label, TRUE, TRUE, 0);
-
- gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE , 0);
-
- /* fill channel list */
- fill_channel_list();
-
- g_signal_connect(G_OBJECT(prefs_window->channel_list), "select_row",
- G_CALLBACK(prefs_channel_list_click_cb),
- NULL);
-
- vbox = gtk_vbox_new(TRUE, 0);
-
- /* move up button */
- btn = gtk_button_new_with_label(_("Move up"));
- /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
- gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
- g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_move_up_cb), NULL);
- /* move down button */
- btn = gtk_button_new_with_label(_("Move down"));
- /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
- gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
- g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_move_down_cb), NULL);
- /* add button */
- btn = gtk_button_new_with_label(_("Add..."));
- /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
- gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
- g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_add_cb), NULL);
-
- /* delete button */
- btn = gtk_button_new_with_label(_("Delete"));
- /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_REMOVE); */
- gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
- g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_delete_cb), NULL);
-
- /* edit buton */
- btn = gtk_button_new_with_label(_("Edit"));
- /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_PROPERTIES); */
- gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
- g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_edit_cb), NULL);
-
- gtk_box_pack_start_defaults(GTK_BOX(hbox), vbox);
-
- gtk_container_set_border_width( GTK_CONTAINER(hbox), 5);
- return hbox;
-}
-
-void
+static void
edit_channel_changed(GtkWidget *dialog, gpointer data)
{
gnome_dialog_set_sensitive(GNOME_DIALOG(data), 0, TRUE);
@@ -264,7 +86,7 @@ edit_channel_changed(GtkWidget *dialog, gpointer data)
/* pops up a modal dialog, editing the channel. */
-gboolean
+static gboolean
edit_channel(Channel *orig)
{
GtkWidget *dialog, *table, *label, *name, *page, *subpage, *desc, *country, *frame;
@@ -348,54 +170,14 @@ edit_channel(Channel *orig)
return changed;
}
-
-
-/* *------------------------------------------------------------------------* */
-
-/* pref window callbacks */
-void
-prefs_channel_move_up_cb(void)
-{
- GList *list;
- int row;
-
- if ((list = GTK_CLIST(prefs_window->channel_list)->selection) == NULL)
- return;
- row = GPOINTER_TO_INT(list->data);
-
- if (row >0) {
- gtk_clist_swap_rows (GTK_CLIST(prefs_window->channel_list), row, row-1);
- gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
- prefs_channels_renum();
- }
-}
-
-void
-prefs_channel_move_down_cb(void)
-{
- GList *list;
- int row;
-
- if ((list = GTK_CLIST(prefs_window->channel_list)->selection) == NULL)
- return;
- row = GPOINTER_TO_INT(list->data);
-
- if (row < GTK_CLIST( prefs_window->channel_list)->rows-1) {
- gtk_clist_swap_rows (GTK_CLIST(prefs_window->channel_list), row, row+1);
- gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
- prefs_channels_renum();
- }
-}
-
-
-void
+static void
prefs_cancel_cb(void)
{
g_clear_object(&prefs_window->box);
g_clear_pointer(&prefs_window, g_free);
}
-void
+static void
prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
{
int i;
@@ -419,8 +201,9 @@ prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
(*prefs_window->close_callback)();
}
-void prefs_channel_list_click_cb( GtkWidget *clist, gint row, gint column,
- GdkEventButton *event, gpointer data)
+static void
+prefs_channel_list_click_cb(GtkWidget *clist, gint row, gint column,
+ GdkEventButton *event, gpointer data)
{
Channel *channel;
channel = gtk_clist_get_row_data(GTK_CLIST(clist), row);
@@ -429,7 +212,19 @@ void prefs_channel_list_click_cb( GtkWidget *clist, gint row, gint column,
channel->desc->str);
}
-void prefs_channel_add_cb(void)
+static void
+prefs_channels_renum()
+{
+ int i;
+ Channel *channel;
+ for (i=0; i < GTK_CLIST(prefs_window->channel_list)->rows; i++) {
+ channel = gtk_clist_get_row_data(GTK_CLIST(prefs_window->channel_list), i);
+ channel->id = i;
+ }
+}
+
+static void
+prefs_channel_add_cb(void)
{
Channel *chan;
char *info[2];
@@ -448,7 +243,42 @@ void prefs_channel_add_cb(void)
}
}
-void prefs_channel_edit_cb(void)
+static void
+prefs_channel_move_up_cb(void)
+{
+ GList *list;
+ int row;
+
+ if ((list = GTK_CLIST(prefs_window->channel_list)->selection) == NULL)
+ return;
+ row = GPOINTER_TO_INT(list->data);
+
+ if (row >0) {
+ gtk_clist_swap_rows (GTK_CLIST(prefs_window->channel_list), row, row-1);
+ gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
+ prefs_channels_renum();
+ }
+}
+
+void
+prefs_channel_move_down_cb(void)
+{
+ GList *list;
+ int row;
+
+ if ((list = GTK_CLIST(prefs_window->channel_list)->selection) == NULL)
+ return;
+ row = GPOINTER_TO_INT(list->data);
+
+ if (row < GTK_CLIST( prefs_window->channel_list)->rows-1) {
+ gtk_clist_swap_rows (GTK_CLIST(prefs_window->channel_list), row, row+1);
+ gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
+ prefs_channels_renum();
+ }
+}
+
+static void
+prefs_channel_edit_cb(void)
{
GList *list;
int row;
@@ -470,7 +300,8 @@ void prefs_channel_edit_cb(void)
}
-void prefs_channel_delete_cb(void)
+static void
+prefs_channel_delete_cb(void)
{
GList *list;
int row;
@@ -486,13 +317,160 @@ void prefs_channel_delete_cb(void)
gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
}
-void
-prefs_channels_renum()
+/* not a good idea to have a 'misc' page, but i cant come up with a better name */
+static GtkWidget *
+construct_misc_page()
{
- int i;
- Channel *channel;
- for (i=0; i < GTK_CLIST(prefs_window->channel_list)->rows; i++) {
- channel = gtk_clist_get_row_data(GTK_CLIST(prefs_window->channel_list), i);
- channel->id = i;
+ GtkWidget *table, *frame, *label, *entry, *proxy_label, *proxy_entry;
+ GtkAdjustment *adj;
+
+ g_assert(prefs_window != NULL);
+
+ table = gtk_table_new(2,2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 5);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 5);
+
+ label = gtk_label_new(_("Paging interval"));
+ gtk_widget_set_tooltip_text(label, _("Specifies the interval for the auto-pager, in milliseconds."));
+
+ adj = GTK_ADJUSTMENT(gtk_adjustment_new(8000.0, 1000.0, 60000.0, 1000.0, 10.0, 0.0));
+ entry = gtk_spin_button_new(adj, 0.5, 0);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 0,1);
+ gtk_table_attach_defaults(GTK_TABLE(table), entry, 1,2, 0,1);
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry),
+ gnome_config_get_int_with_default("/telegnome/Paging/interval=" DEFAULT_INTERVAL,NULL));
+ proxy_label = gtk_label_new(_("Proxy server"));
+ proxy_entry = gtk_entry_new();
+ gtk_entry_set_max_length(GTK_ENTRY(proxy_entry), 100);
+ gtk_entry_set_text(GTK_ENTRY(proxy_entry),
+ gnome_config_get_string_with_default("/telegnome/Proxy/http_proxy=" "",NULL));
+
+ gtk_table_attach_defaults(GTK_TABLE(table), proxy_label, 0,1, 1,2);
+ gtk_table_attach_defaults(GTK_TABLE(table), proxy_entry, 1,2, 1,2);
+
+ frame = gtk_frame_new(_("Miscelaneous"));
+
+ gtk_container_set_border_width( GTK_CONTAINER(frame), 5);
+ gtk_container_set_border_width( GTK_CONTAINER(table), 5);
+ gtk_container_add( GTK_CONTAINER(frame), table);
+
+ prefs_window->interval_entry = entry;
+ prefs_window->proxy_entry = proxy_entry;
+ return frame;
+}
+
+static GtkWidget *
+construct_channels_page()
+{
+ GtkWidget *hbox, *vbox, *btn;
+ char *titles[2] = { N_("Country"), N_("Name") };
+ g_assert(prefs_window != NULL);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+
+ /* the clist */
+ prefs_window->channel_list = gtk_clist_new_with_titles( 2, titles );
+ gtk_box_pack_start(GTK_BOX(vbox), prefs_window->channel_list, TRUE, TRUE, 0);
+
+ /* label for descriptions and stuff */
+ prefs_window->channel_label = gtk_label_new("");
+ gtk_container_set_border_width( GTK_CONTAINER(vbox), 10);
+ gtk_box_pack_start(GTK_BOX(vbox), prefs_window->channel_label, TRUE, TRUE, 0);
+
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE , 0);
+
+ /* fill channel list */
+ fill_channel_list();
+
+ g_signal_connect(G_OBJECT(prefs_window->channel_list), "select_row",
+ G_CALLBACK(prefs_channel_list_click_cb),
+ NULL);
+
+ vbox = gtk_vbox_new(TRUE, 0);
+
+ /* move up button */
+ btn = gtk_button_new_with_label(_("Move up"));
+ /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
+ gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_move_up_cb), NULL);
+ /* move down button */
+ btn = gtk_button_new_with_label(_("Move down"));
+ /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
+ gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_move_down_cb), NULL);
+ /* add button */
+ btn = gtk_button_new_with_label(_("Add..."));
+ /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_ADD); */
+ gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_add_cb), NULL);
+
+ /* delete button */
+ btn = gtk_button_new_with_label(_("Delete"));
+ /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_REMOVE); */
+ gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_delete_cb), NULL);
+
+ /* edit buton */
+ btn = gtk_button_new_with_label(_("Edit"));
+ /* btn = gnome_stock_or_ordinary_button(GNOME_STOCK_PIXMAP_PROPERTIES); */
+ gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 2);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(prefs_channel_edit_cb), NULL);
+
+ gtk_box_pack_start_defaults(GTK_BOX(hbox), vbox);
+
+ gtk_container_set_border_width( GTK_CONTAINER(hbox), 5);
+ return hbox;
+}
+
+void
+prefs_show(void)
+{
+ GtkWidget *page;
+
+ if (prefs_window != NULL) {
+ gdk_window_show(gtk_widget_get_window(GTK_WIDGET(prefs_window->box)));
+ gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(prefs_window->box)));
+ } else {
+ prefs_window = g_malloc(sizeof(PrefsWindow));
+
+ prefs_window->box = GNOME_PROPERTY_BOX (gnome_property_box_new());
+ gtk_window_set_title (GTK_WINDOW(prefs_window->box), _("TeleGNOME: Preferences"));
+
+ page = construct_channels_page();
+ gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
+ page,
+ gtk_label_new(_("Channels")));
+
+ page = construct_misc_page();
+ gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
+ page,
+ gtk_label_new(_("Misc")));
+
+
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK(prefs_window->box->notebook),
+ TRUE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK(prefs_window->box->notebook),
+ TRUE);
+
+ g_signal_connect (G_OBJECT (prefs_window->box), "apply",
+ G_CALLBACK (prefs_apply_cb), NULL);
+ g_signal_connect (G_OBJECT (prefs_window->box), "destroy",
+ G_CALLBACK (prefs_cancel_cb), NULL);
+
+ g_signal_connect_swapped(G_OBJECT(prefs_window->interval_entry), "changed",
+ G_CALLBACK(gnome_property_box_changed),
+ G_OBJECT(prefs_window->box));
+
+ g_signal_connect_swapped(G_OBJECT(prefs_window->proxy_entry), "changed",
+ G_CALLBACK(gnome_property_box_changed),
+ G_OBJECT(prefs_window->box));
+
+
+ /* and, show them all */
+ gtk_widget_show_all(GTK_WIDGET(prefs_window->box));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]