[telegnome] Force some consistency on structure and function names
- From: Colin Watson <cjwatson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [telegnome] Force some consistency on structure and function names
- Date: Fri, 10 Oct 2014 23:34:37 +0000 (UTC)
commit 6313ae836b33e505f890d6174a0f10304d401f26
Author: Colin Watson <cjwatson debian org>
Date: Sat Oct 11 00:34:19 2014 +0100
Force some consistency on structure and function names
Rename principal structures to Tg* and all functions to tg_*, in
preparation for converting everything to a more conventional GObject
structure. No functional changes.
ChangeLog | 6 ++
src/channel.c | 21 +++---
src/channel.h | 12 ++--
src/gui.c | 218 ++++++++++++++++++++++++++++----------------------------
src/gui.h | 33 +++++----
src/http.c | 8 +-
src/http.h | 6 +-
src/main.c | 4 +-
src/main.h | 2 +-
src/menu.h | 6 +-
src/pixpack.c | 118 +++++++++++++++---------------
src/pixpack.h | 26 ++++----
src/prefs.c | 110 ++++++++++++++--------------
src/prefs.h | 4 +-
src/view.c | 46 ++++++------
src/view.h | 20 +++---
16 files changed, 324 insertions(+), 316 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0a050c3..11c8a19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-11 Colin Watson <cjwatson debian org>
+
+ Rename principal structures to Tg* and all functions to tg_*, in
+ preparation for converting everything to a more conventional GObject
+ structure. No functional changes.
+
2013-02-01 Colin Watson <cjwatson debian org>
Reorder functions to allow making more of them static. Remove some
diff --git a/src/channel.c b/src/channel.c
index e8ac4dd..d5c6b39 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -29,11 +29,11 @@
#include "channel.h"
-Channel *
-channel_new(int id, const char *name, const char *desc, const char *page_url, const char *subpage_url, const
char *country)
+TgChannel *
+tg_channel_new(int id, const char *name, const char *desc, const char *page_url, const char *subpage_url,
const char *country)
{
- Channel *t;
- t = g_malloc(sizeof(Channel));
+ TgChannel *t;
+ t = g_malloc(sizeof(TgChannel));
t->id = id;
t->name = g_string_new(name);
@@ -45,12 +45,12 @@ channel_new(int id, const char *name, const char *desc, const char *page_url, co
return t;
}
-Channel *
-channel_new_from_config(int id)
+TgChannel *
+tg_channel_new_from_config(int id)
{
- Channel *t;
+ TgChannel *t;
GString *prefix;
- t = g_malloc(sizeof(Channel));
+ t = g_malloc(sizeof(TgChannel));
prefix = g_string_new(NULL);
g_string_printf(prefix, "/telegnome/Channel%d/", id);
@@ -68,7 +68,8 @@ channel_new_from_config(int id)
return t;
}
-void channel_save_to_config(Channel *channel)
+void
+tg_channel_save_to_config(TgChannel *channel)
{
GString *prefix;
@@ -90,7 +91,7 @@ void channel_save_to_config(Channel *channel)
void
-channel_free(Channel *channel)
+tg_channel_free(TgChannel *channel)
{
g_assert(channel != NULL);
g_string_free(channel->name, TRUE);
diff --git a/src/channel.h b/src/channel.h
index 87a36de..6794bdb 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -29,18 +29,18 @@
#include <glib.h>
-typedef struct _Channel {
+typedef struct _TgChannel {
gint id;
GString *name,
*desc,
*page_url,
*subpage_url,
*country;
-} Channel;
+} TgChannel;
-Channel *channel_new(int id, const char *name, const char *desc, const char *page_url, const char
*subpage_url, const char *country);
-Channel *channel_new_from_config(int id);
-void channel_save_to_config(Channel *channel);
-void channel_free(Channel *channel);
+TgChannel *tg_channel_new(int id, const char *name, const char *desc, const char *page_url, const char
*subpage_url, const char *country);
+TgChannel *tg_channel_new_from_config(int id);
+void tg_channel_save_to_config(TgChannel *channel);
+void tg_channel_free(TgChannel *channel);
#endif
diff --git a/src/gui.c b/src/gui.c
index b731b96..4719d0b 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -34,10 +34,10 @@
#include "menu.h"
#include "channel.h"
-static Gui gui;
+static TgGui gui;
static void
-update_title_bar()
+tg_gui_update_title_bar()
{
char buf[100];
/* update the title bar */
@@ -50,17 +50,17 @@ update_title_bar()
/* removes the logo from the screen and goes to a page */
static gint
-gui_logo_timer(gpointer g)
+tg_gui_logo_timer(gpointer g)
{
if (gui.logo_timer != -1)
gtk_timeout_remove(gui.logo_timer);
gui.logo_timer = -1;
- get_the_page(FALSE);
+ tg_gui_get_the_page(FALSE);
return 0;
}
static void
-gui_restore_session(void)
+tg_gui_restore_session(void)
{
/* the kb timer */
gui.kb_timer = -1;
@@ -90,7 +90,7 @@ gui_restore_session(void)
}
static void
-gui_save_session(void)
+tg_gui_save_session(void)
{
gnome_config_set_bool("/telegnome/Paging/enabled", gui.page_status);
gnome_config_set_int("/telegnome/Paging/interval", gui.page_msecs);
@@ -103,7 +103,7 @@ gui_save_session(void)
/* SESSION MANAGEMENT CALLS */
static void
-die (GnomeClient *client, gpointer client_data)
+tg_gui_die (GnomeClient *client, gpointer client_data)
{
/* Just exit in a friendly way. We don't need to
save any state here, because the session manager
@@ -113,17 +113,17 @@ die (GnomeClient *client, gpointer client_data)
}
static int
-save_yourself(GnomeClient *client, int phase,
- GnomeSaveStyle save_style, int shutdown,
- GnomeInteractStyle interact_style, int fast,
- gpointer client_data)
+tg_gui_save_yourself(GnomeClient *client, int phase,
+ GnomeSaveStyle save_style, int shutdown,
+ GnomeInteractStyle interact_style, int fast,
+ gpointer client_data)
{
/*this is a "discard" command for discarding data from
a saved session, usually this will work*/
char *argv[]= { "rm", "-r", NULL };
/* Save the state using gnome-config stuff. */
- gui_save_session();
+ tg_gui_save_session();
/* Here is the real SM code. We set the argv to the
parameters needed to restart/discard the session that
@@ -139,7 +139,7 @@ save_yourself(GnomeClient *client, int phase,
whatever magic option is required to set the session
id on startup. The client_data was set to the
command used to start this application when
- save_yourself handler was connected. */
+ tg_gui_save_yourself handler was connected. */
argv[0]= (gchar*) client_data;
gnome_client_set_clone_command (client, 1, argv);
gnome_client_set_restart_command (client, 1, argv);
@@ -149,43 +149,43 @@ save_yourself(GnomeClient *client, int phase,
/* changes the channel */
static void
-gui_channel_select(GtkWidget *w, gpointer data)
+tg_gui_channel_select(GtkWidget *w, gpointer data)
{
- Channel *channel;
+ TgChannel *channel;
g_assert(data != NULL);
- channel = (Channel *)data;
+ channel = (TgChannel *)data;
currentview->channel = channel;
currentview->page_nr = 100;
currentview->subpage_nr = 0;
- update_title_bar();
+ tg_gui_update_title_bar();
/* g_print("Channel Selected: %s (%s)\n", channel->name->str, channel->desc->str); */
- get_the_page(FALSE);
+ tg_gui_get_the_page(FALSE);
}
/*************************
* create the channel menu
*/
static GtkWidget *
-create_channel_menu()
+tg_gui_create_channel_menu()
{
GtkWidget *menu, *item;
int i;
- Channel *channel;
+ TgChannel *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);
+ channel = (TgChannel *)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);
+ G_CALLBACK(tg_gui_channel_select), (gpointer)channel);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_widget_show(item);
}
@@ -201,38 +201,39 @@ create_channel_menu()
* Loads all the channels from the config and puts them in the gui.channels GSList
*/
static void
-load_channels_from_config()
+tg_gui_load_channels_from_config()
{
int count,i;
- Channel *channel;
+ TgChannel *channel;
if (gui.channels != NULL) {
- g_slist_free_full(gui.channels, (GDestroyNotify)channel_free);
+ g_slist_free_full(gui.channels, (GDestroyNotify)tg_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);
+ channel = tg_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");
+ channel = tg_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);
+ tg_channel_save_to_config(channel);
}
}
static void
-refresh_channel_menu()
+tg_gui_refresh_channel_menu()
{
/* dispose the menu if it was already added */
if (gui.channel_menu != NULL) {
@@ -240,10 +241,10 @@ refresh_channel_menu()
}
/* load the channels from disk */
- load_channels_from_config();
+ tg_gui_load_channels_from_config();
/* create the menu */
- gui.channel_menu = create_channel_menu();
+ gui.channel_menu = tg_gui_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);
@@ -253,7 +254,7 @@ refresh_channel_menu()
* print a string in the statusbar
*/
static void
-print_in_statusbar(const char *buf) /*FIXME: buffersize*/
+tg_gui_print_in_statusbar(const char *buf) /*FIXME: buffersize*/
{
g_assert(buf != NULL);
gnome_appbar_set_status(GNOME_APPBAR(gui.statusbar), buf);
@@ -264,7 +265,7 @@ print_in_statusbar(const char *buf) /*FIXME: buffersize*/
* create a new entry
*/
static GtkWidget *
-new_entry ()
+tg_gui_new_entry ()
{
GtkWidget *entry=NULL;
entry=gtk_entry_new();
@@ -278,7 +279,7 @@ new_entry ()
/*gtk_entry_set_text(GTK_ENTRY(entry), startpage);*/
g_signal_connect(G_OBJECT(entry), "activate",
- G_CALLBACK(cb_goto_page),NULL);
+ G_CALLBACK(tg_gui_cb_goto_page), NULL);
/* save entry for later ref */
gui.entry= entry;
@@ -288,7 +289,7 @@ new_entry ()
static gint
-gui_pager_timer(gpointer g)
+tg_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);
@@ -296,13 +297,13 @@ gui_pager_timer(gpointer g)
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);
+ tg_gui_cb_next_page(NULL, NULL);
}
return 1;
}
static void
-cb_toggle_paging(GtkWidget *w, gpointer data)
+tg_gui_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);
@@ -314,7 +315,7 @@ cb_toggle_paging(GtkWidget *w, gpointer data)
} else {
gui.page_progress = 0;
gui.page_status = TRUE;
- gui.page_timer = gtk_timeout_add(gui.page_msecs/100, gui_pager_timer, NULL);
+ gui.page_timer = gtk_timeout_add(gui.page_msecs/100, tg_gui_pager_timer, NULL);
}
}
@@ -322,7 +323,7 @@ cb_toggle_paging(GtkWidget *w, gpointer data)
* create a new toolbar
*/
static GtkWidget *
-new_toolbar ()
+tg_gui_new_toolbar ()
{
GtkWidget *icon, *toolbar, *entry, *hbox, *w;
@@ -334,7 +335,7 @@ new_toolbar ()
gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 5);
/* add the entry */
- entry= new_entry();
+ entry = tg_gui_new_entry();
gtk_widget_set_tooltip_text(entry, _("Page number"));
gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
@@ -344,25 +345,25 @@ new_toolbar ()
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
NULL, _("Go To Page"),
- NULL, icon, G_CALLBACK(cb_goto_page), NULL);
+ NULL, icon, G_CALLBACK(tg_gui_cb_goto_page), NULL);
icon = gtk_image_new_from_stock(GTK_STOCK_GO_BACK,
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
NULL, _("Get Previous Page"),
- NULL, icon, G_CALLBACK(cb_prev_page), NULL);
+ NULL, icon, G_CALLBACK(tg_gui_cb_prev_page), NULL);
icon = gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD,
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
NULL, _("Get Next Page"),
- NULL, icon, G_CALLBACK(cb_next_page), NULL);
+ NULL, icon, G_CALLBACK(tg_gui_cb_next_page), NULL);
icon = gtk_image_new_from_stock(GTK_STOCK_HOME,
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
NULL, _("Go to the home page"),
- NULL, icon, G_CALLBACK(cb_home), NULL);
+ NULL, icon, G_CALLBACK(tg_gui_cb_home), NULL);
icon = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY,
GTK_ICON_SIZE_LARGE_TOOLBAR);
@@ -370,7 +371,7 @@ new_toolbar ()
gui.pagebutton = w;
gtk_container_add(GTK_CONTAINER(w), icon);
g_signal_connect(G_OBJECT(w), "clicked",
- G_CALLBACK(cb_toggle_paging), NULL);
+ G_CALLBACK(tg_gui_cb_toggle_paging), NULL);
gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar), w, _("Toggles auto-paging"), NULL);
/* FIXME */ /*
@@ -378,7 +379,7 @@ new_toolbar ()
w = gtk_toggle_button_new();
gui.zoombutton = w;
gtk_container_add(GTK_CONTAINER(w), gui.zoomlabel);
- g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(cb_zoom), NULL);
+ g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(tg_gui_cb_zoom), NULL);
gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar), w, _("Toggles zooming"), NULL);
*/
@@ -395,7 +396,7 @@ new_toolbar ()
* return the app gui, with startpage or NULL
*/
GtkWidget *
-new_gui (gchar* startpage)
+tg_gui_new (gchar* startpage)
{
GtkWidget *app, *toolbar, *statusbar;
GdkPixbuf *pixbuf;
@@ -406,12 +407,12 @@ new_gui (gchar* startpage)
/* gtk_window_set_policy(GTK_WINDOW (app), FALSE, FALSE, TRUE); */
gtk_widget_realize(GTK_WIDGET(app));
- toolbar= new_toolbar();
+ toolbar = tg_gui_new_toolbar();
/* attach a keyboard event */
g_signal_connect (G_OBJECT (app),
"key_press_event",
- G_CALLBACK (cb_keypress), NULL);
+ G_CALLBACK (tg_cb_keypress), NULL);
/* attach the menu */
gnome_app_create_menus(GNOME_APP(app), menubar);
@@ -419,9 +420,9 @@ new_gui (gchar* startpage)
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();
+ currentview = tg_view_new();
- tele_view_set_error_handler(currentview, print_in_statusbar);
+ tg_view_set_error_handler(currentview, tg_gui_print_in_statusbar);
/* the statusbar */
statusbar= gnome_appbar_new(TRUE,TRUE,GNOME_PREFERENCES_NEVER);
gnome_app_set_statusbar(GNOME_APP(app), statusbar);
@@ -430,7 +431,7 @@ new_gui (gchar* startpage)
gnome_app_install_menu_hints(GNOME_APP(app), menubar);
/* all the contents */
- gnome_app_set_contents(GNOME_APP(app), tele_view_get_widget(currentview));
+ gnome_app_set_contents(GNOME_APP(app), tg_view_get_widget(currentview));
/* save some pointers for reference later */
@@ -438,54 +439,54 @@ new_gui (gchar* startpage)
gui.app= app;
g_signal_connect (G_OBJECT (app), "delete_event",
- G_CALLBACK (cb_quit),
+ G_CALLBACK (tg_gui_cb_quit),
NULL);
gui.client = gnome_master_client();
g_signal_connect (G_OBJECT (gui.client), "save_yourself",
- G_CALLBACK (save_yourself),
+ G_CALLBACK (tg_gui_save_yourself),
NULL); /* fixme? */
g_signal_connect (G_OBJECT (gui.client), "die",
- G_CALLBACK (die), NULL);
+ G_CALLBACK (tg_gui_die), NULL);
gtk_widget_show_all(app);
- gui_restore_session();
+ tg_gui_restore_session();
gui.channels = NULL;
gui.channel_menu = NULL;
- refresh_channel_menu();
+ tg_gui_refresh_channel_menu();
/* FIXME: */
/* set the current view, at elem 0 */
- currentview->channel = (Channel *)g_slist_nth_data(gui.channels, gui.default_server);
+ currentview->channel = (TgChannel *)g_slist_nth_data(gui.channels, gui.default_server);
- update_title_bar();
+ tg_gui_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);
+ tg_gui_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);
+ tg_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);
+ gui.logo_timer = gtk_timeout_add(TG_LOGO_TIMEOUT, tg_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);
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_get_the_page(TRUE);
g_print("we are connected to a session manager");
} else {
g_print("we are NOT connected to a session manager");
@@ -500,7 +501,7 @@ new_gui (gchar* startpage)
* update the entry box with the current values of page & subpage
*/
int
-update_entry(gint page_nr, gint subpage_nr)
+tg_gui_update_entry (gint page_nr, gint subpage_nr)
{
gchar full_num[10];
@@ -519,7 +520,7 @@ update_entry(gint page_nr, gint subpage_nr)
* (needed when zoom_factor has changed)
*/
void
-get_the_page(gboolean redraw)
+tg_gui_get_the_page (gboolean redraw)
{
/* hide the app */
if (redraw)
@@ -530,10 +531,10 @@ get_the_page(gboolean redraw)
gtk_timeout_remove(gui.logo_timer);
gui.logo_timer = -1;
- tele_view_update_page(currentview, ¤tview->page_nr, ¤tview->subpage_nr);
+ tg_view_update_page(currentview, ¤tview->page_nr, ¤tview->subpage_nr);
- update_entry(currentview->page_nr, currentview->subpage_nr);
- print_in_statusbar ("");
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_print_in_statusbar ("");
if (redraw)
gtk_widget_show_all (GTK_WIDGET(gui.app));
@@ -544,24 +545,24 @@ get_the_page(gboolean redraw)
* callbacks
*/
void
-cb_quit (GtkWidget* widget, gpointer data)
+tg_gui_cb_quit (GtkWidget* widget, gpointer data)
{
/* save some */
- gui_save_session();
+ tg_gui_save_session();
/* free the channels */
if (gui.channels != NULL) {
- g_slist_free_full(gui.channels, (GDestroyNotify)channel_free);
+ g_slist_free_full(gui.channels, (GDestroyNotify)tg_channel_free);
gui.channels = NULL;
}
- tele_view_free(currentview);
+ tg_view_free(currentview);
/* get outta here ;) */
gtk_main_quit();
}
void
-cb_about (GtkWidget* widget, gpointer data)
+tg_gui_cb_about (GtkWidget* widget, gpointer data)
{
static GtkWidget *about;
const gchar *authors[]= { "Dirk-Jan C. Binnema <djcb dds nl>",
@@ -602,7 +603,7 @@ cb_about (GtkWidget* widget, gpointer data)
}
static void
-refresh_timer()
+tg_gui_refresh_timer ()
{
gdouble perc = gtk_progress_bar_get_fraction(gui.progress);
@@ -612,70 +613,69 @@ refresh_timer()
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_timer = gtk_timeout_add(gui.page_msecs/100, tg_gui_pager_timer, NULL);
}
gui.page_progress =(int)((gui.page_msecs/100)*perc);
}
static void
-prefs_close_cb()
+tg_gui_prefs_close_cb ()
{
- refresh_channel_menu();
- refresh_timer();
+ tg_gui_refresh_channel_menu();
+ tg_gui_refresh_timer();
}
void
-cb_preferences (GtkWidget* widget, gpointer data)
+tg_gui_cb_preferences (GtkWidget* widget, gpointer data)
{
- prefs_show();
- set_close_cb(prefs_close_cb);
+ tg_prefs_show();
+ tg_prefs_set_close_cb(tg_gui_prefs_close_cb);
}
void
-cb_next_page (GtkWidget* widget, gpointer data)
+tg_gui_cb_next_page (GtkWidget* widget, gpointer data)
{
if (currentview->subpage_nr == 0)
currentview->page_nr++;
else
currentview->subpage_nr++;
- update_entry(currentview->page_nr, currentview->subpage_nr);
- get_the_page(FALSE); /* dont redraw */
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_get_the_page(FALSE); /* dont redraw */
}
void
-cb_prev_page (GtkWidget* widget, gpointer data)
+tg_gui_cb_prev_page (GtkWidget* widget, gpointer data)
{
if (currentview->subpage_nr>0)
currentview->subpage_nr--;
if (currentview->subpage_nr==0)
currentview->page_nr--;
- update_entry(currentview->page_nr, currentview->subpage_nr);
- get_the_page(FALSE);
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_get_the_page(FALSE);
}
void
-cb_home (GtkWidget* widget, gpointer data)
+tg_gui_cb_home (GtkWidget* widget, gpointer data)
{
currentview->subpage_nr=0;
currentview->page_nr=100;
- update_entry(currentview->page_nr, currentview->subpage_nr);
- get_the_page(FALSE);
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_get_the_page(FALSE);
}
void
-cb_goto_page (GtkWidget *widget, gpointer data)
-{
-
+tg_gui_cb_goto_page (GtkWidget *widget, gpointer data)
+{
gui.kb_status = INPUT_NEW;
- if ( -1 == get_page_entry (gtk_entry_get_text(GTK_ENTRY(gui.entry)))) {
- print_in_statusbar(_("Error in page entry"));
+ if ( -1 == tg_http_get_page_entry (gtk_entry_get_text(GTK_ENTRY(gui.entry)))) {
+ tg_gui_print_in_statusbar(_("Error in page entry"));
return;
}
- get_the_page(FALSE);
+ tg_gui_get_the_page(FALSE);
}
@@ -683,7 +683,7 @@ cb_goto_page (GtkWidget *widget, gpointer data)
* handler for zoom button
*/
void
-cb_zoom(GtkWidget *widget, gpointer data)
+tg_gui_cb_zoom (GtkWidget *widget, gpointer data)
{
/* new: just toggle it on click */
if (currentview->zoom_factor==1) {
@@ -694,12 +694,12 @@ cb_zoom(GtkWidget *widget, gpointer data)
currentview->zoom_factor=1;
}
/* now, get the page with the new zoom settings */
- get_the_page(TRUE);
+ tg_gui_get_the_page(TRUE);
}
void
-cb_drag (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data,
- guint info, guint32 time)
+tg_gui_cb_drag (GtkWidget *widget, GdkDragContext *context,
+ GtkSelectionData *selection_data, guint info, guint32 time)
{
const gchar *entry;
@@ -727,7 +727,7 @@ cb_drag (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection
}
static gint
-gui_keyboard_timer(gpointer g)
+tg_gui_keyboard_timer (gpointer g)
{
gtk_timeout_remove(gui.kb_timer);
gui.kb_timer = -1;
@@ -736,11 +736,11 @@ gui_keyboard_timer(gpointer g)
}
gint
-cb_keypress (GtkWidget *widget, GdkEventKey *event)
+tg_cb_keypress (GtkWidget *widget, GdkEventKey *event)
{
if (event->keyval == GDK_KP_Enter) {
- cb_goto_page(NULL, NULL);
- update_entry(currentview->page_nr, currentview->subpage_nr);
+ tg_gui_cb_goto_page(NULL, NULL);
+ tg_gui_update_entry(currentview->page_nr, currentview->subpage_nr);
return 0;
}
@@ -754,7 +754,7 @@ cb_keypress (GtkWidget *widget, GdkEventKey *event)
if (gui.kb_timer != -1)
gtk_timeout_remove(gui.kb_timer);
- gui.kb_timer = gtk_timeout_add(TG_KB_TIMEOUT, gui_keyboard_timer, NULL);
+ gui.kb_timer = gtk_timeout_add(TG_KB_TIMEOUT, tg_gui_keyboard_timer, NULL);
gui.kb_status = INPUT_CONTINUED;
return 0;
}
diff --git a/src/gui.h b/src/gui.h
index 4cbddcf..3ae31d7 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -36,27 +36,28 @@
#define TG_MAX_CHANNELS 100
-GtkWidget *new_gui();
+GtkWidget *tg_gui_new ();
-int update_entry (gint page_nr, gint subpage_nr);
-void get_the_page(gboolean redraw);
+int tg_gui_update_entry (gint page_nr, gint subpage_nr);
+void tg_gui_get_the_page (gboolean redraw);
/* event handler callbacks */
-void cb_quit (GtkWidget* widget, gpointer data);
-void cb_about (GtkWidget* widget, gpointer data);
-void cb_preferences (GtkWidget* widget, gpointer data);
-void cb_next_page (GtkWidget* widget, gpointer data);
-void cb_prev_page (GtkWidget* widget, gpointer data);
-void cb_home (GtkWidget* widget, gpointer data);
-void cb_goto_page (GtkWidget* widget, gpointer data);
-void cb_zoom (GtkWidget *widget, gpointer data);
-void cb_drag (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data,
- guint info, guint32 time);
-gint cb_keypress(GtkWidget *widget, GdkEventKey *event);
+void tg_gui_cb_quit (GtkWidget* widget, gpointer data);
+void tg_gui_cb_about (GtkWidget* widget, gpointer data);
+void tg_gui_cb_preferences (GtkWidget* widget, gpointer data);
+void tg_gui_cb_next_page (GtkWidget* widget, gpointer data);
+void tg_gui_cb_prev_page (GtkWidget* widget, gpointer data);
+void tg_gui_cb_home (GtkWidget* widget, gpointer data);
+void tg_gui_cb_goto_page (GtkWidget* widget, gpointer data);
+void tg_gui_cb_zoom (GtkWidget *widget, gpointer data);
+void tg_gui_cb_drag (GtkWidget *widget, GdkDragContext *context,
+ GtkSelectionData *selection_data, guint info,
+ guint32 time);
+gint tg_cb_keypress (GtkWidget *widget, GdkEventKey *event);
/* some widgets we need a runtime ref to */
-typedef struct _Gui {
+typedef struct _TgGui {
GtkWidget *app;
GtkWidget *statusbar;
@@ -91,7 +92,7 @@ typedef struct _Gui {
gint default_server;
/* FIXME: Multiple views */
-} Gui;
+} TgGui;
/* DnD target types */
enum {
diff --git a/src/http.c b/src/http.c
index 8730d52..0f18632 100644
--- a/src/http.c
+++ b/src/http.c
@@ -32,7 +32,7 @@
* get the pagenumber from the entrybox
*/
int
-get_page_entry (const gchar *page_entry)
+tg_http_get_page_entry (const gchar *page_entry)
{
guint page_nr;
guint subpage_nr=0;
@@ -66,7 +66,7 @@ get_page_entry (const gchar *page_entry)
* if all's ok, return name in a GdkPixbuf
*/
gint
-get_the_image (GdkPixbuf **pixbuf)
+tg_http_get_image (GdkPixbuf **pixbuf)
{
gchar http_query[100];
gint retval=0;
@@ -77,7 +77,7 @@ get_the_image (GdkPixbuf **pixbuf)
gssize bytes_read;
GError *err = NULL;
- if ( -1 == get_http_query(http_query, currentview->page_nr, currentview->subpage_nr))
+ if ( -1 == tg_http_get_query(http_query, currentview->page_nr, currentview->subpage_nr))
return TG_ERR_HTTPQUERY;
/* get the image from remote server */
@@ -119,7 +119,7 @@ out:
}
int
-get_http_query (gchar* buffer, gint page_nr, gint subpage_nr)
+tg_http_get_query (gchar* buffer, gint page_nr, gint subpage_nr)
{
if ( subpage_nr>0 ) { /* do we have a subpage? */
sprintf ( buffer,
diff --git a/src/http.h b/src/http.h
index 091e05b..81fdc16 100644
--- a/src/http.h
+++ b/src/http.h
@@ -37,8 +37,8 @@
#define TEST_TELEGNOME 1
/* #undef TEST_TELEGNOME */
-int get_page_entry (const gchar *page_entry);
-gint get_the_image (GdkPixbuf **pixbuf);
-int get_http_query (gchar* buffer, gint page_nr, gint subpage_nr);
+int tg_http_get_page_entry (const gchar *page_entry);
+gint tg_http_get_image (GdkPixbuf **pixbuf);
+int tg_http_get_query (gchar* buffer, gint page_nr, gint subpage_nr);
#endif /* _HTTP_H_ */
diff --git a/src/main.c b/src/main.c
index 26efcca..07cfbf0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,9 +53,9 @@ main (int argc, char **argv)
/* build gui, handle cmd line args */
if ((argc >1) && (strlen(argv[1])<6)) {
- gui= new_gui (argv[1]);
+ gui = tg_gui_new (argv[1]);
} else {
- gui= new_gui ("100");
+ gui = tg_gui_new ("100");
}
gtk_widget_show_all(GTK_WIDGET(gui));
diff --git a/src/main.h b/src/main.h
index dd3d6e2..a6859cf 100644
--- a/src/main.h
+++ b/src/main.h
@@ -61,6 +61,6 @@ typedef struct _TeleGnome{
/* TeleGnome telegnome; */
-TeleView *currentview;
+TgView *currentview;
#endif /* _MAIN_H_ */
diff --git a/src/menu.h b/src/menu.h
index 97d48cc..ce76ce7 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -10,18 +10,18 @@
/* the menu */
static GnomeUIInfo file_menu[] = {
- GNOMEUIINFO_MENU_QUIT_ITEM(cb_quit, NULL),
+ GNOMEUIINFO_MENU_QUIT_ITEM(tg_gui_cb_quit, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo settings_menu[] = {
- GNOMEUIINFO_MENU_PREFERENCES_ITEM(cb_preferences, NULL),
+ GNOMEUIINFO_MENU_PREFERENCES_ITEM(tg_gui_cb_preferences, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo help_menu[] = {
GNOMEUIINFO_HELP(PACKAGE),
- GNOMEUIINFO_MENU_ABOUT_ITEM(cb_about, NULL),
+ GNOMEUIINFO_MENU_ABOUT_ITEM(tg_gui_cb_about, NULL),
GNOMEUIINFO_END
};
diff --git a/src/pixpack.c b/src/pixpack.c
index bea558f..e9b2cff 100644
--- a/src/pixpack.c
+++ b/src/pixpack.c
@@ -22,7 +22,7 @@
*/
#include "pixpack.h"
-struct _PixPackPrivate {
+struct _TgPixPackPrivate {
GdkPixbuf *pixbuf;
GdkPixbuf *scaled_pixbuf;
@@ -30,42 +30,42 @@ struct _PixPackPrivate {
gboolean autosize;
};
-typedef struct _PixPackPrivate PixPackPrivate;
+typedef struct _TgPixPackPrivate TgPixPackPrivate;
-static void pixpack_class_init (PixPackClass *klass);
-static void pixpack_init (PixPack *pixpack);
-static void pixpack_destroy (GtkObject *object);
-static void pixpack_realize (GtkWidget *widget);
-static void pixpack_unrealize (GtkWidget *widget);
-static void pixpack_paint (PixPack *pixpack,
+static void tg_pixpack_class_init (TgPixPackClass *klass);
+static void tg_pixpack_init (TgPixPack *pixpack);
+static void tg_pixpack_destroy (GtkObject *object);
+static void tg_pixpack_realize (GtkWidget *widget);
+static void tg_pixpack_unrealize (GtkWidget *widget);
+static void tg_pixpack_paint (TgPixPack *pixpack,
GdkRectangle *area);
-static gint pixpack_expose (GtkWidget *widget,
+static gint tg_pixpack_expose (GtkWidget *widget,
GdkEventExpose *event);
-static void pixpack_size_request (GtkWidget *widget,
+static void tg_pixpack_size_request (GtkWidget *widget,
GtkRequisition *allocation);
static GtkWidgetClass *parent_class = NULL;
GType
-pixpack_get_type(void)
+tg_pixpack_get_type(void)
{
static GType pixpack_type = 0;
if (!pixpack_type) {
static const GTypeInfo pixpack_info = {
- sizeof (PixPackClass),
+ sizeof (TgPixPackClass),
NULL,
NULL,
- (GClassInitFunc) pixpack_class_init,
+ (GClassInitFunc) tg_pixpack_class_init,
NULL,
NULL,
- sizeof (PixPack),
+ sizeof (TgPixPack),
0,
- (GInstanceInitFunc) pixpack_init,
+ (GInstanceInitFunc) tg_pixpack_init,
};
- pixpack_type = g_type_register_static(GTK_TYPE_WIDGET, "PixPack",
+ pixpack_type = g_type_register_static(GTK_TYPE_WIDGET, "TgPixPack",
&pixpack_info, 0);
}
return pixpack_type;
@@ -73,27 +73,27 @@ pixpack_get_type(void)
static void
-pixpack_class_init(PixPackClass *klass)
+tg_pixpack_class_init(TgPixPackClass *klass)
{
GtkObjectClass *object_class = (GtkObjectClass*) klass;
GtkWidgetClass *widget_class = (GtkWidgetClass*) klass;
parent_class = g_type_class_peek_parent(klass);
- object_class->destroy = pixpack_destroy;
+ object_class->destroy = tg_pixpack_destroy;
- widget_class->realize = pixpack_realize;
- widget_class->unrealize = pixpack_unrealize;
- widget_class->expose_event = pixpack_expose;
- widget_class->size_request = pixpack_size_request;
+ widget_class->realize = tg_pixpack_realize;
+ widget_class->unrealize = tg_pixpack_unrealize;
+ widget_class->expose_event = tg_pixpack_expose;
+ widget_class->size_request = tg_pixpack_size_request;
}
static void
-pixpack_init(PixPack *pixpack)
+tg_pixpack_init(TgPixPack *pixpack)
{
- PixPackPrivate *priv;
- priv = g_new0(PixPackPrivate, 1);
+ TgPixPackPrivate *priv;
+ priv = g_new0(TgPixPackPrivate, 1);
priv->pixbuf = NULL;
priv->scaled_pixbuf = NULL;
@@ -107,9 +107,9 @@ pixpack_init(PixPack *pixpack)
}
GtkWidget*
-pixpack_new(void)
+tg_pixpack_new(void)
{
- PixPack *pixpack = gtk_type_new(pixpack_get_type());
+ TgPixPack *pixpack = gtk_type_new(tg_pixpack_get_type());
gdk_rgb_set_verbose(TRUE);
gdk_rgb_init();
return GTK_WIDGET(pixpack);
@@ -118,15 +118,15 @@ pixpack_new(void)
static void
-pixpack_destroy(GtkObject *object)
+tg_pixpack_destroy(GtkObject *object)
{
- PixPack *pixpack;
- PixPackPrivate *private;
+ TgPixPack *pixpack;
+ TgPixPackPrivate *private;
g_return_if_fail(object);
- g_return_if_fail(IS_PIXPACK(object));
+ g_return_if_fail(TG_IS_PIXPACK(object));
- pixpack = PIXPACK(object);
+ pixpack = TG_PIXPACK(object);
private = pixpack->private_data;
if (private) {
@@ -143,18 +143,18 @@ pixpack_destroy(GtkObject *object)
}
static void
-pixpack_realize(GtkWidget *widget)
+tg_pixpack_realize(GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
- PixPack *pixpack;
+ TgPixPack *pixpack;
GtkAllocation allocation;
GdkWindow *window;
g_return_if_fail(widget != NULL);
- g_return_if_fail(IS_PIXPACK(widget));
+ g_return_if_fail(TG_IS_PIXPACK(widget));
- pixpack = PIXPACK(widget);
+ pixpack = TG_PIXPACK(widget);
gtk_widget_set_realized(widget, TRUE);
@@ -184,14 +184,14 @@ pixpack_realize(GtkWidget *widget)
static void
-pixpack_unrealize(GtkWidget *widget)
+tg_pixpack_unrealize(GtkWidget *widget)
{
- PixPack *pixpack;
+ TgPixPack *pixpack;
g_return_if_fail(widget != NULL);
- g_return_if_fail(IS_PIXPACK(widget));
+ g_return_if_fail(TG_IS_PIXPACK(widget));
- pixpack = PIXPACK(widget);
+ pixpack = TG_PIXPACK(widget);
if (gtk_widget_get_mapped(widget))
gtk_widget_unmap(widget);
@@ -204,14 +204,14 @@ pixpack_unrealize(GtkWidget *widget)
static void
-pixpack_paint(PixPack* pixpack, GdkRectangle *area)
+tg_pixpack_paint(TgPixPack* pixpack, GdkRectangle *area)
{
GtkWidget *widget;
- PixPackPrivate *private;
+ TgPixPackPrivate *private;
GdkWindow *window;
g_return_if_fail(pixpack != NULL);
- g_return_if_fail(IS_PIXPACK(pixpack));
+ g_return_if_fail(TG_IS_PIXPACK(pixpack));
g_return_if_fail(pixpack->private_data != NULL);
private = pixpack->private_data;
@@ -250,21 +250,21 @@ pixpack_paint(PixPack* pixpack, GdkRectangle *area)
static gboolean
-pixpack_expose(GtkWidget *widget, GdkEventExpose *event)
+tg_pixpack_expose(GtkWidget *widget, GdkEventExpose *event)
{
- pixpack_paint(PIXPACK (widget), &event->area);
+ tg_pixpack_paint(TG_PIXPACK (widget), &event->area);
return TRUE;
}
static void
-pixpack_size_request(GtkWidget *widget, GtkRequisition *req)
+tg_pixpack_size_request(GtkWidget *widget, GtkRequisition *req)
{
- PixPack *pixpack;
- PixPackPrivate *private;
+ TgPixPack *pixpack;
+ TgPixPackPrivate *private;
- g_return_if_fail(IS_PIXPACK(widget));
+ g_return_if_fail(TG_IS_PIXPACK(widget));
- pixpack = PIXPACK(widget);
+ pixpack = TG_PIXPACK(widget);
private = pixpack->private_data;
private->is_resize = TRUE;
@@ -272,11 +272,11 @@ pixpack_size_request(GtkWidget *widget, GtkRequisition *req)
void
-pixpack_load_image(PixPack *pixpack, GdkPixbuf *pixbuf)
+tg_pixpack_load_image(TgPixPack *pixpack, GdkPixbuf *pixbuf)
{
- PixPackPrivate *private;
+ TgPixPackPrivate *private;
- g_return_if_fail(IS_PIXPACK(pixpack));
+ g_return_if_fail(TG_IS_PIXPACK(pixpack));
private = pixpack->private_data;
if (private->pixbuf)
@@ -294,20 +294,20 @@ pixpack_load_image(PixPack *pixpack, GdkPixbuf *pixbuf)
}
void
-pixpack_set_autosize(PixPack *pixpack, gboolean value)
+tg_pixpack_set_autosize(TgPixPack *pixpack, gboolean value)
{
- PixPackPrivate *private;
- g_return_if_fail(IS_PIXPACK(pixpack));
+ TgPixPackPrivate *private;
+ g_return_if_fail(TG_IS_PIXPACK(pixpack));
private = pixpack->private_data;
private->autosize = value;
}
gboolean
-pixpack_get_autosize(PixPack *pixpack)
+tg_pixpack_get_autosize(TgPixPack *pixpack)
{
- PixPackPrivate *private;
- g_return_val_if_fail(IS_PIXPACK(pixpack), FALSE);
+ TgPixPackPrivate *private;
+ g_return_val_if_fail(TG_IS_PIXPACK(pixpack), FALSE);
private = pixpack->private_data;
return private->autosize;
diff --git a/src/pixpack.h b/src/pixpack.h
index fc1c6ee..9350b38 100644
--- a/src/pixpack.h
+++ b/src/pixpack.h
@@ -33,33 +33,33 @@ extern "C" {
#endif /* __cplusplus */
-#define TYPE_PIXPACK (pixpack_get_type ())
-#define PIXPACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIXPACK, PixPack))
-#define PIXPACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIXPACK, PixPackClass))
-#define IS_PIXPACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIXPACK ))
-#define IS_PIXPACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIXPACK))
+#define TG_TYPE_PIXPACK (tg_pixpack_get_type ())
+#define TG_PIXPACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TG_TYPE_PIXPACK,
TgPixPack))
+#define TG_PIXPACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TG_TYPE_PIXPACK,
TgPixPackClass))
+#define TG_IS_PIXPACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TG_TYPE_PIXPACK ))
+#define TG_IS_PIXPACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TG_TYPE_PIXPACK))
-typedef struct _PixPack PixPack;
-typedef struct _PixPackClass PixPackClass;
+typedef struct _TgPixPack TgPixPack;
+typedef struct _TgPixPackClass TgPixPackClass;
-struct _PixPack {
+struct _TgPixPack {
GtkWidget widget;
gpointer private_data;
};
-struct _PixPackClass {
+struct _TgPixPackClass {
GtkWidgetClass parent_class; /* parent class */
};
-GType pixpack_get_type ( void );
-void pixpack_load_image ( PixPack* pixpack, GdkPixbuf* pixbuf );
-GtkWidget* pixpack_new ( void );
-void pixpack_set_autosize ( PixPack* pixpack, gboolean value );
+GType tg_pixpack_get_type ( void );
+void tg_pixpack_load_image ( TgPixPack* pixpack, GdkPixbuf* pixbuf );
+GtkWidget* tg_pixpack_new ( void );
+void tg_pixpack_set_autosize ( TgPixPack* pixpack, gboolean value );
#ifdef __cplusplus
diff --git a/src/prefs.c b/src/prefs.c
index f7a6583..12fa375 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -31,7 +31,7 @@
#include "main.h"
-typedef struct _PrefsWindow {
+typedef struct _TgPrefsWindow {
GnomePropertyBox *box;
GtkWidget *page_entry;
@@ -45,21 +45,22 @@ typedef struct _PrefsWindow {
gint channel_count;
void (*close_callback)();
-} PrefsWindow;
+} TgPrefsWindow;
-static PrefsWindow *prefs_window;
+static TgPrefsWindow *prefs_window;
-void set_close_cb( void (*c)() )
+void
+tg_prefs_set_close_cb( void (*c)() )
{
g_assert( prefs_window != NULL );
prefs_window->close_callback = c;
}
-static void
-fill_channel_list()
+static void
+tg_prefs_fill_channel_list()
{
int i, newrow;
- Channel *channel;
+ TgChannel *channel;
char *info[2];
prefs_window->channel_count = gnome_config_get_int_with_default("/telegnome/Channels/count=0", NULL);
@@ -67,19 +68,19 @@ fill_channel_list()
gtk_clist_freeze(GTK_CLIST(prefs_window->channel_list));
for (i=0; i<prefs_window->channel_count; i++) {
- channel = channel_new_from_config(i);
+ channel = tg_channel_new_from_config(i);
info[0] = channel->country->str;
info[1] = channel->name->str;
newrow = gtk_clist_append(GTK_CLIST(prefs_window->channel_list), info);
gtk_clist_set_row_data_full(GTK_CLIST(prefs_window->channel_list), newrow,
channel,
- (GDestroyNotify)(channel_free));
+ (GDestroyNotify)(tg_channel_free));
}
gtk_clist_thaw(GTK_CLIST(prefs_window->channel_list));
}
static void
-edit_channel_changed(GtkWidget *dialog, gpointer data)
+tg_prefs_edit_channel_changed(GtkWidget *dialog, gpointer data)
{
gnome_dialog_set_sensitive(GNOME_DIALOG(data), 0, TRUE);
}
@@ -87,7 +88,7 @@ edit_channel_changed(GtkWidget *dialog, gpointer data)
/* pops up a modal dialog, editing the channel. */
static gboolean
-edit_channel(Channel *orig)
+tg_prefs_edit_channel(TgChannel *orig)
{
GtkWidget *dialog, *table, *label, *name, *page, *subpage, *desc, *country, *frame;
int reply;
@@ -111,7 +112,7 @@ edit_channel(Channel *orig)
gtk_entry_set_text(GTK_ENTRY(name), orig->name->str);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 0,1);
gtk_table_attach_defaults(GTK_TABLE(table), name, 1,2, 0,1);
- g_signal_connect(G_OBJECT(name), "changed", G_CALLBACK(edit_channel_changed), (gpointer)dialog);
+ g_signal_connect(G_OBJECT(name), "changed", G_CALLBACK(tg_prefs_edit_channel_changed), (gpointer)dialog);
label = gtk_label_new(_("Description"));
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
@@ -119,7 +120,7 @@ edit_channel(Channel *orig)
gtk_entry_set_text(GTK_ENTRY(desc), orig->desc->str);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 1,2);
gtk_table_attach_defaults(GTK_TABLE(table), desc, 1,2, 1,2);
- g_signal_connect(G_OBJECT(desc), "changed", G_CALLBACK(edit_channel_changed), (gpointer)dialog);
+ g_signal_connect(G_OBJECT(desc), "changed", G_CALLBACK(tg_prefs_edit_channel_changed), (gpointer)dialog);
label = gtk_label_new(_("Page url"));
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
@@ -127,7 +128,7 @@ edit_channel(Channel *orig)
gtk_entry_set_text(GTK_ENTRY(page), orig->page_url->str);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 2,3);
gtk_table_attach_defaults(GTK_TABLE(table), page, 1,2, 2,3);
- g_signal_connect(G_OBJECT(page), "changed", G_CALLBACK(edit_channel_changed), (gpointer)dialog);
+ g_signal_connect(G_OBJECT(page), "changed", G_CALLBACK(tg_prefs_edit_channel_changed), (gpointer)dialog);
label = gtk_label_new(_("Subpage url"));
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
@@ -135,7 +136,7 @@ edit_channel(Channel *orig)
gtk_entry_set_text(GTK_ENTRY(subpage), orig->subpage_url->str);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 3,4);
gtk_table_attach_defaults(GTK_TABLE(table), subpage, 1,2, 3,4);
- g_signal_connect(G_OBJECT(subpage), "changed", G_CALLBACK(edit_channel_changed), (gpointer)dialog);
+ g_signal_connect(G_OBJECT(subpage), "changed", G_CALLBACK(tg_prefs_edit_channel_changed),
(gpointer)dialog);
label = gtk_label_new(_("Country"));
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
@@ -143,7 +144,7 @@ edit_channel(Channel *orig)
gtk_entry_set_text(GTK_ENTRY(country), orig->country->str);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0,1, 4,5);
gtk_table_attach_defaults(GTK_TABLE(table), country, 1,2, 4,5);
- g_signal_connect(G_OBJECT(country), "changed", G_CALLBACK(edit_channel_changed), (gpointer)dialog);
+ g_signal_connect(G_OBJECT(country), "changed", G_CALLBACK(tg_prefs_edit_channel_changed),
(gpointer)dialog);
frame = gtk_frame_new(_("Channel Information"));
gtk_container_add(GTK_CONTAINER(frame), table);
@@ -171,17 +172,17 @@ edit_channel(Channel *orig)
}
static void
-prefs_cancel_cb(void)
+tg_prefs_cancel_cb(void)
{
g_clear_object(&prefs_window->box);
g_clear_pointer(&prefs_window, g_free);
}
static void
-prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
+tg_prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
{
int i;
- Channel *channel;
+ TgChannel *channel;
if (page_num == -1) return;
@@ -193,7 +194,7 @@ prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
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_save_to_config(channel);
+ tg_channel_save_to_config(channel);
}
gnome_config_sync();
@@ -202,10 +203,10 @@ prefs_apply_cb(GnomePropertyBox *propertybox, gint page_num)
}
static void
-prefs_channel_list_click_cb(GtkWidget *clist, gint row, gint column,
- GdkEventButton *event, gpointer data)
+tg_prefs_channel_list_click_cb(GtkWidget *clist, gint row, gint column,
+ GdkEventButton *event, gpointer data)
{
- Channel *channel;
+ TgChannel *channel;
channel = gtk_clist_get_row_data(GTK_CLIST(clist), row);
gtk_label_set_text(GTK_LABEL(prefs_window->channel_label),
@@ -213,10 +214,10 @@ prefs_channel_list_click_cb(GtkWidget *clist, gint row, gint column,
}
static void
-prefs_channels_renum()
+tg_prefs_channels_renum()
{
int i;
- Channel *channel;
+ TgChannel *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;
@@ -224,14 +225,14 @@ prefs_channels_renum()
}
static void
-prefs_channel_add_cb(void)
+tg_prefs_channel_add_cb(void)
{
- Channel *chan;
+ TgChannel *chan;
char *info[2];
int id;
- chan = channel_new(-1,"","","","","");
- if (edit_channel(chan)) {
+ chan = tg_channel_new(-1,"","","","","");
+ if (tg_prefs_edit_channel(chan)) {
if (chan->name->len > 0) {
info[0] = chan->country->str;
info[1] = chan->name->str;
@@ -244,7 +245,7 @@ prefs_channel_add_cb(void)
}
static void
-prefs_channel_move_up_cb(void)
+tg_prefs_channel_move_up_cb(void)
{
GList *list;
int row;
@@ -256,12 +257,12 @@ prefs_channel_move_up_cb(void)
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();
+ tg_prefs_channels_renum();
}
}
void
-prefs_channel_move_down_cb(void)
+tg_prefs_channel_move_down_cb(void)
{
GList *list;
int row;
@@ -273,35 +274,34 @@ prefs_channel_move_down_cb(void)
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();
+ tg_prefs_channels_renum();
}
}
static void
-prefs_channel_edit_cb(void)
+tg_prefs_channel_edit_cb(void)
{
GList *list;
int row;
- Channel *channel = NULL;
+ TgChannel *channel = NULL;
if ((list = GTK_CLIST(prefs_window->channel_list)->selection) == NULL)
return;
row = GPOINTER_TO_INT(list->data);
- channel = (Channel *)gtk_clist_get_row_data(GTK_CLIST(prefs_window->channel_list), row);
+ channel = (TgChannel *)gtk_clist_get_row_data(GTK_CLIST(prefs_window->channel_list), row);
/* update the entry */
- if (edit_channel (channel)) {
+ if (tg_prefs_edit_channel (channel)) {
/* ...and update the list. the data is set automagicly. */
gtk_clist_set_text(GTK_CLIST(prefs_window->channel_list), row, 0, channel->country->str);
gtk_clist_set_text(GTK_CLIST(prefs_window->channel_list), row, 1, channel->name->str);
gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
}
-
}
static void
-prefs_channel_delete_cb(void)
+tg_prefs_channel_delete_cb(void)
{
GList *list;
int row;
@@ -312,14 +312,14 @@ prefs_channel_delete_cb(void)
row = GPOINTER_TO_INT(list->data);
gtk_clist_remove(GTK_CLIST(prefs_window->channel_list), row);
- prefs_channels_renum();
+ tg_prefs_channels_renum();
gnome_property_box_changed(GNOME_PROPERTY_BOX(prefs_window->box));
}
/* not a good idea to have a 'misc' page, but i cant come up with a better name */
static GtkWidget *
-construct_misc_page()
+tg_prefs_construct_misc_page()
{
GtkWidget *table, *frame, *label, *entry, *proxy_label, *proxy_entry;
GtkAdjustment *adj;
@@ -362,7 +362,7 @@ construct_misc_page()
}
static GtkWidget *
-construct_channels_page()
+tg_prefs_construct_channels_page()
{
GtkWidget *hbox, *vbox, *btn;
char *titles[2] = { N_("Country"), N_("Name") };
@@ -384,10 +384,10 @@ construct_channels_page()
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE , 0);
/* fill channel list */
- fill_channel_list();
+ tg_prefs_fill_channel_list();
g_signal_connect(G_OBJECT(prefs_window->channel_list), "select_row",
- G_CALLBACK(prefs_channel_list_click_cb),
+ G_CALLBACK(tg_prefs_channel_list_click_cb),
NULL);
vbox = gtk_vbox_new(TRUE, 0);
@@ -396,29 +396,29 @@ construct_channels_page()
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);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(tg_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);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(tg_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);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(tg_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);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(tg_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);
+ g_signal_connect(G_OBJECT(btn), "clicked", G_CALLBACK(tg_prefs_channel_edit_cb), NULL);
gtk_box_pack_start_defaults(GTK_BOX(hbox), vbox);
@@ -427,7 +427,7 @@ construct_channels_page()
}
void
-prefs_show(void)
+tg_prefs_show(void)
{
GtkWidget *page;
@@ -435,17 +435,17 @@ prefs_show(void)
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 = g_malloc(sizeof(TgPrefsWindow));
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();
+ page = tg_prefs_construct_channels_page();
gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
page,
gtk_label_new(_("Channels")));
- page = construct_misc_page();
+ page = tg_prefs_construct_misc_page();
gtk_notebook_append_page(GTK_NOTEBOOK(prefs_window->box->notebook),
page,
gtk_label_new(_("Misc")));
@@ -457,9 +457,9 @@ prefs_show(void)
TRUE);
g_signal_connect (G_OBJECT (prefs_window->box), "apply",
- G_CALLBACK (prefs_apply_cb), NULL);
+ G_CALLBACK (tg_prefs_apply_cb), NULL);
g_signal_connect (G_OBJECT (prefs_window->box), "destroy",
- G_CALLBACK (prefs_cancel_cb), NULL);
+ G_CALLBACK (tg_prefs_cancel_cb), NULL);
g_signal_connect_swapped(G_OBJECT(prefs_window->interval_entry), "changed",
G_CALLBACK(gnome_property_box_changed),
diff --git a/src/prefs.h b/src/prefs.h
index ef45a96..a1d8481 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -35,7 +35,7 @@
#define TELEGNOME_LOGO "telegnome/telegnome-logo.png"
#define TELEGNOME_NOTFOUND "telegnome/telegnome-logo.png"
-void prefs_show(void);
-void set_close_cb( void (*c)() );
+void tg_prefs_show(void);
+void tg_prefs_set_close_cb( void (*c)() );
#endif /* __PREFS_H__ */
diff --git a/src/view.c b/src/view.c
index 8bb40cd..486868b 100644
--- a/src/view.c
+++ b/src/view.c
@@ -32,17 +32,17 @@
#include "http.h"
#include "pixpack.h"
-TeleView *
-tele_view_new()
+TgView *
+tg_view_new()
{
- TeleView *v;
+ TgView *v;
- v = g_malloc(sizeof(TeleView));
+ v = g_malloc(sizeof(TgView));
v->box = gtk_vbox_new(TRUE, 0);
- v->pixpack = pixpack_new();
- pixpack_set_autosize( PIXPACK(v->pixpack), TRUE );
+ v->pixpack = tg_pixpack_new();
+ tg_pixpack_set_autosize(TG_PIXPACK(v->pixpack), TRUE);
gtk_box_pack_start_defaults(GTK_BOX(v->box), v->pixpack);
@@ -55,22 +55,22 @@ tele_view_new()
}
void
-tele_view_set_error_handler(TeleView *view, void (*e)(const char *))
+tg_view_set_error_handler(TgView *view, void (*e)(const char *))
{
view->error_handler = e;
}
void
-tele_view_error(TeleView *view, const char *c)
+tg_view_error(TgView *view, const char *c)
{
g_print("Error: %s\n", c);
}
gint
-tele_view_update_pixmap(TeleView *view, GdkPixbuf *pixbuf)
+tg_view_update_pixmap(TgView *view, GdkPixbuf *pixbuf)
{
if (pixbuf) {
- pixpack_load_image(PIXPACK(view->pixpack), pixbuf);
+ tg_pixpack_load_image(TG_PIXPACK(view->pixpack), pixbuf);
} else {
/* no pixbuf, resize to a default and print a warning */
g_warning("pixbuf == NULL\n");
@@ -81,7 +81,7 @@ tele_view_update_pixmap(TeleView *view, GdkPixbuf *pixbuf)
}
gint
-tele_view_update_page(TeleView *view, int *major_nr, int *minor_nr)
+tg_view_update_page(TgView *view, int *major_nr, int *minor_nr)
{
gint retval;
GdkPixbuf *pixbuf;
@@ -92,10 +92,10 @@ tele_view_update_page(TeleView *view, int *major_nr, int *minor_nr)
gint old_subpage= *major_nr;
/* make http-request, returns the file of the saved thing */
- retval= get_the_image(&pixbuf);
+ retval = tg_http_get_image(&pixbuf);
if (TG_OK == retval) {
- tele_view_update_pixmap(view, pixbuf);
+ tg_view_update_pixmap(view, pixbuf);
g_object_unref(pixbuf);
return 0;
} else {
@@ -103,37 +103,37 @@ tele_view_update_page(TeleView *view, int *major_nr, int *minor_nr)
case TG_ERR_PIXBUF: /* we got an error from the webpage */
/* maybe we forgot the subpage nr, or used it when we shouldn't */
*minor_nr= (0 == *minor_nr)?1:0;
- if (TG_OK != get_the_image(&pixbuf)) {
+ if (TG_OK != tg_http_get_image(&pixbuf)) {
if (*minor_nr!=1) {
/* maybe we've run out of subpages, go to next main page */
*minor_nr=0;
(*major_nr)++;
- update_entry(*major_nr, *minor_nr);
- get_the_page(FALSE); /* dont redraw */
+ tg_gui_update_entry(*major_nr, *minor_nr);
+ tg_gui_get_the_page(FALSE); /* dont redraw */
} else {
(*(view->error_handler))(_("Web server error: Wrong page number?"));
*major_nr= old_page; /* restore */
*minor_nr= old_subpage;
- update_entry(*major_nr, *minor_nr);
+ tg_gui_update_entry(*major_nr, *minor_nr);
pixbuf = gdk_pixbuf_new_from_file(
gnome_program_locate_file(
NULL, GNOME_FILE_DOMAIN_PIXMAP,
TG_NOTFOUND_PIXMAP, TRUE, NULL),
&error);
- tele_view_update_pixmap(view, pixbuf);
+ tg_view_update_pixmap(view, pixbuf);
g_object_unref(pixbuf);
return -1;
}
} else {
- tele_view_update_pixmap(view, pixbuf);
+ tg_view_update_pixmap(view, pixbuf);
g_object_unref(pixbuf);
return 0;
}
case TG_ERR_VFS:
- tele_view_error(view, _("Error making HTTP connection"));
+ tg_view_error(view, _("Error making HTTP connection"));
return -1;
case TG_ERR_HTTPQUERY:
- tele_view_error(view, _("Internal error in HTTP query code"));
+ tg_view_error(view, _("Internal error in HTTP query code"));
return -1;
default:
g_assert_not_reached();
@@ -144,14 +144,14 @@ tele_view_update_page(TeleView *view, int *major_nr, int *minor_nr)
}
GtkWidget *
-tele_view_get_widget(TeleView *view)
+tg_view_get_widget(TgView *view)
{
g_object_ref(view->box);
return view->box;
}
void
-tele_view_free(TeleView *view)
+tg_view_free(TgView *view)
{
/* clean up */
g_clear_object(&view->box);
diff --git a/src/view.h b/src/view.h
index 445d7b0..4d75ba4 100644
--- a/src/view.h
+++ b/src/view.h
@@ -32,27 +32,27 @@
#include "channel.h"
-typedef struct _TeleView {
+typedef struct _TgView {
gfloat zoom_factor;
void (*error_handler)(const char *);
GtkWidget *pixpack;
- Channel *channel;
+ TgChannel *channel;
int page_nr;
int subpage_nr;
/* the box */
GtkWidget *box;
-} TeleView;
+} TgView;
-TeleView *tele_view_new();
-void tele_view_set_error_handler(TeleView *view, void (*e)(const char *));
-void tele_view_error(TeleView *view, const char *c);
-gint tele_view_update_pixmap(TeleView *view, GdkPixbuf *pixbuf);
-gint tele_view_update_page(TeleView *view, int *major_nr, int *minor_nr);
-GtkWidget *tele_view_get_widget(TeleView *view);
-void tele_view_free();
+TgView *tg_view_new();
+void tg_view_set_error_handler(TgView *view, void (*e)(const char *));
+void tg_view_error(TgView *view, const char *c);
+gint tg_view_update_pixmap(TgView *view, GdkPixbuf *pixbuf);
+gint tg_view_update_page(TgView *view, int *major_nr, int *minor_nr);
+GtkWidget *tg_view_get_widget(TgView *view);
+void tg_view_free();
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]