r7192 - in dumbhippo/trunk/client: common/hippo linux linux/src windows/HippoUI
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7192 - in dumbhippo/trunk/client: common/hippo linux linux/src windows/HippoUI
- Date: Fri, 11 Jan 2008 17:13:59 -0600 (CST)
Author: otaylor
Date: 2008-01-11 17:13:58 -0600 (Fri, 11 Jan 2008)
New Revision: 7192
Added:
dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.c
dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.h
dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.c
dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.h
Modified:
dumbhippo/trunk/client/common/hippo/hippo-actions.c
dumbhippo/trunk/client/common/hippo/hippo-actions.h
dumbhippo/trunk/client/common/hippo/hippo-connection.c
dumbhippo/trunk/client/common/hippo/hippo-image-cache.c
dumbhippo/trunk/client/common/hippo/hippo-image-cache.h
dumbhippo/trunk/client/common/hippo/hippo-object-cache.c
dumbhippo/trunk/client/common/hippo/hippo-object-cache.h
dumbhippo/trunk/client/common/hippo/hippo-platform.c
dumbhippo/trunk/client/common/hippo/hippo-platform.h
dumbhippo/trunk/client/common/hippo/hippo-quip-window.c
dumbhippo/trunk/client/common/hippo/hippo-quip-window.h
dumbhippo/trunk/client/common/hippo/hippo-stack-manager.c
dumbhippo/trunk/client/common/hippo/hippo-stack-manager.h
dumbhippo/trunk/client/common/hippo/hippo-track.c
dumbhippo/trunk/client/linux/Makefile-libhippo.am
dumbhippo/trunk/client/linux/Makefile-mugshot.am
dumbhippo/trunk/client/linux/src/hippo-platform-impl.c
dumbhippo/trunk/client/linux/src/hippo-status-icon.c
dumbhippo/trunk/client/linux/src/hippo-ui.c
dumbhippo/trunk/client/linux/src/hippo-ui.h
dumbhippo/trunk/client/linux/src/main.c
dumbhippo/trunk/client/linux/src/main.h
dumbhippo/trunk/client/windows/HippoUI/HippoPlatformImpl.cpp
dumbhippo/trunk/client/windows/HippoUI/HippoUI.cpp
Log:
Split the HippoPlatform interface into two pieces:
HippoPlatform: Backend-specific functions for the data-model engine
HippoStackerPlatform: Backend-specific functions for the Mugshot stacker
Modified: dumbhippo/trunk/client/common/hippo/hippo-actions.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-actions.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-actions.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -16,7 +16,7 @@
struct _HippoActions {
GObject parent;
DDMDataModel *model;
- HippoPlatform *platform;
+ HippoStackerPlatform *platform;
HippoStackManager *stack_manager;
/* We have an image cache for each kind of
@@ -142,9 +142,9 @@
}
HippoActions*
-hippo_actions_new(DDMDataModel *model,
- HippoPlatform *platform,
- HippoStackManager *stack_manager)
+hippo_actions_new(DDMDataModel *model,
+ HippoStackerPlatform *platform,
+ HippoStackManager *stack_manager)
{
HippoActions *actions;
@@ -398,7 +398,8 @@
hippo_actions_join_chat_id(HippoActions *actions,
const char *chat_id)
{
- hippo_platform_show_chat_window(actions->platform, chat_id);
+
+ hippo_stacker_platform_show_chat_window(actions->platform, chat_id);
}
void
@@ -417,7 +418,7 @@
hippo_actions_can_play_song_download(HippoActions *actions,
HippoSongDownload *song_download)
{
- return hippo_platform_can_play_song_download(actions->platform, song_download);
+ return hippo_stacker_platform_can_play_song_download(actions->platform, song_download);
}
void
Modified: dumbhippo/trunk/client/common/hippo/hippo-actions.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-actions.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-actions.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -21,10 +21,12 @@
* can_play_song_download(). -owt
*/
-#include <hippo/hippo-data-cache.h>
+#include <ddm/ddm.h>
#include <hippo/hippo-block.h>
#include <hippo/hippo-group.h>
+#include <hippo/hippo-person.h>
#include <hippo/hippo-canvas-item.h>
+#include <hippo/hippo-stacker-platform.h>
#include <hippo/hippo-stack-manager.h>
@@ -42,9 +44,9 @@
GType hippo_actions_get_type (void) G_GNUC_CONST;
-HippoActions* hippo_actions_new (DDMDataModel *model,
- HippoPlatform *platform,
- HippoStackManager *stack_manager);
+HippoActions* hippo_actions_new (DDMDataModel *model,
+ HippoStackerPlatform *platform,
+ HippoStackManager *stack_manager);
void hippo_actions_visit_post (HippoActions *actions,
HippoPost *post);
Modified: dumbhippo/trunk/client/common/hippo/hippo-connection.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-connection.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-connection.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -1982,24 +1982,6 @@
send_chat_room_message(connection, to, text, sentiment);
}
-void
-hippo_connection_send_quip(HippoConnection *connection,
- HippoChatKind kind,
- const char *id,
- const char *text,
- HippoSentiment sentiment)
-{
- char *node, *to;
-
- node = hippo_id_to_jabber_id(id);
- to = g_strconcat(node, "@" HIPPO_ROOMS_JID_DOMAIN, NULL);
- g_free(node);
-
- send_chat_room_message(connection, to, text, sentiment);
-
- g_free(to);
-}
-
static gboolean
parse_room_jid(const char *jid,
char **chat_id_p,
Modified: dumbhippo/trunk/client/common/hippo/hippo-image-cache.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-image-cache.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-image-cache.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -44,7 +44,7 @@
}
HippoImageCache*
-hippo_image_cache_new(HippoPlatform *platform)
+hippo_image_cache_new(HippoStackerPlatform *platform)
{
HippoImageCache *cache;
Modified: dumbhippo/trunk/client/common/hippo/hippo-image-cache.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-image-cache.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-image-cache.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -23,7 +23,7 @@
GType hippo_image_cache_get_type (void) G_GNUC_CONST;
-HippoImageCache* hippo_image_cache_new (HippoPlatform *platform);
+HippoImageCache* hippo_image_cache_new (HippoStackerPlatform *platform);
/* callback is invoked synchronously if there's a cache hit */
void hippo_image_cache_load (HippoImageCache *cache,
Modified: dumbhippo/trunk/client/common/hippo/hippo-object-cache.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-object-cache.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-object-cache.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -41,7 +41,7 @@
typedef struct {
- HippoPlatform *platform;
+ HippoStackerPlatform *platform;
CacheEntry *strong_cache[MAX_STRONG_ENTRIES];
@@ -245,8 +245,8 @@
entry->loading = TRUE;
cache_entry_ref(entry); /* held by http_func */
- hippo_platform_http_request(priv->platform,
- entry->url, http_func, entry);
+ hippo_stacker_platform_http_request(priv->platform,
+ entry->url, http_func, entry);
}
} else {
/* nothing to do, just keep waiting for http to return */
@@ -338,8 +338,8 @@
switch (prop_id) {
case PROP_PLATFORM:
{
- HippoPlatform *new_platform =
- (HippoPlatform*) g_value_get_object(value);
+ HippoStackerPlatform *new_platform =
+ (HippoStackerPlatform*) g_value_get_object(value);
if (new_platform != priv->platform) {
if (priv->platform)
g_object_unref(priv->platform);
@@ -380,7 +380,7 @@
}
HippoObjectCache*
-hippo_object_cache_new(HippoPlatform *platform)
+hippo_object_cache_new(HippoStackerPlatform *platform)
{
HippoObjectCache *cache;
Modified: dumbhippo/trunk/client/common/hippo/hippo-object-cache.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-object-cache.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-object-cache.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -4,7 +4,7 @@
/* A cache of objects (such as images) that are retrieved via http */
-#include <hippo/hippo-platform.h>
+#include <hippo/hippo-stacker-platform.h>
G_BEGIN_DECLS
@@ -42,7 +42,7 @@
GType hippo_object_cache_get_type (void) G_GNUC_CONST;
-HippoObjectCache* hippo_object_cache_new (HippoPlatform *platform);
+HippoObjectCache* hippo_object_cache_new (HippoStackerPlatform *platform);
/* callback is invoked synchronously if there's a cache hit */
void hippo_object_cache_load (HippoObjectCache *cache,
Modified: dumbhippo/trunk/client/common/hippo/hippo-platform.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-platform.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-platform.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -68,39 +68,7 @@
HIPPO_PLATFORM_GET_CLASS(platform)->get_platform_info(platform, info);
}
-HippoWindow*
-hippo_platform_create_window(HippoPlatform *platform)
-{
- g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), NULL);
-
- return HIPPO_PLATFORM_GET_CLASS(platform)->create_window(platform);
-}
-
-void
-hippo_platform_get_screen_info(HippoPlatform *platform,
- HippoRectangle *monitor_rect_p,
- HippoRectangle *tray_icon_rect_p,
- HippoOrientation *tray_icon_orientation_p)
-{
- g_return_if_fail(HIPPO_IS_PLATFORM(platform));
-
- HIPPO_PLATFORM_GET_CLASS(platform)->get_screen_info(platform,
- monitor_rect_p,
- tray_icon_rect_p,
- tray_icon_orientation_p);
-}
-
gboolean
-hippo_platform_get_pointer_position(HippoPlatform *platform,
- int *x_p,
- int *y_p)
-{
- g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), FALSE);
-
- return HIPPO_PLATFORM_GET_CLASS(platform)->get_pointer_position(platform, x_p, y_p);
-}
-
-gboolean
hippo_platform_read_login_cookie(HippoPlatform *platform,
HippoServerType web_server_type,
HippoBrowserKind *origin_browser_p,
@@ -141,48 +109,6 @@
url);
}
-void
-hippo_platform_http_request(HippoPlatform *platform,
- const char *url,
- HippoHttpFunc func,
- void *data)
-{
- g_return_if_fail(HIPPO_IS_PLATFORM(platform));
-
- HIPPO_PLATFORM_GET_CLASS(platform)->http_request(platform,
- url,
- func,
- data);
-}
-
-gboolean
-hippo_platform_can_play_song_download(HippoPlatform *platform,
- HippoSongDownload *song_download)
-{
- g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), FALSE);
-
- return HIPPO_PLATFORM_GET_CLASS(platform)->can_play_song_download(platform, song_download);
-}
-
-void
-hippo_platform_show_chat_window(HippoPlatform *platform,
- const char *chat_id)
-{
- g_return_if_fail(HIPPO_IS_PLATFORM(platform));
-
- HIPPO_PLATFORM_GET_CLASS(platform)->show_chat_window(platform,
- chat_id);
-}
-
-HippoWindowState
-hippo_platform_get_chat_window_state (HippoPlatform *platform,
- const char *chat_id)
-{
- g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), HIPPO_WINDOW_STATE_CLOSED);
-
- return HIPPO_PLATFORM_GET_CLASS(platform)->get_chat_window_state(platform, chat_id);
-}
-
HippoInstanceType
hippo_platform_get_instance_type (HippoPlatform *platform)
{
@@ -277,21 +203,6 @@
g_free(server);
}
-void
-hippo_platform_show_disconnected_window (HippoPlatform *platform,
- HippoConnection *connection)
-{
- HippoPlatformClass *klass;
-
- g_return_if_fail(HIPPO_IS_PLATFORM(platform));
-
- klass = HIPPO_PLATFORM_GET_CLASS(platform);
-
- if (klass->show_disconnected_window != NULL) {
- (* klass->show_disconnected_window) (platform, connection);
- }
-}
-
HippoNetworkStatus
hippo_platform_get_network_status(HippoPlatform *platform)
{
Modified: dumbhippo/trunk/client/common/hippo/hippo-platform.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-platform.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-platform.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -38,16 +38,6 @@
void (* get_platform_info) (HippoPlatform *platform,
HippoPlatformInfo *info);
- HippoWindow* (* create_window) (HippoPlatform *platform);
-
- void (* get_screen_info) (HippoPlatform *platform,
- HippoRectangle *monitor_rect_p,
- HippoRectangle *tray_icon_rect_p,
- HippoOrientation *tray_icon_orientation_p);
- gboolean (* get_pointer_position) (HippoPlatform *platform,
- int *x_p,
- int *y_p);
-
gboolean (* read_login_cookie) (HippoPlatform *platform,
HippoServerType web_server_type,
HippoBrowserKind *origin_browser_p,
@@ -61,22 +51,6 @@
HippoBrowserKind browser,
const char *url);
- void (* http_request) (HippoPlatform *platform,
- const char *url,
- HippoHttpFunc func,
- void *data);
-
- void (* show_chat_window) (HippoPlatform *platform,
- const char *chat_id);
- HippoWindowState (* get_chat_window_state) (HippoPlatform *platform,
- const char *chat_id);
-
- gboolean (* can_play_song_download) (HippoPlatform *platform,
- HippoSongDownload *song_download);
-
- void (* show_disconnected_window) (HippoPlatform *platform,
- HippoConnection *connection);
-
HippoNetworkStatus (* get_network_status) (HippoPlatform *platform);
/* Preferences */
@@ -106,23 +80,6 @@
void hippo_platform_get_platform_info (HippoPlatform *platform,
HippoPlatformInfo *info);
-HippoWindow* hippo_platform_create_window (HippoPlatform *platform);
-
-/* monitor_rect is the portion of the "work area" (the area for client
- * windows) on the same monitor as the tray icon
- */
-void hippo_platform_get_screen_info (HippoPlatform *platform,
- HippoRectangle *monitor_rect_p,
- HippoRectangle *tray_icon_rect_p,
- HippoOrientation *tray_icon_orientation_p);
-/* Returns false if the pointer isn't on the same screen as the the tray icon; x_p/y_p
- * will be set to arbitrary values in that case. You probably can ignore the case, since
- * multiple non-combined screens (an X concept) is vanishingly rare.
- */
-gboolean hippo_platform_get_pointer_position (HippoPlatform *platform,
- int *x_p,
- int *y_p);
-
gboolean hippo_platform_read_login_cookie (HippoPlatform *platform,
HippoServerType server_type,
HippoBrowserKind *origin_browser_p,
@@ -136,23 +93,6 @@
HippoBrowserKind browser,
const char *url);
-void hippo_platform_show_chat_window (HippoPlatform *platform,
- const char *chat_id);
-HippoWindowState hippo_platform_get_chat_window_state (HippoPlatform *platform,
- const char *chat_id);
-
-void hippo_platform_http_request (HippoPlatform *platform,
- const char *url,
- HippoHttpFunc func,
- void *data);
-
-gboolean hippo_platform_can_play_song_download (HippoPlatform *platform,
- HippoSongDownload *song_download);
-
-void hippo_platform_show_disconnected_window (HippoPlatform *platform,
- HippoConnection *connection);
-
-
HippoNetworkStatus hippo_platform_get_network_status (HippoPlatform *platform);
void hippo_platform_emit_network_status_changed (HippoPlatform *platform,
Modified: dumbhippo/trunk/client/common/hippo/hippo-quip-window.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-quip-window.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-quip-window.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -20,7 +20,7 @@
struct _HippoQuipWindow {
GObject parent;
DDMDataModel *model;
- HippoPlatform *platform;
+ HippoStackerPlatform *platform;
HippoChatKind chat_kind;
char *chat_id;
@@ -250,8 +250,8 @@
}
HippoQuipWindow*
-hippo_quip_window_new(DDMDataModel *model,
- HippoPlatform *platform)
+hippo_quip_window_new(DDMDataModel *model,
+ HippoStackerPlatform *platform)
{
HippoQuipWindow *quip_window;
HippoCanvasBox *outer_box;
@@ -262,7 +262,7 @@
HippoCanvasItem *item;
g_return_val_if_fail(DDM_IS_DATA_MODEL(model), NULL);
- g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), NULL);
+ g_return_val_if_fail(HIPPO_IS_STACKER_PLATFORM(platform), NULL);
quip_window = g_object_new(HIPPO_TYPE_QUIP_WINDOW,
NULL);
@@ -270,7 +270,7 @@
quip_window->model = g_object_ref(model);
quip_window->platform = g_object_ref(platform);
- quip_window->window = hippo_platform_create_window(quip_window->platform);
+ quip_window->window = hippo_stacker_platform_create_window(quip_window->platform);
g_signal_connect(quip_window->window, "notify::active",
G_CALLBACK(on_notify_active), quip_window);
@@ -472,9 +472,9 @@
quip_window->visible = TRUE;
g_object_ref(quip_window);
- hippo_platform_get_screen_info(quip_window->platform, &monitor_rect, NULL, NULL);
+ hippo_stacker_platform_get_screen_info(quip_window->platform, &monitor_rect, NULL, NULL);
- if (!hippo_platform_get_pointer_position(quip_window->platform, &pointer_x, &pointer_y)) {
+ if (!hippo_stacker_platform_get_pointer_position(quip_window->platform, &pointer_x, &pointer_y)) {
/* Pointer on a different X screen, we'll just position at lower right */
pointer_x = monitor_rect.x + monitor_rect.width;
pointer_y = monitor_rect.y + monitor_rect.height;
Modified: dumbhippo/trunk/client/common/hippo/hippo-quip-window.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-quip-window.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-quip-window.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -2,7 +2,8 @@
#ifndef __HIPPO_QUIP_WINDOW_H__
#define __HIPPO_QUIP_WINDOW_H__
-#include <hippo/hippo-data-cache.h>
+#include <ddm/ddm.h>
+#include <hippo/hippo-stacker-platform.h>
G_BEGIN_DECLS
@@ -18,8 +19,8 @@
GType hippo_quip_window_get_type (void) G_GNUC_CONST;
-HippoQuipWindow* hippo_quip_window_new (DDMDataModel *model,
- HippoPlatform *platform);
+HippoQuipWindow* hippo_quip_window_new (DDMDataModel *model,
+ HippoStackerPlatform *platform);
void hippo_quip_window_set_chat (HippoQuipWindow *quip_window,
HippoChatKind chat_kind,
Modified: dumbhippo/trunk/client/common/hippo/hippo-stack-manager.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-stack-manager.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-stack-manager.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -28,7 +28,7 @@
struct _HippoStackManager {
HippoDataCache *cache;
DDMDataModel *model;
- HippoPlatform *platform;
+ HippoStackerPlatform *platform;
HippoActions *actions;
gboolean nofeed_active;
gboolean noselfsource_active;
@@ -207,7 +207,7 @@
HippoRectangle icon;
HippoOrientation icon_orientation;
- hippo_platform_get_screen_info(manager->platform, &monitor, &icon, &icon_orientation);
+ hippo_stacker_platform_get_screen_info(manager->platform, &monitor, &icon, &icon_orientation);
update_for_screen_info(manager, &monitor, &icon, icon_orientation, position_browser, position_notification);
}
@@ -225,7 +225,7 @@
* advantage
*/
- hippo_platform_get_screen_info(manager->platform, &monitor, NULL, NULL);
+ hippo_stacker_platform_get_screen_info(manager->platform, &monitor, NULL, NULL);
hippo_canvas_item_get_width_request(manager->browser_box, &natural_width, NULL);
@@ -406,7 +406,7 @@
* don't distinguish close and minimize, so we show the minimize animation if
* possible.
*/
- hippo_platform_get_screen_info(manager->platform, NULL, &icon, NULL);
+ hippo_stacker_platform_get_screen_info(manager->platform, NULL, &icon, NULL);
hippo_window_hide_to_icon(manager->browser_window, &icon);
}
@@ -567,7 +567,7 @@
chat_is_visible(StackManager *manager,
const char *chat_id)
{
- switch (hippo_platform_get_chat_window_state(manager->platform, chat_id)) {
+ switch (hippo_stacker_platform_get_chat_window_state(manager->platform, chat_id)) {
case HIPPO_WINDOW_STATE_CLOSED:
return FALSE;
case HIPPO_WINDOW_STATE_HIDDEN:
@@ -975,7 +975,8 @@
}
HippoStackManager*
-hippo_stack_manager_new(HippoDataCache *cache)
+hippo_stack_manager_new(DDMDataModel *model,
+ HippoStackerPlatform *platform)
{
StackManager *manager;
HippoConnection *connection;
@@ -984,14 +985,12 @@
manager->item_to_block = g_hash_table_new_full(g_direct_hash, NULL,
NULL, (GDestroyNotify)g_object_unref);
- manager->model = g_object_ref(hippo_data_cache_get_model(cache));
-
- connection = hippo_data_cache_get_connection(cache);
- manager->platform = g_object_ref(hippo_connection_get_platform(connection));
+ manager->model = g_object_ref(model);
+ manager->platform = g_object_ref(platform);
manager->actions = hippo_actions_new(manager->model, manager->platform, manager);
- manager->browser_window = hippo_platform_create_window(manager->platform);
+ manager->browser_window = hippo_stacker_platform_create_window(manager->platform);
#ifdef WITH_MAEMO
g_object_set(manager->browser_window, "role", HIPPO_WINDOW_ROLE_NOTIFICATION, NULL);
@@ -1064,7 +1063,7 @@
hippo_window_set_contents(manager->browser_window, manager->browser_box);
- manager->notification_window = hippo_platform_create_window(manager->platform);
+ manager->notification_window = hippo_stacker_platform_create_window(manager->platform);
/* Omit the window from the task-list and (for platforms where there is one) the pager */
g_object_set(manager->notification_window, "role", HIPPO_WINDOW_ROLE_NOTIFICATION, NULL);
Modified: dumbhippo/trunk/client/common/hippo/hippo-stack-manager.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-stack-manager.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-stack-manager.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -6,11 +6,14 @@
* Manage all the windows that make up the stacker UI, when to display them, etc.
*/
-#include <hippo/hippo-data-cache.h>
+#include <ddm/ddm.h>
+#include <hippo/hippo-stacker-platform.h>
G_BEGIN_DECLS
-HippoStackManager* hippo_stack_manager_new (HippoDataCache *cache);
+HippoStackManager* hippo_stack_manager_new (DDMDataModel *model,
+ HippoStackerPlatform *platform);
+
void hippo_stack_manager_free (HippoStackManager *manager);
void hippo_stack_manager_set_idle (HippoStackManager *manager,
Copied: dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.c (from rev 7178, dumbhippo/trunk/client/common/hippo/hippo-platform.c)
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-platform.c 2008-01-10 18:46:33 UTC (rev 7178)
+++ dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -0,0 +1,124 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#include "hippo-stacker-platform.h"
+#include "hippo-connection.h"
+
+static void hippo_stacker_platform_base_init(void *klass);
+
+GType
+hippo_stacker_platform_get_type(void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info =
+ {
+ sizeof(HippoStackerPlatformClass),
+ hippo_stacker_platform_base_init,
+ NULL /* base_finalize */
+ };
+ type = g_type_register_static(G_TYPE_INTERFACE, "HippoStackerPlatform",
+ &info, 0);
+ }
+
+ return type;
+}
+
+static void
+hippo_stacker_platform_base_init(void *klass)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ /* create signals in here */
+
+ initialized = TRUE;
+ }
+}
+
+HippoWindow*
+hippo_stacker_platform_create_window(HippoStackerPlatform *platform)
+{
+ g_return_val_if_fail(HIPPO_IS_STACKER_PLATFORM(platform), NULL);
+
+ return HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->create_window(platform);
+}
+
+void
+hippo_stacker_platform_get_screen_info(HippoStackerPlatform *platform,
+ HippoRectangle *monitor_rect_p,
+ HippoRectangle *tray_icon_rect_p,
+ HippoOrientation *tray_icon_orientation_p)
+{
+ g_return_if_fail(HIPPO_IS_STACKER_PLATFORM(platform));
+
+ HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->get_screen_info(platform,
+ monitor_rect_p,
+ tray_icon_rect_p,
+ tray_icon_orientation_p);
+}
+
+gboolean
+hippo_stacker_platform_get_pointer_position(HippoStackerPlatform *platform,
+ int *x_p,
+ int *y_p)
+{
+ g_return_val_if_fail(HIPPO_IS_STACKER_PLATFORM(platform), FALSE);
+
+ return HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->get_pointer_position(platform, x_p, y_p);
+}
+
+void
+hippo_stacker_platform_http_request(HippoStackerPlatform *platform,
+ const char *url,
+ HippoHttpFunc func,
+ void *data)
+{
+ g_return_if_fail(HIPPO_IS_STACKER_PLATFORM(platform));
+
+ HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->http_request(platform,
+ url,
+ func,
+ data);
+}
+
+gboolean
+hippo_stacker_platform_can_play_song_download(HippoStackerPlatform *platform,
+ HippoSongDownload *song_download)
+{
+ g_return_val_if_fail(HIPPO_IS_STACKER_PLATFORM(platform), FALSE);
+
+ return HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->can_play_song_download(platform, song_download);
+}
+
+void
+hippo_stacker_platform_show_chat_window(HippoStackerPlatform *platform,
+ const char *chat_id)
+{
+ g_return_if_fail(HIPPO_IS_STACKER_PLATFORM(platform));
+
+ HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->show_chat_window(platform,
+ chat_id);
+}
+
+HippoWindowState
+hippo_stacker_platform_get_chat_window_state (HippoStackerPlatform *platform,
+ const char *chat_id)
+{
+ g_return_val_if_fail(HIPPO_IS_STACKER_PLATFORM(platform), HIPPO_WINDOW_STATE_CLOSED);
+
+ return HIPPO_STACKER_PLATFORM_GET_CLASS(platform)->get_chat_window_state(platform, chat_id);
+}
+
+void
+hippo_stacker_platform_show_disconnected_window (HippoStackerPlatform *platform,
+ HippoConnection *connection)
+{
+ HippoStackerPlatformClass *klass;
+
+ g_return_if_fail(HIPPO_IS_STACKER_PLATFORM(platform));
+
+ klass = HIPPO_STACKER_PLATFORM_GET_CLASS(platform);
+
+ if (klass->show_disconnected_window != NULL) {
+ (* klass->show_disconnected_window) (platform, connection);
+ }
+}
Copied: dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.h (from rev 7178, dumbhippo/trunk/client/common/hippo/hippo-platform.h)
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-platform.h 2008-01-10 18:46:33 UTC (rev 7178)
+++ dumbhippo/trunk/client/common/hippo/hippo-stacker-platform.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -0,0 +1,92 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#ifndef __HIPPO_STACKER_PLATFORM_H__
+#define __HIPPO_STACKER_PLATFORM_H__
+
+#include <hippo/hippo-basics.h>
+#include <hippo/hippo-post.h>
+#include <hippo/hippo-graphics.h>
+#include <hippo/hippo-track.h>
+
+G_BEGIN_DECLS
+
+typedef struct _HippoStackerPlatform HippoStackerPlatform;
+typedef struct _HippoStackerPlatformClass HippoStackerPlatformClass;
+
+#define HIPPO_TYPE_STACKER_PLATFORM (hippo_stacker_platform_get_type ())
+#define HIPPO_STACKER_PLATFORM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_STACKER_PLATFORM, HippoStackerPlatform))
+#define HIPPO_STACKER_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HIPPO_TYPE_STACKER_PLATFORM, HippoStackerPlatformClass))
+#define HIPPO_IS_STACKER_PLATFORM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HIPPO_TYPE_STACKER_PLATFORM))
+#define HIPPO_IS_STACKER_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_STACKER_PLATFORM))
+#define HIPPO_STACKER_PLATFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), HIPPO_TYPE_STACKER_PLATFORM, HippoStackerPlatformClass))
+
+struct _HippoStackerPlatformClass {
+ GTypeInterface base_iface;
+
+ HippoWindow* (* create_window) (HippoStackerPlatform *platform);
+
+ void (* get_screen_info) (HippoStackerPlatform *platform,
+ HippoRectangle *monitor_rect_p,
+ HippoRectangle *tray_icon_rect_p,
+ HippoOrientation *tray_icon_orientation_p);
+
+ gboolean (* get_pointer_position) (HippoStackerPlatform *platform,
+ int *x_p,
+ int *y_p);
+
+ void (* http_request) (HippoStackerPlatform *platform,
+ const char *url,
+ HippoHttpFunc func,
+ void *data);
+
+ void (* show_chat_window) (HippoStackerPlatform *platform,
+ const char *chat_id);
+
+ HippoWindowState (* get_chat_window_state) (HippoStackerPlatform *platform,
+ const char *chat_id);
+
+ gboolean (* can_play_song_download) (HippoStackerPlatform *platform,
+ HippoSongDownload *song_download);
+
+ void (* show_disconnected_window) (HippoStackerPlatform *platform,
+ HippoConnection *connection);
+};
+
+GType hippo_stacker_platform_get_type (void) G_GNUC_CONST;
+
+HippoWindow* hippo_stacker_platform_create_window (HippoStackerPlatform *platform);
+
+/* monitor_rect is the portion of the "work area" (the area for client
+ * windows) on the same monitor as the tray icon
+ */
+void hippo_stacker_platform_get_screen_info (HippoStackerPlatform *platform,
+ HippoRectangle *monitor_rect_p,
+ HippoRectangle *tray_icon_rect_p,
+ HippoOrientation *tray_icon_orientation_p);
+
+/* Returns false if the pointer isn't on the same screen as the the tray icon; x_p/y_p
+ * will be set to arbitrary values in that case. You probably can ignore the case, since
+ * multiple non-combined screens (an X concept) is vanishingly rare.
+ */
+gboolean hippo_stacker_platform_get_pointer_position (HippoStackerPlatform *platform,
+ int *x_p,
+ int *y_p);
+
+void hippo_stacker_platform_show_chat_window (HippoStackerPlatform *platform,
+ const char *chat_id);
+HippoWindowState hippo_stacker_platform_get_chat_window_state (HippoStackerPlatform *platform,
+ const char *chat_id);
+
+void hippo_stacker_platform_http_request (HippoStackerPlatform *platform,
+ const char *url,
+ HippoHttpFunc func,
+ void *data);
+
+gboolean hippo_stacker_platform_can_play_song_download (HippoStackerPlatform *platform,
+ HippoSongDownload *song_download);
+
+void hippo_stacker_platform_show_disconnected_window (HippoStackerPlatform *platform,
+ HippoConnection *connection);
+
+G_END_DECLS
+
+#endif /* __HIPPO_STACKER_PLATFORM_H__ */
Modified: dumbhippo/trunk/client/common/hippo/hippo-track.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-track.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/common/hippo/hippo-track.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -16,9 +16,6 @@
GValue *value,
GParamSpec *pspec);
-static HippoSongDownload *hippo_song_download_new_from_xml (HippoDataCache *cache,
- LmMessageNode *node);
-
struct _HippoTrack {
GObject parent;
@@ -201,6 +198,7 @@
}
}
+#if 0
static gboolean
track_ended(gpointer data)
{
@@ -213,6 +211,7 @@
return FALSE;
}
+#endif
/* === HippoTrack exported API === */
@@ -312,7 +311,8 @@
track->now_playing = now_playing;
return track;
-#endif
+#endif
+ return NULL;
}
const char*
@@ -409,31 +409,6 @@
char *url;
};
-static HippoSongDownload *
-hippo_song_download_new_from_xml(HippoDataCache *cache,
- LmMessageNode *node)
-{
- HippoSongDownload *download;
- const char *source_str;
- const char *url;
- HippoSongDownloadSource source;
-
- if (!hippo_xml_split(cache, node, NULL,
- "source", HIPPO_SPLIT_STRING, &source_str,
- "url", HIPPO_SPLIT_URI_ABSOLUTE, &url,
- NULL))
- return NULL;
-
- if (!song_download_source_from_string(source_str, &source))
- return NULL;
-
- download = g_new(HippoSongDownload, 1);
- download->source = source;
- download->url = g_strdup(url);
-
- return download;
-}
-
HippoSongDownload *
hippo_song_download_new_from_string(const char *string)
{
Modified: dumbhippo/trunk/client/linux/Makefile-libhippo.am
===================================================================
--- dumbhippo/trunk/client/linux/Makefile-libhippo.am 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/Makefile-libhippo.am 2008-01-11 23:13:58 UTC (rev 7192)
@@ -152,6 +152,8 @@
$(COMMONSRCDIR)/hippo/hippo-settings.h \
$(COMMONSRCDIR)/hippo/hippo-stack-manager.c \
$(COMMONSRCDIR)/hippo/hippo-stack-manager.h \
+ $(COMMONSRCDIR)/hippo/hippo-stacker-platform.c \
+ $(COMMONSRCDIR)/hippo/hippo-stacker-platform.h \
$(COMMONSRCDIR)/hippo/hippo-surface.c \
$(COMMONSRCDIR)/hippo/hippo-surface.h \
$(COMMONSRCDIR)/hippo/hippo-thumbnails.c \
Modified: dumbhippo/trunk/client/linux/Makefile-mugshot.am
===================================================================
--- dumbhippo/trunk/client/linux/Makefile-mugshot.am 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/Makefile-mugshot.am 2008-01-11 23:13:58 UTC (rev 7192)
@@ -62,6 +62,8 @@
src/hippo-platform-impl.h \
src/hippo-ui.c \
src/hippo-ui.h \
+ src/hippo-stacker-platform-impl.c \
+ src/hippo-stacker-platform-impl.h \
src/hippo-status-icon.c \
src/hippo-status-icon.h \
src/hippo-window-gtk.c \
Modified: dumbhippo/trunk/client/linux/src/hippo-platform-impl.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-platform-impl.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/hippo-platform-impl.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -3,9 +3,6 @@
#include "hippo-platform-impl.h"
#include "hippo-cookies-linux.h"
#include "hippo-distribution.h"
-#include "hippo-window-wrapper.h"
-#include "hippo-status-icon.h"
-#include "hippo-http.h"
#include "hippo-dbus-system.h"
#include "main.h"
#include <dbus/dbus.h>
@@ -22,14 +19,6 @@
static void hippo_platform_impl_get_platform_info (HippoPlatform *platform,
HippoPlatformInfo *info);
-static HippoWindow* hippo_platform_impl_create_window (HippoPlatform *platform);
-static void hippo_platform_impl_get_screen_info (HippoPlatform *platform,
- HippoRectangle *monitor_rect_p,
- HippoRectangle *tray_icon_rect_p,
- HippoOrientation *tray_icon_orientation_p);
-static gboolean hippo_platform_impl_get_pointer_position (HippoPlatform *platform,
- int *x_p,
- int *y_p);
static gboolean hippo_platform_impl_read_login_cookie (HippoPlatform *platform,
HippoServerType web_server_type,
HippoBrowserKind *origin_browser_p,
@@ -40,20 +29,7 @@
static void hippo_platform_impl_open_url (HippoPlatform *platform,
HippoBrowserKind browser,
const char *url);
-static void hippo_platform_impl_http_request (HippoPlatform *platform,
- const char *url,
- HippoHttpFunc func,
- void *data);
-static void hippo_platform_impl_show_chat_window (HippoPlatform *platform,
- const char *chat_id);
-static HippoWindowState hippo_platform_impl_get_chat_window_state (HippoPlatform *platform,
- const char *chat_id);
-
-static gboolean hippo_platform_impl_can_play_song_download (HippoPlatform *platform,
- HippoSongDownload *song_download);
-static void hippo_platform_impl_show_disconnected_window (HippoPlatform *platform,
- HippoConnection *connection);
static HippoNetworkStatus hippo_platform_impl_get_network_status (HippoPlatform *platform);
static HippoInstanceType hippo_platform_impl_get_instance_type (HippoPlatform *platform);
@@ -73,18 +49,6 @@
const char *server,
const char *user_id);
-typedef struct Dialogs Dialogs;
-
-static Dialogs* dialogs_get (HippoConnection *connection);
-static void dialogs_destroy (Dialogs *dialogs);
-static void dialogs_update_disconnected_window (Dialogs *dialogs,
- gboolean show_if_not_showing);
-static void dialogs_update_login (Dialogs *dialogs,
- gboolean show_if_not_showing);
-static void dialogs_update_status (Dialogs *dialogs,
- gboolean show_if_not_showing);
-
-
struct _HippoPlatformImpl {
GObject parent;
HippoInstanceType instance;
@@ -120,18 +84,10 @@
hippo_platform_impl_iface_init(HippoPlatformClass *klass)
{
klass->get_platform_info = hippo_platform_impl_get_platform_info;
- klass->create_window = hippo_platform_impl_create_window;
- klass->get_screen_info = hippo_platform_impl_get_screen_info;
- klass->get_pointer_position = hippo_platform_impl_get_pointer_position;
klass->read_login_cookie = hippo_platform_impl_read_login_cookie;
klass->delete_login_cookie = hippo_platform_impl_delete_login_cookie;
klass->get_jabber_resource = hippo_platform_impl_get_jabber_resource;
klass->open_url = hippo_platform_impl_open_url;
- klass->http_request = hippo_platform_impl_http_request;
- klass->show_chat_window = hippo_platform_impl_show_chat_window;
- klass->get_chat_window_state = hippo_platform_impl_get_chat_window_state;
- klass->can_play_song_download = hippo_platform_impl_can_play_song_download;
- klass->show_disconnected_window = hippo_platform_impl_show_disconnected_window;
klass->get_network_status = hippo_platform_impl_get_network_status;
klass->get_instance_type = hippo_platform_impl_get_instance_type;
@@ -264,31 +220,7 @@
}
}
-static HippoWindow*
-hippo_platform_impl_create_window(HippoPlatform *platform)
-{
- return HIPPO_WINDOW(hippo_window_wrapper_new());
-}
-
-static void
-hippo_platform_impl_get_screen_info(HippoPlatform *platform,
- HippoRectangle *monitor_rect_p,
- HippoRectangle *tray_icon_rect_p,
- HippoOrientation *tray_icon_orientation_p)
-{
- hippo_app_get_screen_info(hippo_get_app(), monitor_rect_p, tray_icon_rect_p,
- tray_icon_orientation_p);
-}
-
static gboolean
-hippo_platform_impl_get_pointer_position (HippoPlatform *platform,
- int *x_p,
- int *y_p)
-{
- return hippo_app_get_pointer_position(hippo_get_app(), x_p, y_p);
-}
-
-static gboolean
hippo_platform_impl_read_login_cookie(HippoPlatform *platform,
HippoServerType web_server_type,
HippoBrowserKind *origin_browser_p,
@@ -492,57 +424,6 @@
g_free(quoted);
}
-static void
-hippo_platform_impl_http_request(HippoPlatform *platform,
- const char *url,
- HippoHttpFunc func,
- void *data)
-{
- hippo_http_get(url, func, data);
-}
-
-static void
-hippo_platform_impl_show_chat_window (HippoPlatform *platform,
- const char *chat_id)
-{
- hippo_app_join_chat(hippo_get_app(), chat_id);
-}
-
-HippoWindowState
-hippo_platform_impl_get_chat_window_state (HippoPlatform *platform,
- const char *chat_id)
-{
- return hippo_app_get_chat_state(hippo_get_app(), chat_id);
-}
-
-static gboolean
-hippo_platform_impl_can_play_song_download(HippoPlatform *platform,
- HippoSongDownload *song_download)
-{
- switch (hippo_song_download_get_source(song_download)) {
- case HIPPO_SONG_DOWNLOAD_ITUNES:
- return FALSE;
- case HIPPO_SONG_DOWNLOAD_YAHOO:
- return FALSE;
- case HIPPO_SONG_DOWNLOAD_RHAPSODY:
- return TRUE;
- }
-
- return TRUE;
-}
-
-static void
-hippo_platform_impl_show_disconnected_window(HippoPlatform *platform,
- HippoConnection *connection)
-{
- /* HippoPlatformImpl *impl = HIPPO_PLATFORM_IMPL(platform); */
- Dialogs *dialogs;
-
- dialogs = dialogs_get(connection);
-
- dialogs_update_disconnected_window(dialogs, TRUE);
-}
-
static HippoNetworkStatus
hippo_platform_impl_get_network_status (HippoPlatform *platform)
{
@@ -650,220 +531,3 @@
return path;
}
-
-/* We want to show either a login dialog or a dialog with connection status
- * when the tray icon is clicked but we aren't signed in
- */
-struct Dialogs {
- HippoConnection *connection;
- guint connection_state_id;
- GtkWidget *login_dialog;
- GtkWidget *connection_status_dialog;
-};
-
-static void
-dialogs_connection_destroyed(Dialogs *dialogs)
-{
- dialogs_destroy(dialogs);
-
- /* this isn't needed since the connection is already disposed */
- /* g_signal_handler_disconnect(dialogs->connection,
- dialogs->connection_state_id); */
-
- g_free(dialogs);
-}
-
-static void
-state_changed_cb(HippoConnection *connection,
- Dialogs *dialogs)
-{
- /* update dialog text and/or which dialog is showing */
- dialogs_update_disconnected_window(dialogs, FALSE);
-}
-
-static Dialogs*
-dialogs_get(HippoConnection *connection)
-{
- Dialogs *dialogs;
-
- dialogs = g_object_get_data(G_OBJECT(connection), "status-dialogs");
- if (dialogs == NULL) {
- dialogs = g_new0(Dialogs, 1);
- dialogs->connection = connection;
- g_object_set_data_full(G_OBJECT(connection), "status-dialogs", dialogs,
- (GDestroyNotify) dialogs_connection_destroyed);
- dialogs->connection_state_id = g_signal_connect(G_OBJECT(dialogs->connection),
- "state-changed",
- G_CALLBACK(state_changed_cb),
- dialogs);
- }
-
- return dialogs;
-}
-
-static void
-dialogs_update_disconnected_window (Dialogs *dialogs,
- gboolean show_if_not_showing)
-{
- HippoConnection *connection = dialogs->connection;
-
- if (hippo_connection_get_need_login(connection)) {
- dialogs_update_login(dialogs, show_if_not_showing);
- } else if (!hippo_connection_get_connected(connection)) {
- dialogs_update_status(dialogs, show_if_not_showing);
- } else {
- dialogs_destroy(dialogs);
- }
-}
-
-static void
-dialogs_destroy(Dialogs *dialogs)
-{
- if (dialogs->login_dialog) {
- g_object_run_dispose(G_OBJECT(dialogs->login_dialog));
- dialogs->login_dialog = NULL;
- }
-
- if (dialogs->connection_status_dialog) {
- g_object_run_dispose(G_OBJECT(dialogs->connection_status_dialog));
- dialogs->connection_status_dialog = NULL;
- }
-}
-
-static void
-login_response_cb(GtkDialog *dialog,
- int response_id,
- void *data)
-{
- Dialogs *dialogs = data;
-
- if (response_id == GTK_RESPONSE_ACCEPT) {
- hippo_connection_open_maybe_relative_url(dialogs->connection,
- "/who-are-you");
-
- /* Though we don't expect this to succeed immediately (the
- * user has not yet had the chance to login) calling this
- * here has the side-effect of putting us into the mode where
- * we check for a new auth token every 5 seconds for a
- * few minutes.
- */
- hippo_connection_signin(dialogs->connection);
- }
- g_object_run_dispose(G_OBJECT(dialog));
-}
-
-
-static void
-dialogs_update_login(Dialogs *dialogs,
- gboolean show_if_not_showing)
-{
- if (dialogs->login_dialog == NULL && show_if_not_showing) {
- dialogs_destroy(dialogs); /* Kill any other dialogs */
-
- dialogs->login_dialog = gtk_message_dialog_new(NULL, 0,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_NONE,
- _("You need to log in to mugshot.org"));
-
- gtk_window_set_title(GTK_WINDOW(dialogs->login_dialog), _("Mugshot Login"));
-
- gtk_dialog_add_buttons(GTK_DIALOG(dialogs->login_dialog),
- _("Cancel"), GTK_RESPONSE_REJECT,
- _("Open Login Page"), GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_dialog_set_default_response(GTK_DIALOG(dialogs->login_dialog), GTK_RESPONSE_ACCEPT);
-
- g_signal_connect(G_OBJECT(dialogs->login_dialog), "response",
- G_CALLBACK(login_response_cb), dialogs);
-
- g_signal_connect(G_OBJECT(dialogs->login_dialog), "destroy",
- G_CALLBACK(gtk_widget_destroyed), &dialogs->login_dialog);
- }
-
- if (dialogs->login_dialog)
- gtk_window_present(GTK_WINDOW(dialogs->login_dialog));
-}
-
-
-/* the not-logged-in states shouldn't display here, since we should show the
- * login dialog in that case instead
- */
-static const char*
-get_status_message(HippoConnection *connection)
-{
- const char *msg;
-
- msg = NULL;
-
- if (hippo_connection_get_need_login(connection))
- return _("Mugshot is not connected - please log in to mugshot.org");
-
- switch (hippo_connection_get_state(connection)) {
- case HIPPO_STATE_SIGNED_OUT:
- case HIPPO_STATE_RETRYING:
- msg = _("Mugshot is not connected, but will try reconnecting soon");
- break;
- case HIPPO_STATE_SIGN_IN_WAIT:
- case HIPPO_STATE_AUTH_WAIT:
- msg = _("Mugshot is not connected - please log in to mugshot.org");
- break;
- case HIPPO_STATE_CONNECTING:
- case HIPPO_STATE_REDIRECTING:
- case HIPPO_STATE_AUTHENTICATING:
- msg = _("Mugshot is trying to connect to mugshot.org");
- break;
- case HIPPO_STATE_AWAITING_CLIENT_INFO:
- msg = _("Mugshot is checking for new versions");
- break;
- case HIPPO_STATE_AUTHENTICATED:
- msg = _("Mugshot is connected!");
- break;
- }
-
- return msg;
-}
-
-static void
-set_state_text(Dialogs *dialogs)
-{
- if (dialogs->connection_status_dialog) {
- g_object_set(G_OBJECT(dialogs->connection_status_dialog),
- "text", get_status_message(dialogs->connection),
- NULL);
- }
-}
-
-static void
-status_response_cb(GtkDialog *dialog,
- int response_id,
- void *data)
-{
- g_object_run_dispose(G_OBJECT(dialog));
-}
-
-static void
-dialogs_update_status(Dialogs *dialogs,
- gboolean show_if_not_showing)
-{
- if (dialogs->connection_status_dialog == NULL && show_if_not_showing) {
- dialogs_destroy(dialogs); /* Kill any other dialogs */
-
- dialogs->connection_status_dialog = gtk_message_dialog_new(NULL, 0,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- "%s", get_status_message(dialogs->connection));
-
- gtk_window_set_title(GTK_WINDOW(dialogs->connection_status_dialog), _("Mugshot Status"));
-
- g_signal_connect(G_OBJECT(dialogs->connection_status_dialog), "response",
- G_CALLBACK(status_response_cb), dialogs);
-
- g_signal_connect(G_OBJECT(dialogs->connection_status_dialog), "destroy",
- G_CALLBACK(gtk_widget_destroyed), &dialogs->connection_status_dialog);
- } else {
- set_state_text(dialogs);
- }
-
- if (dialogs->connection_status_dialog)
- gtk_window_present(GTK_WINDOW(dialogs->connection_status_dialog));
-}
Copied: dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.c (from rev 7178, dumbhippo/trunk/client/linux/src/hippo-platform-impl.c)
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-platform-impl.c 2008-01-10 18:46:33 UTC (rev 7178)
+++ dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -0,0 +1,415 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#include <config.h>
+#include "hippo-stacker-platform-impl.h"
+#include "hippo-window-wrapper.h"
+#include "hippo-status-icon.h"
+#include "hippo-http.h"
+#include "main.h"
+#include <string.h>
+#include <errno.h>
+
+static void hippo_stacker_platform_impl_init (HippoStackerPlatformImpl *impl);
+static void hippo_stacker_platform_impl_class_init (HippoStackerPlatformImplClass *klass);
+static void hippo_stacker_platform_impl_iface_init (HippoStackerPlatformClass *klass);
+
+static void hippo_stacker_platform_impl_dispose (GObject *object);
+static void hippo_stacker_platform_impl_finalize (GObject *object);
+
+
+static HippoWindow* hippo_stacker_platform_impl_create_window (HippoStackerPlatform *platform);
+static void hippo_stacker_platform_impl_get_screen_info (HippoStackerPlatform *platform,
+ HippoRectangle *monitor_rect_p,
+ HippoRectangle *tray_icon_rect_p,
+ HippoOrientation *tray_icon_orientation_p);
+static gboolean hippo_stacker_platform_impl_get_pointer_position (HippoStackerPlatform *platform,
+ int *x_p,
+ int *y_p);
+static void hippo_stacker_platform_impl_http_request (HippoStackerPlatform *platform,
+ const char *url,
+ HippoHttpFunc func,
+ void *data);
+
+static void hippo_stacker_platform_impl_show_chat_window (HippoStackerPlatform *platform,
+ const char *chat_id);
+static HippoWindowState hippo_stacker_platform_impl_get_chat_window_state (HippoStackerPlatform *platform,
+ const char *chat_id);
+
+static gboolean hippo_stacker_platform_impl_can_play_song_download (HippoStackerPlatform *platform,
+ HippoSongDownload *song_download);
+static void hippo_stacker_platform_impl_show_disconnected_window (HippoStackerPlatform *platform,
+ HippoConnection *connection);
+
+typedef struct Dialogs Dialogs;
+
+static Dialogs* dialogs_get (HippoConnection *connection);
+static void dialogs_destroy (Dialogs *dialogs);
+static void dialogs_update_disconnected_window (Dialogs *dialogs,
+ gboolean show_if_not_showing);
+static void dialogs_update_login (Dialogs *dialogs,
+ gboolean show_if_not_showing);
+static void dialogs_update_status (Dialogs *dialogs,
+ gboolean show_if_not_showing);
+
+
+struct _HippoStackerPlatformImpl {
+ GObject parent;
+ HippoInstanceType instance;
+};
+
+struct _HippoStackerPlatformImplClass {
+ GObjectClass parent_class;
+
+};
+
+G_DEFINE_TYPE_WITH_CODE(HippoStackerPlatformImpl, hippo_stacker_platform_impl, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(HIPPO_TYPE_STACKER_PLATFORM, hippo_stacker_platform_impl_iface_init));
+
+
+static void
+hippo_stacker_platform_impl_iface_init(HippoStackerPlatformClass *klass)
+{
+ klass->create_window = hippo_stacker_platform_impl_create_window;
+ klass->get_screen_info = hippo_stacker_platform_impl_get_screen_info;
+ klass->get_pointer_position = hippo_stacker_platform_impl_get_pointer_position;
+ klass->http_request = hippo_stacker_platform_impl_http_request;
+ klass->show_chat_window = hippo_stacker_platform_impl_show_chat_window;
+ klass->get_chat_window_state = hippo_stacker_platform_impl_get_chat_window_state;
+ klass->can_play_song_download = hippo_stacker_platform_impl_can_play_song_download;
+ klass->show_disconnected_window = hippo_stacker_platform_impl_show_disconnected_window;
+}
+
+static void
+hippo_stacker_platform_impl_init(HippoStackerPlatformImpl *impl)
+{
+
+}
+
+static void
+hippo_stacker_platform_impl_class_init(HippoStackerPlatformImplClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+ object_class->finalize = hippo_stacker_platform_impl_finalize;
+ object_class->dispose = hippo_stacker_platform_impl_dispose;
+}
+
+HippoStackerPlatform*
+hippo_stacker_platform_impl_new(void)
+{
+ HippoStackerPlatformImpl *impl;
+ GError *error;
+
+ impl = g_object_new(HIPPO_TYPE_STACKER_PLATFORM_IMPL, NULL);
+
+ error = NULL;
+
+ return HIPPO_STACKER_PLATFORM(impl);
+}
+
+static void
+hippo_stacker_platform_impl_dispose(GObject *object)
+{
+ /* HippoStackerPlatformImpl *impl = HIPPO_STACKER_PLATFORM_IMPL(object); */
+
+ G_OBJECT_CLASS(hippo_stacker_platform_impl_parent_class)->finalize(object);
+}
+
+static void
+hippo_stacker_platform_impl_finalize(GObject *object)
+{
+ /* HippoStackerPlatformImpl *impl = HIPPO_STACKER_PLATFORM_IMPL(object); */
+
+ G_OBJECT_CLASS(hippo_stacker_platform_impl_parent_class)->finalize(object);
+}
+
+static HippoWindow*
+hippo_stacker_platform_impl_create_window(HippoStackerPlatform *platform)
+{
+ return HIPPO_WINDOW(hippo_window_wrapper_new());
+}
+
+static void
+hippo_stacker_platform_impl_get_screen_info(HippoStackerPlatform *platform,
+ HippoRectangle *monitor_rect_p,
+ HippoRectangle *tray_icon_rect_p,
+ HippoOrientation *tray_icon_orientation_p)
+{
+ hippo_app_get_screen_info(hippo_get_app(), monitor_rect_p, tray_icon_rect_p,
+ tray_icon_orientation_p);
+}
+
+static gboolean
+hippo_stacker_platform_impl_get_pointer_position (HippoStackerPlatform *platform,
+ int *x_p,
+ int *y_p)
+{
+ return hippo_app_get_pointer_position(hippo_get_app(), x_p, y_p);
+}
+
+static void
+hippo_stacker_platform_impl_http_request(HippoStackerPlatform *platform,
+ const char *url,
+ HippoHttpFunc func,
+ void *data)
+{
+ hippo_http_get(url, func, data);
+}
+
+static void
+hippo_stacker_platform_impl_show_chat_window (HippoStackerPlatform *platform,
+ const char *chat_id)
+{
+ hippo_app_join_chat(hippo_get_app(), chat_id);
+}
+
+HippoWindowState
+hippo_stacker_platform_impl_get_chat_window_state (HippoStackerPlatform *platform,
+ const char *chat_id)
+{
+ return hippo_app_get_chat_state(hippo_get_app(), chat_id);
+}
+
+static gboolean
+hippo_stacker_platform_impl_can_play_song_download(HippoStackerPlatform *platform,
+ HippoSongDownload *song_download)
+{
+ switch (hippo_song_download_get_source(song_download)) {
+ case HIPPO_SONG_DOWNLOAD_ITUNES:
+ return FALSE;
+ case HIPPO_SONG_DOWNLOAD_YAHOO:
+ return FALSE;
+ case HIPPO_SONG_DOWNLOAD_RHAPSODY:
+ return TRUE;
+ }
+
+ return TRUE;
+}
+
+static void
+hippo_stacker_platform_impl_show_disconnected_window(HippoStackerPlatform *platform,
+ HippoConnection *connection)
+{
+ /* HippoStackerPlatformImpl *impl = HIPPO_STACKER_PLATFORM_IMPL(platform); */
+ Dialogs *dialogs;
+
+ dialogs = dialogs_get(connection);
+
+ dialogs_update_disconnected_window(dialogs, TRUE);
+}
+
+/* We want to show either a login dialog or a dialog with connection status
+ * when the tray icon is clicked but we aren't signed in
+ */
+struct Dialogs {
+ HippoConnection *connection;
+ guint connection_state_id;
+ GtkWidget *login_dialog;
+ GtkWidget *connection_status_dialog;
+};
+
+static void
+dialogs_connection_destroyed(Dialogs *dialogs)
+{
+ dialogs_destroy(dialogs);
+
+ /* this isn't needed since the connection is already disposed */
+ /* g_signal_handler_disconnect(dialogs->connection,
+ dialogs->connection_state_id); */
+
+ g_free(dialogs);
+}
+
+static void
+state_changed_cb(HippoConnection *connection,
+ Dialogs *dialogs)
+{
+ /* update dialog text and/or which dialog is showing */
+ dialogs_update_disconnected_window(dialogs, FALSE);
+}
+
+static Dialogs*
+dialogs_get(HippoConnection *connection)
+{
+ Dialogs *dialogs;
+
+ dialogs = g_object_get_data(G_OBJECT(connection), "status-dialogs");
+ if (dialogs == NULL) {
+ dialogs = g_new0(Dialogs, 1);
+ dialogs->connection = connection;
+ g_object_set_data_full(G_OBJECT(connection), "status-dialogs", dialogs,
+ (GDestroyNotify) dialogs_connection_destroyed);
+ dialogs->connection_state_id = g_signal_connect(G_OBJECT(dialogs->connection),
+ "state-changed",
+ G_CALLBACK(state_changed_cb),
+ dialogs);
+ }
+
+ return dialogs;
+}
+
+static void
+dialogs_update_disconnected_window (Dialogs *dialogs,
+ gboolean show_if_not_showing)
+{
+ HippoConnection *connection = dialogs->connection;
+
+ if (hippo_connection_get_need_login(connection)) {
+ dialogs_update_login(dialogs, show_if_not_showing);
+ } else if (!hippo_connection_get_connected(connection)) {
+ dialogs_update_status(dialogs, show_if_not_showing);
+ } else {
+ dialogs_destroy(dialogs);
+ }
+}
+
+static void
+dialogs_destroy(Dialogs *dialogs)
+{
+ if (dialogs->login_dialog) {
+ g_object_run_dispose(G_OBJECT(dialogs->login_dialog));
+ dialogs->login_dialog = NULL;
+ }
+
+ if (dialogs->connection_status_dialog) {
+ g_object_run_dispose(G_OBJECT(dialogs->connection_status_dialog));
+ dialogs->connection_status_dialog = NULL;
+ }
+}
+
+static void
+login_response_cb(GtkDialog *dialog,
+ int response_id,
+ void *data)
+{
+ Dialogs *dialogs = data;
+
+ if (response_id == GTK_RESPONSE_ACCEPT) {
+ hippo_connection_open_maybe_relative_url(dialogs->connection,
+ "/who-are-you");
+
+ /* Though we don't expect this to succeed immediately (the
+ * user has not yet had the chance to login) calling this
+ * here has the side-effect of putting us into the mode where
+ * we check for a new auth token every 5 seconds for a
+ * few minutes.
+ */
+ hippo_connection_signin(dialogs->connection);
+ }
+ g_object_run_dispose(G_OBJECT(dialog));
+}
+
+
+static void
+dialogs_update_login(Dialogs *dialogs,
+ gboolean show_if_not_showing)
+{
+ if (dialogs->login_dialog == NULL && show_if_not_showing) {
+ dialogs_destroy(dialogs); /* Kill any other dialogs */
+
+ dialogs->login_dialog = gtk_message_dialog_new(NULL, 0,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("You need to log in to mugshot.org"));
+
+ gtk_window_set_title(GTK_WINDOW(dialogs->login_dialog), _("Mugshot Login"));
+
+ gtk_dialog_add_buttons(GTK_DIALOG(dialogs->login_dialog),
+ _("Cancel"), GTK_RESPONSE_REJECT,
+ _("Open Login Page"), GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_dialog_set_default_response(GTK_DIALOG(dialogs->login_dialog), GTK_RESPONSE_ACCEPT);
+
+ g_signal_connect(G_OBJECT(dialogs->login_dialog), "response",
+ G_CALLBACK(login_response_cb), dialogs);
+
+ g_signal_connect(G_OBJECT(dialogs->login_dialog), "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &dialogs->login_dialog);
+ }
+
+ if (dialogs->login_dialog)
+ gtk_window_present(GTK_WINDOW(dialogs->login_dialog));
+}
+
+
+/* the not-logged-in states shouldn't display here, since we should show the
+ * login dialog in that case instead
+ */
+static const char*
+get_status_message(HippoConnection *connection)
+{
+ const char *msg;
+
+ msg = NULL;
+
+ if (hippo_connection_get_need_login(connection))
+ return _("Mugshot is not connected - please log in to mugshot.org");
+
+ switch (hippo_connection_get_state(connection)) {
+ case HIPPO_STATE_SIGNED_OUT:
+ case HIPPO_STATE_RETRYING:
+ msg = _("Mugshot is not connected, but will try reconnecting soon");
+ break;
+ case HIPPO_STATE_SIGN_IN_WAIT:
+ case HIPPO_STATE_AUTH_WAIT:
+ msg = _("Mugshot is not connected - please log in to mugshot.org");
+ break;
+ case HIPPO_STATE_CONNECTING:
+ case HIPPO_STATE_REDIRECTING:
+ case HIPPO_STATE_AUTHENTICATING:
+ msg = _("Mugshot is trying to connect to mugshot.org");
+ break;
+ case HIPPO_STATE_AWAITING_CLIENT_INFO:
+ msg = _("Mugshot is checking for new versions");
+ break;
+ case HIPPO_STATE_AUTHENTICATED:
+ msg = _("Mugshot is connected!");
+ break;
+ }
+
+ return msg;
+}
+
+static void
+set_state_text(Dialogs *dialogs)
+{
+ if (dialogs->connection_status_dialog) {
+ g_object_set(G_OBJECT(dialogs->connection_status_dialog),
+ "text", get_status_message(dialogs->connection),
+ NULL);
+ }
+}
+
+static void
+status_response_cb(GtkDialog *dialog,
+ int response_id,
+ void *data)
+{
+ g_object_run_dispose(G_OBJECT(dialog));
+}
+
+static void
+dialogs_update_status(Dialogs *dialogs,
+ gboolean show_if_not_showing)
+{
+ if (dialogs->connection_status_dialog == NULL && show_if_not_showing) {
+ dialogs_destroy(dialogs); /* Kill any other dialogs */
+
+ dialogs->connection_status_dialog = gtk_message_dialog_new(NULL, 0,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "%s", get_status_message(dialogs->connection));
+
+ gtk_window_set_title(GTK_WINDOW(dialogs->connection_status_dialog), _("Mugshot Status"));
+
+ g_signal_connect(G_OBJECT(dialogs->connection_status_dialog), "response",
+ G_CALLBACK(status_response_cb), dialogs);
+
+ g_signal_connect(G_OBJECT(dialogs->connection_status_dialog), "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &dialogs->connection_status_dialog);
+ } else {
+ set_state_text(dialogs);
+ }
+
+ if (dialogs->connection_status_dialog)
+ gtk_window_present(GTK_WINDOW(dialogs->connection_status_dialog));
+}
Copied: dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.h (from rev 7178, dumbhippo/trunk/client/linux/src/hippo-platform-impl.h)
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-platform-impl.h 2008-01-10 18:46:33 UTC (rev 7178)
+++ dumbhippo/trunk/client/linux/src/hippo-stacker-platform-impl.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -0,0 +1,26 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#ifndef __HIPPO_STACKER_PLATFORM_IMPL_H__
+#define __HIPPO_STACKER_PLATFORM_IMPL_H__
+
+#include <hippo/hippo-common.h>
+#include <hippo/hippo-stacker-platform.h>
+
+G_BEGIN_DECLS
+
+typedef struct _HippoStackerPlatformImpl HippoStackerPlatformImpl;
+typedef struct _HippoStackerPlatformImplClass HippoStackerPlatformImplClass;
+
+#define HIPPO_TYPE_STACKER_PLATFORM_IMPL (hippo_stacker_platform_impl_get_type ())
+#define HIPPO_STACKER_PLATFORM_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_STACKER_PLATFORM_IMPL, HippoStackerPlatformImpl))
+#define HIPPO_STACKER_PLATFORM_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HIPPO_TYPE_STACKER_PLATFORM_IMPL, HippoStackerPlatformImplClass))
+#define HIPPO_IS_STACKER_PLATFORM_IMPL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HIPPO_TYPE_STACKER_PLATFORM_IMPL))
+#define HIPPO_IS_STACKER_PLATFORM_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_STACKER_PLATFORM_IMPL))
+#define HIPPO_STACKER_PLATFORM_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HIPPO_TYPE_STACKER_PLATFORM_IMPL, HippoStackerPlatformImplClass))
+
+GType hippo_stacker_platform_impl_get_type (void) G_GNUC_CONST;
+
+HippoStackerPlatform* hippo_stacker_platform_impl_new (void);
+
+G_END_DECLS
+
+#endif /* __HIPPO_STACKER_PLATFORM_IMPL_H__ */
Modified: dumbhippo/trunk/client/linux/src/hippo-status-icon.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-status-icon.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/hippo-status-icon.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -123,9 +123,8 @@
connection = hippo_data_cache_get_connection(icon->cache);
if (!hippo_connection_get_connected(connection)) {
- HippoPlatform *platform;
- platform = hippo_connection_get_platform(connection);
- hippo_platform_show_disconnected_window(platform, connection);
+ HippoStackerPlatform *platform = hippo_app_get_stacker_platform(hippo_get_app());
+ hippo_stacker_platform_show_disconnected_window(platform, connection);
} else {
/* the UI has to exist since we (the tray icon) are part of it */
HippoStackManager *stack_manager = hippo_app_get_stack(hippo_get_app());
Modified: dumbhippo/trunk/client/linux/src/hippo-ui.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-ui.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/hippo-ui.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -6,6 +6,7 @@
#include <hippo/hippo-stack-manager.h>
#include "hippo-status-icon.h"
#include "hippo-embedded-image.h"
+#include "hippo-stacker-platform-impl.h"
#include <string.h>
#include <hippo/hippo-canvas.h>
#include <gdk/gdkx.h>
@@ -13,6 +14,7 @@
struct HippoUI {
HippoPlatform *platform;
+ HippoStackerPlatform *stacker_platform;
HippoDataCache *cache;
HippoConnection *connection;
HippoDBus *dbus;
@@ -663,11 +665,12 @@
ui->connection = hippo_data_cache_get_connection(ui->cache);
ui->platform = hippo_connection_get_platform(ui->connection);
+ ui->stacker_platform = hippo_stacker_platform_impl_new();
ui->dbus = dbus;
g_object_ref(ui->dbus);
- ui->stack = hippo_stack_manager_new(ui->cache);
+ ui->stack = hippo_stack_manager_new(hippo_data_cache_get_model(cache), ui->stacker_platform);
ui->icon = hippo_status_icon_new(ui->cache);
@@ -717,3 +720,10 @@
{
return ui->stack;
}
+
+HippoStackerPlatform *
+hippo_ui_get_stacker_platform (HippoUI *ui)
+{
+ return ui->stacker_platform;
+}
+
Modified: dumbhippo/trunk/client/linux/src/hippo-ui.h
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-ui.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/hippo-ui.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -29,8 +29,10 @@
const char *chat_id);
HippoWindowState hippo_ui_get_chat_state (HippoUI *ui,
const char *chat_id);
-HippoStackManager* hippo_ui_get_stack_manager (HippoUI *ui);
+HippoStackManager* hippo_ui_get_stack_manager (HippoUI *ui);
+HippoStackerPlatform *hippo_ui_get_stacker_platform (HippoUI *ui);
+
G_END_DECLS
#endif /* __HIPPO_UI_H__ */
Modified: dumbhippo/trunk/client/linux/src/main.c
===================================================================
--- dumbhippo/trunk/client/linux/src/main.c 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/main.c 2008-01-11 23:13:58 UTC (rev 7192)
@@ -68,6 +68,12 @@
return app->cache;
}
+HippoStackerPlatform *
+hippo_app_get_stacker_platform (HippoApp *app)
+{
+ return hippo_ui_get_stacker_platform(app->ui);
+}
+
HippoDBus*
hippo_app_get_dbus (HippoApp *app)
{
Modified: dumbhippo/trunk/client/linux/src/main.h
===================================================================
--- dumbhippo/trunk/client/linux/src/main.h 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/linux/src/main.h 2008-01-11 23:13:58 UTC (rev 7192)
@@ -4,6 +4,7 @@
#include <config.h>
#include <hippo/hippo-common.h>
+#include <hippo/hippo-stacker-platform.h>
/* avoiding gtk/gtk.h because of the internal gtk/ copy stuff,
* this plays it safer. maybe it speeds up compilation a tiny
@@ -36,6 +37,7 @@
HippoDataCache *hippo_app_get_data_cache (HippoApp *app);
HippoDBus *hippo_app_get_dbus (HippoApp *app);
DDMDataModel *hippo_app_get_data_model (HippoApp *app);
+HippoStackerPlatform *hippo_app_get_stacker_platform (HippoApp *app);
void hippo_app_set_show_stacker (HippoApp *app,
gboolean value);
Modified: dumbhippo/trunk/client/windows/HippoUI/HippoPlatformImpl.cpp
===================================================================
--- dumbhippo/trunk/client/windows/HippoUI/HippoPlatformImpl.cpp 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/windows/HippoUI/HippoPlatformImpl.cpp 2008-01-11 23:13:58 UTC (rev 7192)
@@ -11,10 +11,12 @@
#include <Windows.h>
#include <mshtml.h>
#include <hippo/hippo-basics.h>
+#include <hippo/hippo-stacker-impl.h>
static void hippo_platform_impl_init (HippoPlatformImpl *impl);
static void hippo_platform_impl_class_init (HippoPlatformImplClass *klass);
static void hippo_platform_impl_iface_init (HippoPlatformClass *klass);
+static void hippo_platform_impl_stacker_iface_init (HippoStackerPlatformClass *klass);
static void hippo_platform_impl_finalize (GObject *object);
@@ -78,23 +80,17 @@
};
G_DEFINE_TYPE_WITH_CODE(HippoPlatformImpl, hippo_platform_impl, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(HIPPO_TYPE_PLATFORM, hippo_platform_impl_iface_init));
+ G_IMPLEMENT_INTERFACE(HIPPO_TYPE_PLATFORM, hippo_platform_impl_iface_init);
+ G_IMPLEMENT_INTERFACE(HIPPO_TYPE_STACKER_PLATFORM, hippo_stacker_platform_impl_iface_init));
static void
hippo_platform_impl_iface_init(HippoPlatformClass *klass)
{
klass->get_platform_info = hippo_platform_impl_get_platform_info;
- klass->create_window = hippo_platform_impl_create_window;
- klass->get_screen_info = hippo_platform_impl_get_screen_info;
- klass->get_pointer_position = hippo_platform_impl_get_pointer_position;
klass->read_login_cookie = hippo_platform_impl_read_login_cookie;
klass->delete_login_cookie = hippo_platform_impl_delete_login_cookie;
klass->get_jabber_resource = hippo_platform_impl_get_jabber_resource;
klass->open_url = hippo_platform_impl_open_url;
- klass->http_request = hippo_platform_impl_http_request;
- klass->show_chat_window = hippo_platform_impl_show_chat_window;
- klass->get_chat_window_state = hippo_platform_impl_get_chat_window_state;
- klass->can_play_song_download = hippo_platform_impl_can_play_song_download;
klass->get_instance_type = hippo_platform_impl_get_instance_type;
klass->get_message_server = hippo_platform_impl_get_message_server;
klass->get_web_server = hippo_platform_impl_get_web_server;
@@ -105,6 +101,18 @@
}
static void
+hippo_platform_impl_stacker_iface_init(HippoStackerPlatformClass *klass)
+{
+ klass->create_window = hippo_platform_impl_create_window;
+ klass->get_screen_info = hippo_platform_impl_get_screen_info;
+ klass->get_pointer_position = hippo_platform_impl_get_pointer_position;
+ klass->http_request = hippo_platform_impl_http_request;
+ klass->show_chat_window = hippo_platform_impl_show_chat_window;
+ klass->get_chat_window_state = hippo_platform_impl_get_chat_window_state;
+ klass->can_play_song_download = hippo_platform_impl_can_play_song_download;
+}
+
+static void
hippo_platform_impl_init(HippoPlatformImpl *impl)
{
Modified: dumbhippo/trunk/client/windows/HippoUI/HippoUI.cpp
===================================================================
--- dumbhippo/trunk/client/windows/HippoUI/HippoUI.cpp 2008-01-11 16:44:29 UTC (rev 7191)
+++ dumbhippo/trunk/client/windows/HippoUI/HippoUI.cpp 2008-01-11 23:13:58 UTC (rev 7192)
@@ -509,11 +509,11 @@
#if 1
// and very last once we're all ready, fire up the stacker
- stack_ = hippo_stack_manager_new(dataCache_);
+ stack_ = hippo_stack_manager_new(hippo_data_cache_get_model(dataCache_), platform_);
#endif
#if 0
- HippoWindow *window = hippo_platform_create_window(platform_);
+ HippoWindow *window = hippo_platform_create_window(HIPPO_STACKER_PLATFORM(platform_));
hippo_window_set_resizable(window, HIPPO_ORIENTATION_HORIZONTAL, TRUE);
hippo_window_set_resizable(window, HIPPO_ORIENTATION_VERTICAL, TRUE);
HippoCanvasItem *root = hippo_canvas_test_get_root();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]