diff options
author | Ian McIntosh <ian_mcintosh@linuxadvocate.org> | 2005-10-01 00:24:16 +0000 |
---|---|---|
committer | Ian McIntosh <ian_mcintosh@linuxadvocate.org> | 2005-10-01 00:24:16 +0000 |
commit | f339a631d627dd1527521d0db535187401bd17b4 (patch) | |
tree | 9c3be9441b93448cfa0560eb64f7ea9af775e931 | |
parent | b3f9abdaad3fc4b4d90b0beab231148cf73e43d3 (diff) |
Renamed src/history.c to src/map_history.c
Renamed src/tooltip.c to src/tooltipwindow.c
Renamed src/downloader.c to src/downloadmanager.c
Only require a targetwidget when generating a pixmap.
Move glyph module init here.
Fix all compiler warning messages.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | data/roadster.glade | 175 | ||||
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/downloadmanager.c (renamed from src/downloader.c) | 64 | ||||
-rw-r--r-- | src/downloadmanager.h (renamed from src/downloader.h) | 14 | ||||
-rw-r--r-- | src/glyph.c | 17 | ||||
-rw-r--r-- | src/glyph.h | 5 | ||||
-rw-r--r-- | src/gui.c | 2 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/mainwindow.c | 38 | ||||
-rw-r--r-- | src/map.c | 4 | ||||
-rw-r--r-- | src/map_draw_cairo.c | 1 | ||||
-rw-r--r-- | src/map_draw_gdk.c | 4 | ||||
-rw-r--r-- | src/map_history.c (renamed from src/history.c) | 27 | ||||
-rw-r--r-- | src/map_history.h (renamed from src/history.h) | 17 | ||||
-rw-r--r-- | src/map_style.c | 1 | ||||
-rw-r--r-- | src/tooltip.c | 90 | ||||
-rw-r--r-- | src/tooltip.h | 41 | ||||
-rw-r--r-- | src/util.c | 18 | ||||
-rw-r--r-- | src/util.h | 1 | ||||
-rw-r--r-- | src/welcomewindow.c | 71 | ||||
-rw-r--r-- | src/welcomewindow.h | 42 |
22 files changed, 118 insertions, 532 deletions
@@ -1,3 +1,12 @@ +2005-10-01 Ian McIntosh <ian_mcintosh@linuxadvocate.org> + + * Renamed src/history.c to src/map_history.c + * Renamed src/tooltip.c to src/tooltipwindow.c + * Renamed src/downloader.c to src/downloadmanager.c + * src/glyph.c: Only require a targetwidget when generating a pixmap. + * src/main.c: Move glyph module init here. + * src/*: Fix all compiler warning messages. + 2005-09-30 Ian McIntosh <ian_mcintosh@linuxadvocate.org> * src/welcomewindow.c: Removed. diff --git a/data/roadster.glade b/data/roadster.glade index 86e843c..18ddef6 100644 --- a/data/roadster.glade +++ b/data/roadster.glade @@ -468,181 +468,6 @@ </child> </widget> -<widget class="GtkWindow" id="welcomewindow"> - <property name="border_width">8</property> - <property name="title" translatable="yes">Welcome to Roadster</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - - <child> - <widget class="GtkVBox" id="vbox8810"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox30"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkVBox" id="vbox8811"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFrame" id="frame18"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - - <child> - <widget class="GtkAlignment" id="alignment46"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkVBox" id="vbox8812"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">4</property> - - <child> - <widget class="GtkLabel" id="label23336"> - <property name="visible">True</property> - <property name="label" translatable="yes"> -Roadster Preview Release comes with data for <b>Massachusetts, USA</b> and <b>California, USA</b> only. - -The full Roadster release will contain data for all of the USA. Data for other countries may also be available.</property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">4</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label23335"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span size="x-large"><b>Welcome to Roadster Preview Release<i>!</i></b></span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator9"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox14"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkButton" id="welcomewindowokbutton"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="welcomewindow_on_okbutton_clicked" last_modification_time="Fri, 28 Jan 2005 02:12:49 GMT"/> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - <widget class="GtkWindow" id="locationeditwindow"> <property name="title" translatable="yes">(name set in code)</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> diff --git a/src/Makefile.am b/src/Makefile.am index 420e921..75e7953 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,12 +20,13 @@ bin_PROGRAMS = roadster roadster_SOURCES = \ main.c\ db.c\ - downloader.c\ + downloadmanager.c\ gui.c\ mainwindow.c\ gotowindow.c\ map.c\ map_tile.c\ + map_history.c\ map_style.c\ map_draw_cairo.c\ map_draw_gdk.c\ @@ -47,8 +48,7 @@ roadster_SOURCES = \ road.c\ animator.c\ gfreelist.c\ - history.c\ - tooltip.c + tooltipwindow.c roadster_LDADD = \ $(GNOME_LIBS) \ diff --git a/src/downloader.c b/src/downloadmanager.c index 312ba88..a2ddda5 100644 --- a/src/downloader.c +++ b/src/downloadmanager.c @@ -21,19 +21,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* -Purpose: A general purpose, easy to use, asyncronous downloader. - - +// Purpose: +// A general purpose, easy to use, asyncronous download manager. Hand it URLs, +// and it calls your callback function when it's done. It's that simple! -*/ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <libgnomevfs/gnome-vfs.h> #include <gnome.h> -#include "downloader.h" +#include "downloadmanager.h" #define TEMP_FILE_TEMPLATE ("roadster_download_XXXXXX") // format of temp files @@ -42,53 +40,53 @@ typedef struct { gchar* pszLocalFilePath; // will be NULL until file moves into 'active' list gint nBytesDownloaded; // a count - downloader_t* pDownloader; // a handy pointer to the parent + downloadmanager_t* pDownloadManager; // a handy pointer to the parent GnomeVFSAsyncHandle* pGnomeVFSHandle; - DownloaderCallbackFileResult pCallbackFileResult; // called when file succeeds or fails + DownloadManagerCallbackFileResult pCallbackFileResult; // called when file succeeds or fails } download_t; // // prototypes // -static gboolean _downloader_begin_download(download_t* pDownload); -static void _downloader_move_pending_to_active(downloader_t* pDownloader); +static gboolean _downloadmanager_begin_download(download_t* pDownload); +static void _downloadmanager_move_pending_to_active(downloadmanager_t* pDownloadManager); // // functions // -downloader_t* downloader_new(gint nMaxConcurrentActive) +downloadmanager_t* _downloadmanager_new(gint nMaxConcurrentActive) { - downloader_t* pNew = g_new0(downloader_t, 1); + downloadmanager_t* pNew = g_new0(downloadmanager_t, 1); pNew->pActiveArray = g_ptr_array_new(); pNew->pPendingArray = g_ptr_array_new(); pNew->nMaxConcurrentActive = nMaxConcurrentActive; return pNew; } -void downloader_add_uri(downloader_t* pDownloader, const gchar* pszRemoteFilePath, DownloaderCallbackFileResult pCallbackFileResult) +void downloadmanager_add_uri(downloadmanager_t* pDownloadManager, const gchar* pszRemoteFilePath, DownloadManagerCallbackFileResult pCallbackFileResult) { - g_assert(pDownloader != NULL); + g_assert(pDownloadManager != NULL); g_assert(pszRemoteFilePath != NULL); g_assert(pCallbackFileResult != NULL); download_t* pNewDownload = g_new0(download_t, 1); pNewDownload->pszRemoteFilePath = g_strdup(pszRemoteFilePath); pNewDownload->pCallbackFileResult = pCallbackFileResult; - pNewDownload->pDownloader = pDownloader; + pNewDownload->pDownloadManager = pDownloadManager; - g_ptr_array_add(pDownloader->pPendingArray, pNewDownload); - _downloader_move_pending_to_active(pDownloader); + g_ptr_array_add(pDownloadManager->pPendingArray, pNewDownload); + _downloadmanager_move_pending_to_active(pDownloadManager); } // Check to see if we can add any pending files to active list -static void _downloader_move_pending_to_active(downloader_t* pDownloader) +static void _downloadmanager_move_pending_to_active(downloadmanager_t* pDownloadManager) { - if((pDownloader->pActiveArray->len < pDownloader->nMaxConcurrentActive) && (pDownloader->pPendingArray->len > 0)) { + if((pDownloadManager->pActiveArray->len < pDownloadManager->nMaxConcurrentActive) && (pDownloadManager->pPendingArray->len > 0)) { // time to promote one from pending - download_t* pNext = g_ptr_array_index(pDownloader->pPendingArray, 0); - if(_downloader_begin_download(pNext)) { - g_ptr_array_remove(pDownloader->pPendingArray, pNext); - g_ptr_array_add(pDownloader->pActiveArray, pNext); + download_t* pNext = g_ptr_array_index(pDownloadManager->pPendingArray, 0); + if(_downloadmanager_begin_download(pNext)) { + g_ptr_array_remove(pDownloadManager->pPendingArray, pNext); + g_ptr_array_add(pDownloadManager->pActiveArray, pNext); } } } @@ -98,7 +96,7 @@ static void _downloader_move_pending_to_active(downloader_t* pDownloader) // //g_print("downloader: a file has been closed\n"); // } -static void _downloader_download_free(downloader_t* pDownloader, download_t* pDownload) +static void _downloadmanager_download_free(downloadmanager_t* pDownloadManager, download_t* pDownload) { // Empty struct g_free(pDownload->pszRemoteFilePath); @@ -109,14 +107,14 @@ static void _downloader_download_free(downloader_t* pDownloader, download_t* pDo } // XXX: store a 'state' so we know which array it's in? - g_ptr_array_remove_fast(pDownloader->pActiveArray, pDownload); - g_ptr_array_remove(pDownloader->pPendingArray, pDownload); + g_ptr_array_remove_fast(pDownloadManager->pActiveArray, pDownload); + g_ptr_array_remove(pDownloadManager->pPendingArray, pDownload); // Free struct g_free(pDownload); } -static gint _downloader_gnome_vfs_progress_callback(GnomeVFSAsyncHandle *pHandle, GnomeVFSXferProgressInfo *pInfo, download_t* pDownload) +static gint _downloadmanager_gnome_vfs_progress_callback(GnomeVFSAsyncHandle *pHandle, GnomeVFSXferProgressInfo *pInfo, download_t* pDownload) { g_assert(pHandle != NULL); g_assert(pInfo != NULL); @@ -128,23 +126,23 @@ static gint _downloader_gnome_vfs_progress_callback(GnomeVFSAsyncHandle *pHandle g_print("downloader: downloaded '%s' to '%s' (%d bytes)\n", pDownload->pszRemoteFilePath, pDownload->pszLocalFilePath, pDownload->nBytesDownloaded); // Call user-supplied callback - pDownload->pCallbackFileResult(pDownload->pszRemoteFilePath, DOWNLOADER_RESULT_SUCCESS, pDownload->pszLocalFilePath); + pDownload->pCallbackFileResult(pDownload->pszRemoteFilePath, DOWNLOADMANAGER_RESULT_SUCCESS, pDownload->pszLocalFilePath); // callback shouldn't leave the file in the temp directory if(g_file_test(pDownload->pszLocalFilePath, G_FILE_TEST_EXISTS)) { g_warning("downloader: callback failed to move/delete local file '%s' (from remote '%s')\n", pDownload->pszLocalFilePath, pDownload->pszRemoteFilePath); } - downloader_t* pDownloader = pDownload->pDownloader; - _downloader_download_free(pDownloader, pDownload); + downloadmanager_t* pDownloadManager = pDownload->pDownloadManager; + _downloadmanager_download_free(pDownloadManager, pDownload); // - _downloader_move_pending_to_active(pDownloader); + _downloadmanager_move_pending_to_active(pDownloadManager); } // XXX: what other statuses messages do we care about? (failed?) } -static gboolean _downloader_begin_download(download_t* pDownload) +static gboolean _downloadmanager_begin_download(download_t* pDownload) { g_assert(pDownload != NULL); //g_print("downloader: beginning download of %s\n", pDownload->pszRemoteFilePath); @@ -172,7 +170,7 @@ static gboolean _downloader_begin_download(download_t* pDownload) GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, // overwrite the tmp file we just made. GNOME_VFS_PRIORITY_MIN, - (GnomeVFSAsyncXferProgressCallback)_downloader_gnome_vfs_progress_callback, + (GnomeVFSAsyncXferProgressCallback)_downloadmanager_gnome_vfs_progress_callback, (gpointer)pDownload, // callback userdata NULL, NULL); diff --git a/src/downloader.h b/src/downloadmanager.h index f3107d8..86ea767 100644 --- a/src/downloader.h +++ b/src/downloadmanager.h @@ -21,25 +21,25 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _DOWNLOADER_H_ -#define _DOWNLOADER_H_ +#ifndef _DOWNLOADMANAGER_H_ +#define _DOWNLOADMANAGER_H_ #include <libgnomevfs/gnome-vfs.h> #include <gtk/gtk.h> -typedef enum { DOWNLOADER_RESULT_FAILURE=0, DOWNLOADER_RESULT_SUCCESS } EDownloaderFileResult; +typedef enum { DOWNLOADMANAGER_RESULT_FAILURE=0, DOWNLOADMANAGER_RESULT_SUCCESS } EDownloadManagerFileResult; -typedef void (*DownloaderCallbackFileResult)(const gchar* pszRemotePath, EDownloaderFileResult eDownloaderResult, const gchar* pszLocalPath); +typedef void (*DownloadManagerCallbackFileResult)(const gchar* pszRemotePath, EDownloadManagerFileResult eDownloadManagerResult, const gchar* pszLocalPath); typedef struct { GPtrArray* pPendingArray; GPtrArray* pActiveArray; gint nMaxConcurrentActive; -} downloader_t; +} downloadmanager_t; // public API -downloader_t* downloader_new(gint nMaxConcurrentActive); -void downloader_add_uri(downloader_t* pDownloader, const gchar* pszRemoteFilePath, DownloaderCallbackFileResult pCallbackFileResult); +downloadmanager_t* downloadmanager_new(gint nMaxConcurrentActive); +void downloadmanager_add_uri(downloadmanager_t* pDownloader, const gchar* pszRemoteFilePath, DownloadManagerCallbackFileResult pCallbackFileResult); #endif diff --git a/src/glyph.c b/src/glyph.c index 1289f80..418602e 100644 --- a/src/glyph.c +++ b/src/glyph.c @@ -28,12 +28,10 @@ struct { GPtrArray* pGlyphArray; // to store all glyphs we hand out - GtkWidget* pTargetWidget; } g_Glyph = {0}; -void glyph_init(GtkWidget* pTargetWidget) +void glyph_init() { - g_Glyph.pTargetWidget = pTargetWidget; g_Glyph.pGlyphArray = g_ptr_array_new(); } @@ -139,7 +137,6 @@ void _glyph_load_at_size_into_struct(glyph_t* pNewGlyph, const gchar* pszName, g // Load at image's default size glyph_t* glyph_load(const gchar* pszName) { - g_assert(g_Glyph.pTargetWidget != NULL); g_assert(g_Glyph.pGlyphArray != NULL); g_assert(pszName != NULL); @@ -168,7 +165,6 @@ glyph_t* glyph_load(const gchar* pszName) glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight) { - g_assert(g_Glyph.pTargetWidget != NULL); g_assert(g_Glyph.pGlyphArray != NULL); g_assert(pszName != NULL); @@ -206,14 +202,15 @@ GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph) return pGlyph->pPixbuf; } -GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph) +GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph, GtkWidget* pTargetWidget) { g_assert(pGlyph != NULL); - + if(pGlyph->pPixmap == NULL) { - GdkGC* pGC = g_Glyph.pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(g_Glyph.pTargetWidget)]; - pGlyph->pPixmap = gdk_pixmap_new(g_Glyph.pTargetWidget->window, pGlyph->nWidth, pGlyph->nHeight, -1); // -1 is bpp - gdk_draw_pixbuf(pGlyph->pPixmap, pGC, pGlyph->pPixbuf,0,0,0,0,-1,-1, + // XXX: This assumes that we aren't being passed different pTargetWidgets each time + pGlyph->pPixmap = gdk_pixmap_new(pTargetWidget->window, pGlyph->nWidth, pGlyph->nHeight, -1); // -1 is bpp + GdkGC* pGC = pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pTargetWidget)]; + gdk_draw_pixbuf(pGlyph->pPixmap, pGC, pGlyph->pPixbuf, 0,0,0,0,-1,-1, GDK_RGB_DITHER_NONE,0,0); // no dithering } g_assert(pGlyph->pPixmap != NULL); diff --git a/src/glyph.h b/src/glyph.h index e590945..297997d 100644 --- a/src/glyph.h +++ b/src/glyph.h @@ -38,10 +38,11 @@ typedef struct { gint nReferenceCount; } glyph_t; -void glyph_init(GtkWidget* pTargetWidget); +void glyph_init(); glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight); +glyph_t* glyph_load(const gchar* pszName); GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph); -GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph); +GdkPixmap* glyph_get_pixmap(glyph_t* pGlyph, GtkWidget* pTargetWidget); //void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY); void glyph_draw_centered(glyph_t* pGlyph, GdkDrawable* pTargetDrawable, GdkGC* pGC, gdouble fX, gdouble fY); void glyph_deinit(void); @@ -37,7 +37,7 @@ #include "searchwindow.h" #include "locationeditwindow.h" -void gui_init() +void gui_init(void) { GladeXML* pGladeXML = gui_load_xml(GLADE_FILE_NAME, NULL); glade_xml_signal_autoconnect(pGladeXML); @@ -162,6 +162,9 @@ gboolean main_init(void) main_debug_insert_test_data(); + g_print("initializing glyphs\n"); + glyph_init(); + // // Load location sets from DB. This is "coffee shops", "ATMs", etc. // diff --git a/src/mainwindow.c b/src/mainwindow.c index 0aa1420..e7782a4 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -46,8 +46,9 @@ #include "mainwindow.h" #include "glyph.h" #include "animator.h" -#include "history.h" -#include "tooltip.h" +#include "map_history.h" + +#include "tooltipwindow.h" #define PROGRAM_NAME "Roadster" #define PROGRAM_COPYRIGHT "Copyright (c) 2005 Ian McIntosh" @@ -125,7 +126,7 @@ typedef enum { static void mainwindow_setup_selected_tool(void); static void mainwindow_map_center_on_windowpoint(gint nX, gint nY); static void mainwindow_add_history(); -static void mainwindow_on_web_url_clicked(GtkWidget *_unused, gpointer* pszURLPattern); +static void mainwindow_on_web_url_clicked(GtkWidget *_unused, gchar* pszURLPattern); static gboolean mainwindow_on_mouse_button_click(GtkWidget* w, GdkEventButton *event); static gboolean mainwindow_on_mouse_motion(GtkWidget* w, GdkEventMotion *event); @@ -198,7 +199,7 @@ struct { GtkProgressBar* pProgressBar; // Boxes - GtkHBox* pContentBox; + GtkVBox* pContentBox; // Drawing area GtkDrawingArea* pDrawingArea; @@ -228,7 +229,7 @@ struct { animator_t* pAnimator; // History (forward / back) - history_t* pHistory; + maphistory_t* pMapHistory; GtkButton* pForwardButton; GtkButton* pBackButton; GtkMenuItem* pForwardMenuItem; @@ -328,11 +329,11 @@ void mainwindow_init_add_web_maps_menu_items() else { pszName = g_strdup_printf("%s", aWebMapURLs[i].pszName); } - GtkMenuItem* pNewMenuItem = gtk_menu_item_new_with_mnemonic(pszName); + GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName)); g_free(pszName); // Add a click handler which gets passed the URL with {TAGS} - g_signal_connect(G_OBJECT(pNewMenuItem), "activate", mainwindow_on_web_url_clicked, aWebMapURLs[i].pszURL); + g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mainwindow_on_web_url_clicked, aWebMapURLs[i].pszURL); gtk_menu_shell_append(GTK_MENU_SHELL(pSubMenu), GTK_WIDGET(pNewMenuItem)); } @@ -353,7 +354,6 @@ void mainwindow_init(GladeXML* pGladeXML) GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pSidebarNotebook, GTK_NOTEBOOK, "sidebarnotebook"); GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pContentBox, GTK_VBOX, "mainwindowcontentsbox"); - // Zoom controls GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pZoomInButton, GTK_BUTTON, "zoominbutton"); GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pZoomInMenuItem, GTK_MENU_ITEM, "zoominmenuitem"); @@ -386,7 +386,7 @@ void mainwindow_init(GladeXML* pGladeXML) GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pBackButton, GTK_BUTTON, "backbutton"); GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pForwardMenuItem, GTK_MENU_ITEM, "forwardmenuitem"); GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pBackMenuItem, GTK_MENU_ITEM, "backmenuitem"); - g_MainWindow.pHistory = history_new(); + g_MainWindow.pMapHistory = map_history_new(); // LocationSet Widgets GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pLocationSetsTreeView, GTK_TREE_VIEW, "locationsetstreeview"); @@ -401,8 +401,6 @@ void mainwindow_init(GladeXML* pGladeXML) // Drawing area g_MainWindow.pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new()); - g_print("initializing glyphs\n"); - glyph_init(g_MainWindow.pDrawingArea); gtk_widget_show(GTK_WIDGET(g_MainWindow.pDrawingArea)); // create map and load style @@ -1632,18 +1630,18 @@ void mainwindow_sidebar_set_tab(gint nTab) // void mainwindow_update_forward_back_buttons() { - gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pForwardButton), history_can_go_forward(g_MainWindow.pHistory)); - gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pBackButton), history_can_go_back(g_MainWindow.pHistory)); + gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pForwardButton), map_history_can_go_forward(g_MainWindow.pMapHistory)); + gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pBackButton), map_history_can_go_back(g_MainWindow.pMapHistory)); - gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pForwardMenuItem), history_can_go_forward(g_MainWindow.pHistory)); - gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pBackMenuItem), history_can_go_back(g_MainWindow.pHistory)); + gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pForwardMenuItem), map_history_can_go_forward(g_MainWindow.pMapHistory)); + gtk_widget_set_sensitive(GTK_WIDGET(g_MainWindow.pBackMenuItem), map_history_can_go_back(g_MainWindow.pMapHistory)); } void mainwindow_go_to_current_history_item() { mappoint_t point; gint nZoomLevel; - history_get_current(g_MainWindow.pHistory, &point, &nZoomLevel); + map_history_get_current(g_MainWindow.pMapHistory, &point, &nZoomLevel); mainwindow_set_zoomlevel(nZoomLevel); mainwindow_map_center_on_mappoint(&point); @@ -1652,14 +1650,14 @@ void mainwindow_go_to_current_history_item() void mainwindow_on_backbutton_clicked(GtkWidget* _unused, gpointer* __unused) { - history_go_back(g_MainWindow.pHistory); + map_history_go_back(g_MainWindow.pMapHistory); mainwindow_go_to_current_history_item(); mainwindow_update_forward_back_buttons(); } void mainwindow_on_forwardbutton_clicked(GtkWidget* _unused, gpointer* __unused) { - history_go_forward(g_MainWindow.pHistory); + map_history_go_forward(g_MainWindow.pMapHistory); mainwindow_go_to_current_history_item(); mainwindow_update_forward_back_buttons(); } @@ -1670,7 +1668,7 @@ static void mainwindow_add_history() mappoint_t point; map_get_centerpoint(g_MainWindow.pMap, &point); - history_add(g_MainWindow.pHistory, &point, map_get_zoomlevel(g_MainWindow.pMap)); + map_history_add(g_MainWindow.pMapHistory, &point, map_get_zoomlevel(g_MainWindow.pMap)); mainwindow_update_forward_back_buttons(); } @@ -1732,7 +1730,7 @@ void mainwindow_on_addpointmenuitem_activate(GtkWidget *_unused, gpointer* __unu // } } -void mainwindow_on_web_url_clicked(GtkWidget *_unused, gpointer* pszURLPattern) +static void mainwindow_on_web_url_clicked(GtkWidget *_unused, gchar* pszURLPattern) { static util_str_replace_t apszReplacements[] = { {"{LAT}", NULL}, @@ -68,12 +68,14 @@ #define MIN_ZOOMLEVEL_FOR_LOCATIONS (6) /* Prototypes */ +static void map_init_location_hash(map_t* pMap); // data loading static gboolean map_data_load_tiles(map_t* pMap, maprect_t* pRect); static gboolean map_data_load_geometry(map_t* pMap, maprect_t* pRect); static gboolean map_data_load_locations(map_t* pMap, maprect_t* pRect); + // hit testing static gboolean map_hit_test_layer_roads(GPtrArray* pPointStringsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, maphit_t** ppReturnStruct); static gboolean map_hit_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fMaxDistance, mappoint_t* pReturnClosestPoint, gdouble* pfReturnPercentAlongLine); @@ -1250,7 +1252,7 @@ gboolean map_layer_render_type_atoi(const gchar* pszName, gint* pnReturnRenderTy return FALSE; } -void map_callback_free_locations_array(gpointer* p) +void map_callback_free_locations_array(gpointer p) { GPtrArray* pLocationsArray = (GPtrArray*)p; gint i; diff --git a/src/map_draw_cairo.c b/src/map_draw_cairo.c index 35d3475..e3543e1 100644 --- a/src/map_draw_cairo.c +++ b/src/map_draw_cairo.c @@ -55,6 +55,7 @@ #include "location.h" #include "locationset.h" #include "scenemanager.h" +#include "util.h" // Draw whole layers static void map_draw_cairo_layer_polygons(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, maplayerstyle_t* pLayerStyle); diff --git a/src/map_draw_gdk.c b/src/map_draw_gdk.c index d5c5920..4f53b6d 100644 --- a/src/map_draw_gdk.c +++ b/src/map_draw_gdk.c @@ -138,7 +138,7 @@ static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, renderm // Instead of filling with a color, fill with a tiled image gdk_gc_get_values(pGC, &gcValues); gdk_gc_set_fill(pGC, GDK_TILED); - gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill)); + gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill, pMap->pTargetWidget)); // This makes the fill image scroll with the map, instead of staying still gdk_gc_set_ts_origin(pGC, SCALE_X(pRenderMetrics, pRenderMetrics->fScreenLongitude), SCALE_Y(pRenderMetrics, pRenderMetrics->fScreenLatitude)); @@ -192,7 +192,7 @@ static void map_draw_gdk_layer_fill(map_t* pMap, GdkPixmap* pPixmap, rendermetri // Instead of filling with a color, fill with a tiled image gdk_gc_get_values(pGC, &gcValues); gdk_gc_set_fill(pGC, GDK_TILED); - gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill)); + gdk_gc_set_tile(pGC, glyph_get_pixmap(pLayerStyle->pGlyphFill, pMap->pTargetWidget)); // This makes the fill image scroll with the map, instead of staying still gdk_gc_set_ts_origin(pGC, SCALE_X(pRenderMetrics, pRenderMetrics->fScreenLongitude), SCALE_Y(pRenderMetrics, pRenderMetrics->fScreenLatitude)); diff --git a/src/history.c b/src/map_history.c index e63cb9f..d889b9f 100644 --- a/src/history.c +++ b/src/map_history.c @@ -23,28 +23,23 @@ #include <gtk/gtk.h> #include "main.h" -#include "history.h" #include "map.h" +#include "map_history.h" typedef struct { mappoint_t MapPoint; gint nZoomLevel; } mapview_t; -void history_init(void) +maphistory_t* map_history_new() { - // module init -} - -history_t* history_new() -{ - history_t* pNew = g_new0(history_t, 1); + maphistory_t* pNew = g_new0(maphistory_t, 1); pNew->MapViewArray = g_array_new(FALSE, FALSE, sizeof(mapview_t)); pNew->nCurrentIndex = -1; return pNew; } -void history_add(history_t* pHistory, mappoint_t* pPoint, gint nZoomLevel) +void map_history_add(maphistory_t* pHistory, mappoint_t* pPoint, gint nZoomLevel) { g_assert(pHistory != NULL); g_assert(pPoint != NULL); @@ -79,33 +74,33 @@ void history_add(history_t* pHistory, mappoint_t* pPoint, gint nZoomLevel) g_assert(pHistory->nCurrentIndex < pHistory->nTotalItems); } -gboolean history_can_go_forward(history_t* pHistory) +gboolean map_history_can_go_forward(maphistory_t* pHistory) { return(pHistory->nCurrentIndex < (pHistory->nTotalItems - 1)); } -gboolean history_can_go_back(history_t* pHistory) +gboolean map_history_can_go_back(maphistory_t* pHistory) { return(pHistory->nCurrentIndex > 0); } -gboolean history_go_forward(history_t* pHistory) +gboolean map_history_go_forward(maphistory_t* pHistory) { - if(history_can_go_forward(pHistory)) { + if(map_history_can_go_forward(pHistory)) { pHistory->nCurrentIndex++; return TRUE; } } -gboolean history_go_back(history_t* pHistory) +gboolean map_history_go_back(maphistory_t* pHistory) { - if(history_can_go_back(pHistory)) { + if(map_history_can_go_back(pHistory)) { pHistory->nCurrentIndex--; return TRUE; } } -void history_get_current(history_t* pHistory, mappoint_t* pReturnPoint, gint* pnReturnZoomLevel) +void map_history_get_current(maphistory_t* pHistory, mappoint_t* pReturnPoint, gint* pnReturnZoomLevel) { g_assert(pHistory != NULL); g_assert(pReturnPoint != NULL); diff --git a/src/history.h b/src/map_history.h index 779aec1..25caaba 100644 --- a/src/history.h +++ b/src/map_history.h @@ -30,16 +30,15 @@ typedef struct { gint nCurrentIndex; gint nTotalItems; GArray* MapViewArray; -} history_t; +} maphistory_t; -void history_init(void); -history_t* history_new(); -void history_add(history_t* pHistory, mappoint_t* pPoint, gint nZoomLevel); -gboolean history_can_go_forward(history_t* pHistory); -gboolean history_can_go_back(history_t* pHistory); -gboolean history_go_forward(history_t* pHistory); -gboolean history_go_back(history_t* pHistory); +maphistory_t* map_history_new(); +void map_history_add(maphistory_t* pHistory, mappoint_t* pPoint, gint nZoomLevel); +gboolean map_history_can_go_forward(maphistory_t* pHistory); +gboolean map_history_can_go_back(maphistory_t* pHistory); +gboolean map_history_go_forward(maphistory_t* pHistory); +gboolean map_history_go_back(maphistory_t* pHistory); -void history_get_current(history_t* pHistory, mappoint_t* pReturnPoint, gint* pnReturnZoomLevel); +void map_history_get_current(maphistory_t* pHistory, mappoint_t* pReturnPoint, gint* pnReturnZoomLevel); #endif diff --git a/src/map_style.c b/src/map_style.c index 7e4bb15..7c508eb 100644 --- a/src/map_style.c +++ b/src/map_style.c @@ -27,6 +27,7 @@ #include <libxml/parser.h> #include <libxml/tree.h> #include "main.h" +#include "glyph.h" #include "map_style.h" // utility functions for iterating through lists of XML things diff --git a/src/tooltip.c b/src/tooltip.c deleted file mode 100644 index 7ac3c3b..0000000 --- a/src/tooltip.c +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * tooltip.c - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@linuxadvocate.org - ****************************************************************************/ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <gtk/gtk.h> - -#include "main.h" -#include "tooltip.h" - -static gboolean tooltip_on_mouse_motion(GtkWidget* w, GdkEventMotion *event); - -tooltip_t* tooltip_new() -{ - tooltip_t* pNew = g_new0(tooltip_t, 1); - - // create tooltip window - pNew->pWindow = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP)); - //gtk_widget_set_name(GTK_WIDGET(pNew->pWindow), "gtk-tooltips"); - gtk_widget_add_events(GTK_WIDGET(pNew->pWindow), GDK_POINTER_MOTION_MASK | GDK_EXPOSURE_MASK); - g_signal_connect(G_OBJECT(pNew->pWindow), "motion_notify_event", G_CALLBACK(tooltip_on_mouse_motion), NULL); - gtk_window_set_resizable(pNew->pWindow, FALSE); // FALSE means window will resize to hug the label. - - // create frame (draws the nice outline for us) and add to window (we don't need to keep a pointer to this) - GtkFrame* pFrame = GTK_FRAME(gtk_frame_new(NULL)); - gtk_frame_set_shadow_type(pFrame, GTK_SHADOW_IN); - gtk_container_add(GTK_CONTAINER(pNew->pWindow), GTK_WIDGET(pFrame)); - - - // create label and add to frame - pNew->pLabel = GTK_LABEL(gtk_label_new("testing")); - gtk_container_add(GTK_CONTAINER(pFrame), GTK_WIDGET(pNew->pLabel)); - - pNew->bEnabled = TRUE; // XXX: currently no API to disable it - - return pNew; -} - -void tooltip_set_markup(tooltip_t* pTooltip, const gchar* pszMarkup) -{ - gtk_label_set_markup(pTooltip->pLabel, pszMarkup); -} - -void tooltip_set_bg_color(tooltip_t* pTooltip, GdkColor* pColor) -{ - gtk_widget_modify_bg(GTK_WIDGET(pTooltip->pWindow), GTK_STATE_NORMAL, pColor); -} - -void tooltip_set_upper_left_corner(tooltip_t* pTooltip, gint nX, gint nY) -{ - gtk_window_move(pTooltip->pWindow, nX, nY); -} - -void tooltip_show(tooltip_t* pTooltip) -{ - if(pTooltip->bEnabled) { - gtk_widget_show_all(GTK_WIDGET(pTooltip->pWindow)); - } -} - -void tooltip_hide(tooltip_t* pTooltip) -{ - gtk_widget_hide(GTK_WIDGET(pTooltip->pWindow)); -} - -static gboolean tooltip_on_mouse_motion(GtkWidget* pWidget, GdkEventMotion *__unused) -{ - // in case the mouse makes its way onto the tooltip, hide it. - gtk_widget_hide(pWidget); -} - - diff --git a/src/tooltip.h b/src/tooltip.h deleted file mode 100644 index 11ecb46..0000000 --- a/src/tooltip.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * tooltip.h - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@linuxadvocate.org - ****************************************************************************/ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _TOOLTIP_H -#define _TOOLTIP_H - -typedef struct { - GtkWindow* pWindow; - GtkLabel* pLabel; - - gboolean bEnabled; -} tooltip_t; - -tooltip_t* tooltip_new(); -void tooltip_set_markup(tooltip_t* pTooltip, const gchar* pszMarkup); -void tooltip_set_upper_left_corner(tooltip_t* pTooltip, gint nX, gint nY); -void tooltip_show(tooltip_t* pTooltip); -void tooltip_hide(tooltip_t* pTooltip); -void tooltip_set_bg_color(tooltip_t* pTooltip, GdkColor* pColor); - -#endif @@ -177,7 +177,7 @@ gboolean util_parse_hex_color(const gchar* pszString, void* pvReturnColor) { color_t* pReturnColor = (color_t*)pvReturnColor; - gchar *p = pszString; + const gchar *p = pszString; if (*p == '#') p++; if(strlen(p) != 8) { @@ -409,30 +409,30 @@ gchar* util_str_replace_many(const gchar* pszSource, util_str_replace_t* aReplac // static void _util_gtk_entry_set_hint_text(GtkEntry* pEntry, const gchar* pszHint) { - gtk_widget_modify_text(pEntry, GTK_STATE_NORMAL, &(GTK_WIDGET(pEntry)->style->text_aa[GTK_WIDGET_STATE(pEntry)])); + gtk_widget_modify_text(GTK_WIDGET(pEntry), GTK_STATE_NORMAL, &(GTK_WIDGET(pEntry)->style->text_aa[GTK_WIDGET_STATE(pEntry)])); gtk_entry_set_text(pEntry, pszHint); } static void _util_gtk_entry_clear_hint_text(GtkEntry* pEntry) { - gtk_widget_modify_text(pEntry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text(GTK_WIDGET(pEntry), GTK_STATE_NORMAL, NULL); gtk_entry_set_text(pEntry, ""); } -static gboolean _util_gtk_entry_on_focus_in_event(GtkEntry* pEntry, GdkEventFocus* _unused, gchar* pszHint) +static gboolean _util_gtk_entry_on_focus_in_event(GtkEntry* pEntry, GdkEventFocus* _unused, const gchar* pszHint) { // If the box is showing pszHint, clear it - gchar* pszExistingText = gtk_entry_get_text(pEntry); + const gchar* pszExistingText = gtk_entry_get_text(pEntry); if(strcmp(pszExistingText, pszHint) == 0) { _util_gtk_entry_clear_hint_text(pEntry); } return FALSE; // always say we didn't handle it so the normal processing happens } -static gboolean _util_gtk_entry_on_focus_out_event(GtkEntry* pEntry, GdkEventFocus* _unused, gchar* pszHint) +static gboolean _util_gtk_entry_on_focus_out_event(GtkEntry* pEntry, GdkEventFocus* _unused, const gchar* pszHint) { // If the box is empty, set the hint text - gchar* pszExistingText = gtk_entry_get_text(pEntry); + const gchar* pszExistingText = gtk_entry_get_text(pEntry); if(strcmp(pszExistingText, "") == 0) { _util_gtk_entry_set_hint_text(pEntry, pszHint); } @@ -442,8 +442,8 @@ static gboolean _util_gtk_entry_on_focus_out_event(GtkEntry* pEntry, GdkEventFoc // The API void util_gtk_entry_add_hint_text(GtkEntry* pEntry, const gchar* pszHint) { - g_signal_connect(G_OBJECT(pEntry), "focus-in-event", _util_gtk_entry_on_focus_in_event, pszHint); - g_signal_connect(G_OBJECT(pEntry), "focus-out-event", _util_gtk_entry_on_focus_out_event, pszHint); + g_signal_connect(G_OBJECT(pEntry), "focus-in-event", G_CALLBACK(_util_gtk_entry_on_focus_in_event), (gpointer)pszHint); + g_signal_connect(G_OBJECT(pEntry), "focus-out-event", G_CALLBACK(_util_gtk_entry_on_focus_out_event), (gpointer)pszHint); // Init it _util_gtk_entry_on_focus_out_event(pEntry, NULL, pszHint); @@ -72,6 +72,7 @@ typedef struct { } util_str_replace_t; gchar* util_str_replace_many(const gchar* pszSource, util_str_replace_t* aReplacements, gint nNumReplacements); +gchar** util_split_words_onto_two_lines(const gchar* pszText, gint nMinLineLength, gint nMaxLineLength); // GtkEntry "hint" void util_gtk_entry_add_hint_text(GtkEntry* pEntry, const gchar* pszMessage); diff --git a/src/welcomewindow.c b/src/welcomewindow.c deleted file mode 100644 index 1ed83d6..0000000 --- a/src/welcomewindow.c +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * welcomewindow.c - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@linuxadvocate.org - ****************************************************************************/ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <glade/glade.h> - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <gtk/gtk.h> - -#include "main.h" -#include "mainwindow.h" -#include "welcomewindow.h" - -#define URL_CENSUS_GOV_TIGER_DATA_WEBSITE ("http://www.census.gov/geo/www/tiger/tiger2004se/tgr2004se.html") - -struct { - GtkWindow* pWindow; -} g_WelcomeWindow; - -void welcomewindow_init(GladeXML* pGladeXML) -{ - g_WelcomeWindow.pWindow = GTK_WINDOW(glade_xml_get_widget(pGladeXML, "welcomewindow")); g_return_if_fail(g_WelcomeWindow.pWindow != NULL); -} - -void welcomewindow_show(void) -{ - gtk_widget_show(GTK_WIDGET(g_WelcomeWindow.pWindow)); - gtk_window_present(g_WelcomeWindow.pWindow); -} - -static void welcomewindow_hide(void) -{ - gtk_widget_hide(GTK_WIDGET(g_WelcomeWindow.pWindow)); -} - -/* Callbacks */ - -void welcomewindow_on_url_clicked(GtkWidget* pButton, gpointer data) -{ - if(!gnome_url_show(URL_CENSUS_GOV_TIGER_DATA_WEBSITE, NULL)) { - // TODO: something? - } -} - -void welcomewindow_on_okbutton_clicked(GtkWidget* pButton, gpointer data) -{ - welcomewindow_hide(); - mainwindow_show(); -} diff --git a/src/welcomewindow.h b/src/welcomewindow.h deleted file mode 100644 index 1e14758..0000000 --- a/src/welcomewindow.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * welcomewindow.h - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@linuxadvocate.org - ****************************************************************************/ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _WELCOMEWINDOW_H -#define _WELCOMEWINDOW_H - -G_BEGIN_DECLS - -void welcomewindow_init(GladeXML* pGladeXML); -void welcomewindow_show(void); - -/* Funky, auto-lookup glade signal handlers. - - XXX: Better would be to hook these up manually, remove these - declarations, and make the functions static. -*/ -void welcomewindow_on_url_clicked(GtkWidget* pButton, gpointer data); -void welcomewindow_on_okbutton_clicked(GtkWidget* pButton, gpointer data); - -G_END_DECLS - -#endif /* _WELCOMEWINDOW_H */ |