r7190 - in dumbhippo/trunk/client: common/ddm common/hippo linux/src windows/HippoUI
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7190 - in dumbhippo/trunk/client: common/ddm common/hippo linux/src windows/HippoUI
- Date: Fri, 11 Jan 2008 10:32:22 -0600 (CST)
Author: otaylor
Date: 2008-01-11 10:32:20 -0600 (Fri, 11 Jan 2008)
New Revision: 7190
Modified:
dumbhippo/trunk/client/common/ddm/ddm-data-model.c
dumbhippo/trunk/client/common/ddm/ddm-data-model.h
dumbhippo/trunk/client/common/ddm/ddm-data-query.c
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-connection.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-track.c
dumbhippo/trunk/client/linux/src/hippo-dbus-server.c
dumbhippo/trunk/client/windows/HippoUI/HippoListenerProxy.cpp
Log:
ddm-data-model.[ch] hippo-connection.[ch] HippoListenerProxy.cpp hippo-dbus-server.c:
Move tracking of server time offset to the data model.
hippo-quip-window.[ch] hippo-actions.[ch] hippo-stack-manager.c: Remove remaining
HippoDataCache / HippoConnection dependencies from HippoActions and HippoQuipWindow.
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-model.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-model.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-model.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -41,6 +41,8 @@
gint64 next_query_serial;
gint64 max_answered_query_serial;
+ gint64 server_time_offset;
+
guint flush_idle;
guint ready : 1;
@@ -1038,3 +1040,26 @@
{
return model->self_resource;
}
+
+static gint64
+current_time_ms(void)
+{
+ GTimeVal now;
+
+ g_get_current_time(&now);
+ return (gint64)now.tv_sec * 1000 + now.tv_usec / 1000;
+}
+
+void
+ddm_data_model_update_server_time_offset(DDMDataModel *model,
+ gint64 server_time)
+{
+ model->server_time_offset = server_time - current_time_ms();
+}
+
+gint64
+ddm_data_model_get_server_time_offset(DDMDataModel *model)
+{
+ return model->server_time_offset;
+}
+
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-model.h
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-model.h 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-model.h 2008-01-11 16:32:20 UTC (rev 7190)
@@ -116,6 +116,20 @@
void ddm_data_model_set_self_resource (DDMDataModel *model,
DDMDataResource *self_resource);
+/* Tracking the server side offset in the data model is a little
+ * conceptually questionable since if we supported getting data from
+ * multiple servers, we might have a different time offset from each
+ * one. However, time offsets should be higly consistent assuming that
+ * the servers are all using NNTP or similar; in fact, if the local
+ * client is using NNTP, zero is a better estimate for the local time
+ * offset than anything we can do ourself. We track it ourself
+ * because the local client might have a screwed up time and if things
+ * start happening in the future it looks really weird.
+ */
+void ddm_data_model_update_server_time_offset (DDMDataModel *model,
+ gint64 server_time);
+gint64 ddm_data_model_get_server_time_offset (DDMDataModel *model);
+
G_END_DECLS
#endif /* __DDM_DATA_MODEL_H__ */
Modified: dumbhippo/trunk/client/common/ddm/ddm-data-query.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-query.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-query.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -285,14 +285,51 @@
data_query_response_internal(query, results, TRUE);
}
+static void
+params_to_string_foreach(gpointer k,
+ gpointer v,
+ gpointer data)
+{
+ const char *name = k;
+ const char *value = v;
+ GString *result = data;
+
+ if (result->len > 0)
+ g_string_append(result, ", ");
+
+ g_string_append_printf(result, "%s='%s'", name, value);
+}
+
+static char *
+params_to_string(GHashTable *params)
+{
+ GString *result = g_string_new(NULL);
+
+ g_hash_table_foreach(params, params_to_string_foreach, result);
+
+ return g_string_free(result, FALSE);
+}
+
void
_ddm_data_query_run_response (DDMDataQuery *query)
{
g_return_if_fail(query != NULL);
if (query->error_message) {
- if (query->error_handler)
+ if (query->error_handler) {
query->error_handler(query->error, query->error_message, query->error_handler_data);
+ } else {
+ char *method = ddm_qname_to_uri(query->qname);
+ char *params = params_to_string(query->params);
+
+ g_warning("%s %s(%s) failed: %s",
+ query->is_update ? "Update" : "Query",
+ method, params,
+ query->error_message);
+
+ g_free(method);
+ g_free(params);
+ }
ddm_data_query_free(query);
Modified: dumbhippo/trunk/client/common/hippo/hippo-actions.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-actions.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-actions.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -15,7 +15,8 @@
struct _HippoActions {
GObject parent;
- HippoDataCache *cache;
+ DDMDataModel *model;
+ HippoPlatform *platform;
HippoStackManager *stack_manager;
/* We have an image cache for each kind of
@@ -93,11 +94,18 @@
actions->minute_timeout_id = 0;
}
- if (actions->cache) {
- g_object_unref(actions->cache);
- actions->cache = NULL;
+ if (actions->model) {
+ g_object_unref(actions->model);
+ actions->model = NULL;
}
+ if (actions->platform) {
+ g_object_unref(actions->platform);
+ actions->platform = NULL;
+ }
+
+ actions->stack_manager = NULL;
+
if (actions->entity_photo_cache) {
g_object_run_dispose(G_OBJECT(actions->entity_photo_cache));
g_object_unref(actions->entity_photo_cache);
@@ -122,8 +130,6 @@
actions->music_thumbnail_cache = NULL;
}
- actions->stack_manager = NULL;
-
G_OBJECT_CLASS(hippo_actions_parent_class)->dispose(object);
}
@@ -136,7 +142,8 @@
}
HippoActions*
-hippo_actions_new(HippoDataCache *cache,
+hippo_actions_new(DDMDataModel *model,
+ HippoPlatform *platform,
HippoStackManager *stack_manager)
{
HippoActions *actions;
@@ -144,30 +151,13 @@
actions = g_object_new(HIPPO_TYPE_ACTIONS,
NULL);
- actions->cache = g_object_ref(cache);
+ actions->model = g_object_ref(model);
+ actions->platform = g_object_ref(platform);
actions->stack_manager = stack_manager;
return actions;
}
-static HippoConnection*
-get_connection(HippoActions *actions)
-{
- return hippo_data_cache_get_connection(actions->cache);
-}
-
-static DDMDataModel*
-get_model(HippoActions *actions)
-{
- return hippo_data_cache_get_model(actions->cache);
-}
-
-static HippoPlatform*
-get_platform(HippoActions *actions)
-{
- return hippo_connection_get_platform(get_connection(actions));
-}
-
void
hippo_actions_visit_post(HippoActions *actions,
HippoPost *post)
@@ -229,7 +219,7 @@
HippoCanvasItem *image_item)
{
if (actions->favicon_cache == NULL) {
- actions->favicon_cache = hippo_image_cache_new(get_platform(actions));
+ actions->favicon_cache = hippo_image_cache_new(actions->platform);
}
/* hippo_object_cache_debug_dump(HIPPO_OBJECT_CACHE(actions->favicon_cache)); */
@@ -243,7 +233,7 @@
HippoCanvasItem *image_item)
{
if (actions->thumbnail_cache == NULL) {
- actions->thumbnail_cache = hippo_image_cache_new(get_platform(actions));
+ actions->thumbnail_cache = hippo_image_cache_new(actions->platform);
}
/* hippo_object_cache_debug_dump(HIPPO_OBJECT_CACHE(actions->thumbnail_cache)); */
@@ -257,7 +247,7 @@
HippoCanvasItem *image_item)
{
if (actions->music_thumbnail_cache == NULL) {
- actions->music_thumbnail_cache = hippo_image_cache_new(get_platform(actions));
+ actions->music_thumbnail_cache = hippo_image_cache_new(actions->platform);
}
/* hippo_object_cache_debug_dump(HIPPO_OBJECT_CACHE(actions->music_thumbnail_cache)); */
@@ -288,7 +278,7 @@
sized = hippo_size_photo_url(url, size);
if (actions->entity_photo_cache == NULL) {
- actions->entity_photo_cache = hippo_image_cache_new(get_platform(actions));
+ actions->entity_photo_cache = hippo_image_cache_new(actions->platform);
}
/* hippo_object_cache_debug_dump(HIPPO_OBJECT_CACHE(actions->entity_photo_cache)); */
@@ -301,7 +291,7 @@
gint64
hippo_actions_get_server_time_offset (HippoActions *actions)
{
- return hippo_connection_get_server_time_offset(get_connection(actions));
+ return ddm_data_model_get_server_time_offset(actions->model);
}
void
@@ -350,7 +340,7 @@
void
hippo_actions_open_home_page(HippoActions *actions)
{
- DDMDataResource *self = ddm_data_model_get_self_resource(get_model(actions));
+ DDMDataResource *self = ddm_data_model_get_self_resource(actions->model);
const char *home_url;
ddm_data_resource_get(self,
@@ -361,50 +351,26 @@
hippo_actions_open_url(actions, home_url);
}
-static void
-on_open_url_error(DDMDataError error,
- const char *message,
- gpointer data)
-{
- g_warning("Failed to open URL in browser: %s", message);
-}
-
void
hippo_actions_open_url(HippoActions *actions,
const char *url)
{
- DDMDataQuery *query;
-
- query = ddm_data_model_update(get_model(actions),
- "online-desktop:/p/system#openUrl",
- "url", url,
- NULL);
-
- ddm_data_query_set_error_handler(query, on_open_url_error, actions);
+ ddm_data_model_update(actions->model,
+ "online-desktop:/p/system#openUrl",
+ "url", url,
+ NULL);
}
static void
-on_set_block_hushed_error(DDMDataError error,
- const char *message,
- gpointer data)
-{
- g_warning("Failed to set block hush state: %s", message);
-}
-
-static void
set_block_hushed(HippoActions *actions,
HippoBlock *block,
gboolean hushed)
{
- DDMDataQuery *query;
-
- query = ddm_data_model_update(get_model(actions),
- "http://mugshot.org/p/blocks#setBlockHushed",
- "blockId", hippo_block_get_guid(block),
- "hushed", hushed ? "true" : "false",
- NULL);
-
- ddm_data_query_set_error_handler(query, on_set_block_hushed_error, actions);
+ ddm_data_model_update(actions->model,
+ "http://mugshot.org/p/blocks#setBlockHushed",
+ "blockId", hippo_block_get_guid(block),
+ "hushed", hushed ? "true" : "false",
+ NULL);
}
void
@@ -432,38 +398,26 @@
hippo_actions_join_chat_id(HippoActions *actions,
const char *chat_id)
{
- hippo_platform_show_chat_window(get_platform(actions), chat_id);
+ hippo_platform_show_chat_window(actions->platform, chat_id);
}
-static void
-on_invite_user_error(DDMDataError error,
- const char *message,
- gpointer data)
-{
- g_warning("Failed to invite user to group: %s", message);
-}
-
void
hippo_actions_invite_to_group(HippoActions *actions,
HippoGroup *group,
HippoPerson *person)
{
- DDMDataQuery *query;
-
- query = ddm_data_model_update(get_model(actions),
- "http://mugshot.org/p/blocks#accountQuestionResponse",
- "groupId", hippo_entity_get_guid(HIPPO_ENTITY(group)),
- "userId", hippo_entity_get_guid(HIPPO_ENTITY(person)),
- NULL);
-
- ddm_data_query_set_error_handler(query, on_invite_user_error, actions);
+ ddm_data_model_update(actions->model,
+ "http://mugshot.org/p/groups#inviteUser",
+ "groupId", hippo_entity_get_guid(HIPPO_ENTITY(group)),
+ "userId", hippo_entity_get_guid(HIPPO_ENTITY(person)),
+ NULL);
}
gboolean
hippo_actions_can_play_song_download(HippoActions *actions,
HippoSongDownload *song_download)
{
- return hippo_platform_can_play_song_download(get_platform(actions), song_download);
+ return hippo_platform_can_play_song_download(actions->platform, song_download);
}
void
@@ -473,7 +427,7 @@
HippoSentiment sentiment,
const char *title)
{
- HippoQuipWindow *quip_window = hippo_quip_window_new(actions->cache);
+ HippoQuipWindow *quip_window = hippo_quip_window_new(actions->model, actions->platform);
hippo_quip_window_set_chat(quip_window, kind, id);
hippo_quip_window_set_sentiment(quip_window, sentiment);
@@ -483,26 +437,14 @@
g_object_unref(quip_window);
}
-static void
-on_account_question_response_error(DDMDataError error,
- const char *message,
- gpointer data)
-{
- g_warning("Failed to set account question response: %s", message);
-}
-
void
hippo_actions_send_account_question_response(HippoActions *actions,
const char *block_id,
const char *response)
{
- DDMDataQuery *query;
-
- query = ddm_data_model_update(get_model(actions),
- "http://mugshot.org/p/blocks#accountQuestionResponse",
- "blockId", block_id,
- "response", response,
- NULL);
-
- ddm_data_query_set_error_handler(query, on_account_question_response_error, actions);
+ ddm_data_model_update(actions->model,
+ "http://mugshot.org/p/blocks#accountQuestionResponse",
+ "blockId", block_id,
+ "response", response,
+ NULL);
}
Modified: dumbhippo/trunk/client/common/hippo/hippo-actions.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-actions.h 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-actions.h 2008-01-11 16:32:20 UTC (rev 7190)
@@ -42,8 +42,10 @@
GType hippo_actions_get_type (void) G_GNUC_CONST;
-HippoActions* hippo_actions_new (HippoDataCache *cache,
- HippoStackManager *stack_manager);
+HippoActions* hippo_actions_new (DDMDataModel *model,
+ HippoPlatform *platform,
+ HippoStackManager *stack_manager);
+
void hippo_actions_visit_post (HippoActions *actions,
HippoPost *post);
void hippo_actions_visit_entity (HippoActions *actions,
Modified: dumbhippo/trunk/client/common/hippo/hippo-connection.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-connection.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-connection.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -73,10 +73,11 @@
LmMessageNode *node);
static void dm_context_pop_node (DMContext *context);
-static DDMDataResource *update_resource (DMContext *context,
- DDMNotificationSet *broadcast_notifications,
- DDMNotificationSet *save_notifications,
- gboolean mark_received);
+static DDMDataResource *update_resource (DMContext *context,
+ DDMNotificationSet *broadcast_notifications,
+ DDMNotificationSet *save_notifications,
+ gboolean mark_received);
+static void update_server_time_offset (DMContext *context);
static void
message_context_ref(MessageContext *context)
@@ -1794,21 +1795,6 @@
lm_message_unref(message);
}
-gint64
-hippo_connection_get_server_time_offset(HippoConnection *connection)
-{
- return connection->server_time_offset;
-}
-
-#if 0
-static void
-hippo_connection_update_server_time_offset(HippoConnection *connection,
- gint64 server_time)
-{
- connection->server_time_offset = server_time - hippo_current_time_ms();
-}
-#endif
-
static void
send_room_presence(HippoConnection *connection,
HippoChatRoom *room,
@@ -2260,6 +2246,7 @@
return;
dm_context_push_node(context, resources_node);
+ update_server_time_offset(context);
for (resource_node = resources_node->children; resource_node; resource_node = resource_node->next) {
dm_context_push_node(context, resource_node);
@@ -3178,6 +3165,32 @@
return NULL;
}
+static gboolean
+dm_context_get_system_attribute_int64(DMContext *context,
+ const char *name,
+ gint64 *result)
+{
+ const char *value = dm_context_get_system_attribute(context, name);
+ if (value == NULL) {
+ return FALSE;
+ } else {
+ char *str_stripped;
+ char *end;
+
+ str_stripped = g_strdup(value);
+ g_strstrip(str_stripped);
+
+ *result = g_ascii_strtoll(str_stripped, &end, 10);
+ if (*str_stripped == '\0' || *end != '\0') {
+ g_warning("Invalid m:%s attribute '%s'", name, value);
+ return FALSE;
+ }
+
+ g_free(str_stripped);
+ return TRUE;
+ }
+}
+
static void
dm_context_push_node(DMContext *context,
LmMessageNode *node)
@@ -3329,26 +3342,11 @@
static gint64
dm_context_get_ts(DMContext *context)
{
- const char *ts_attr = dm_context_get_system_attribute(context, "ts");
- if (ts_attr == NULL) {
- return -1;
- } else {
- char *str_stripped;
- char *end;
- gint64 result;
-
- str_stripped = g_strdup(ts_attr);
- g_strstrip(str_stripped);
-
- result = g_ascii_strtoll(str_stripped, &end, 10);
- if (*str_stripped == '\0' || *end != '\0') {
- g_warning("Invalid m:ts attribute '%s'", ts_attr);
- result = -1;
- }
+ gint64 ts = -1;
+
+ dm_context_get_system_attribute_int64(context, "ts", &ts);
- g_free(str_stripped);
- return result;
- }
+ return ts;
}
static gboolean
@@ -3484,6 +3482,16 @@
}
}
+static void
+update_server_time_offset(DMContext *context)
+{
+ gint64 server_time = -1;
+
+ if (dm_context_get_system_attribute_int64(context, "serverTime", &server_time)) {
+ ddm_data_model_update_server_time_offset(context->model, server_time);
+ }
+}
+
static DDMDataResource *
update_resource(DMContext *context,
DDMNotificationSet *broadcast_notifications,
@@ -3607,6 +3615,8 @@
error_code = DDM_DATA_ERROR_BAD_REPLY;
goto pop_child;
}
+
+ update_server_time_offset(&context);
notifications = ddm_notification_set_new(context.model);
@@ -3748,6 +3758,8 @@
found = TRUE;
+ update_server_time_offset(&context);
+
broadcast_notifications = ddm_notification_set_new(context.model);
save_notifications = ddm_notification_set_new(context.model);
Modified: dumbhippo/trunk/client/common/hippo/hippo-connection.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-connection.h 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-connection.h 2008-01-11 16:32:20 UTC (rev 7190)
@@ -95,13 +95,6 @@
const char *text,
HippoSentiment sentiment);
-/* Like send_chat_room_message, but without a chat room */
-void hippo_connection_send_quip (HippoConnection *connection,
- HippoChatKind kind,
- const char *id,
- const char *text,
- HippoSentiment sentiment);
-
void hippo_connection_request_prefs (HippoConnection *connection);
void hippo_connection_request_title_patterns (HippoConnection *connection);
@@ -119,9 +112,6 @@
void hippo_connection_send_query (HippoConnection *connection,
DDMDataQuery *query);
-/* Gets the number of milliseconds to add to the local time to get the server time */
-gint64 hippo_connection_get_server_time_offset (HippoConnection *connection);
-
const char* hippo_connection_get_tooltip (HippoConnection *connection);
/* return string form of enum values */
Modified: dumbhippo/trunk/client/common/hippo/hippo-quip-window.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-quip-window.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-quip-window.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -19,7 +19,8 @@
struct _HippoQuipWindow {
GObject parent;
- HippoDataCache *cache;
+ DDMDataModel *model;
+ HippoPlatform *platform;
HippoChatKind chat_kind;
char *chat_id;
@@ -82,13 +83,19 @@
quip_window->window = NULL;
}
+ g_object_unref(quip_window->model);
+ quip_window->model = NULL;
+
+ g_object_unref(quip_window->platform);
+ quip_window->platform = NULL;
+
G_OBJECT_CLASS(hippo_quip_window_parent_class)->dispose(object);
}
static void
hippo_quip_window_finalize(GObject *object)
{
- HippoQuipWindow *quip_window = HIPPO_QUIP_WINDOW(object);
+ HippoQuipWindow *quip_window = HIPPO_QUIP_WINDOW(object);
g_free(quip_window->title);
quip_window->title = NULL;
@@ -96,18 +103,6 @@
G_OBJECT_CLASS(hippo_quip_window_parent_class)->finalize(object);
}
-static HippoConnection*
-get_connection(HippoQuipWindow *quip_window)
-{
- return hippo_data_cache_get_connection(quip_window->cache);
-}
-
-static HippoPlatform*
-get_platform(HippoQuipWindow *quip_window)
-{
- return hippo_connection_get_platform(get_connection(quip_window));
-}
-
static void
on_indifferent_activated(HippoCanvasItem *item,
HippoQuipWindow *quip_window)
@@ -147,12 +142,17 @@
}
#endif
+ const char *sentiment_str = hippo_sentiment_as_string(quip_window->sentiment);
char *text = NULL;
g_object_get(G_OBJECT(quip_window->entry), "text", &text, NULL);
- hippo_connection_send_quip(get_connection(quip_window),
- quip_window->chat_kind, quip_window->chat_id,
- text, quip_window->sentiment);
+ ddm_data_model_update(quip_window->model,
+ "http://mugshot.org/p/chatMessages#addMessage",
+ "chatId", quip_window->chat_id,
+ "text", text,
+ "sentiment", sentiment_str,
+ NULL);
+
g_free(text);
hippo_quip_window_hide(quip_window);
@@ -250,7 +250,8 @@
}
HippoQuipWindow*
-hippo_quip_window_new(HippoDataCache *cache)
+hippo_quip_window_new(DDMDataModel *model,
+ HippoPlatform *platform)
{
HippoQuipWindow *quip_window;
HippoCanvasBox *outer_box;
@@ -260,15 +261,16 @@
HippoCanvasBox *box;
HippoCanvasItem *item;
- g_return_val_if_fail(HIPPO_IS_DATA_CACHE(cache), NULL);
+ g_return_val_if_fail(DDM_IS_DATA_MODEL(model), NULL);
+ g_return_val_if_fail(HIPPO_IS_PLATFORM(platform), NULL);
quip_window = g_object_new(HIPPO_TYPE_QUIP_WINDOW,
NULL);
- g_object_ref(cache);
- quip_window->cache = cache;
+ quip_window->model = g_object_ref(model);
+ quip_window->platform = g_object_ref(platform);
- quip_window->window = hippo_platform_create_window(get_platform(quip_window));
+ quip_window->window = hippo_platform_create_window(quip_window->platform);
g_signal_connect(quip_window->window, "notify::active",
G_CALLBACK(on_notify_active), quip_window);
@@ -470,9 +472,9 @@
quip_window->visible = TRUE;
g_object_ref(quip_window);
- hippo_platform_get_screen_info(get_platform(quip_window), &monitor_rect, NULL, NULL);
+ hippo_platform_get_screen_info(quip_window->platform, &monitor_rect, NULL, NULL);
- if (!hippo_platform_get_pointer_position(get_platform(quip_window), &pointer_x, &pointer_y)) {
+ if (!hippo_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:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-quip-window.h 2008-01-11 16:32:20 UTC (rev 7190)
@@ -18,7 +18,8 @@
GType hippo_quip_window_get_type (void) G_GNUC_CONST;
-HippoQuipWindow* hippo_quip_window_new (HippoDataCache *data_cache);
+HippoQuipWindow* hippo_quip_window_new (DDMDataModel *model,
+ HippoPlatform *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:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-stack-manager.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -983,21 +983,14 @@
manager = g_new0(StackManager, 1);
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));
- /* FIXME really the "actions" should probably be more global, e.g.
- * shared with the tray icon, but the way I wanted to do that
- * is to stuff it on the data cache, but that requires moving
- * hippo-actions to the common library which can't be done with
- * right this second since a bunch of eventually xp stuff is in
- * the linux dir.
- */
- manager->actions = hippo_actions_new(cache, manager);
-
connection = hippo_data_cache_get_connection(cache);
manager->platform = g_object_ref(hippo_connection_get_platform(connection));
- manager->model = g_object_ref(hippo_data_cache_get_model(cache));
-
+ manager->actions = hippo_actions_new(manager->model, manager->platform, manager);
+
manager->browser_window = hippo_platform_create_window(manager->platform);
#ifdef WITH_MAEMO
Modified: dumbhippo/trunk/client/common/hippo/hippo-track.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-track.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/common/hippo/hippo-track.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -220,6 +220,7 @@
hippo_track_new_from_xml(HippoDataCache *cache,
LmMessageNode *node)
{
+#if 0
GSList *downloads = NULL;
const char *artist;
const char *album;
@@ -311,6 +312,7 @@
track->now_playing = now_playing;
return track;
+#endif
}
const char*
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-server.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-server.c 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-server.c 2008-01-11 16:32:20 UTC (rev 7190)
@@ -690,7 +690,7 @@
DBusMessage *message;
HippoDataCache *cache = hippo_app_get_data_cache(hippo_get_app());
- HippoConnection *connection = hippo_data_cache_get_connection(cache);
+ DDMDataModel *model = hippo_data_cache_get_model(cache);
guint64 endpoint = hippo_endpoint_proxy_get_id(proxy);
const char *chat_id = hippo_chat_room_get_id(chat_room);
const char *user_id = hippo_entity_get_guid(HIPPO_ENTITY(hippo_chat_message_get_person(chat_message)));
@@ -714,7 +714,7 @@
/* Time in millseconds */
timestamp = hippo_chat_message_get_timestamp(chat_message) * 1000.;
/* Convert server time to client time, so the Javascript can format it correctly */
- timestamp -= hippo_connection_get_server_time_offset(connection);
+ timestamp -= ddm_data_model_get_server_time_offset(model);
g_debug("Sending message, %s, serial=%d", text, serial);
Modified: dumbhippo/trunk/client/windows/HippoUI/HippoListenerProxy.cpp
===================================================================
--- dumbhippo/trunk/client/windows/HippoUI/HippoListenerProxy.cpp 2008-01-11 16:28:22 UTC (rev 7189)
+++ dumbhippo/trunk/client/windows/HippoUI/HippoListenerProxy.cpp 2008-01-11 16:32:20 UTC (rev 7190)
@@ -222,8 +222,8 @@
// The Javascript code needs to get local times, not server times, in order to
// be able to do "time ago" properly
- HippoConnection *connection = hippo_data_cache_get_connection(dataCache_);
- gint64 serverTimeOffset = hippo_connection_get_server_time_offset(connection);
+ DDMDataModel *model = hippo_data_cache_get_model(dataCache_);
+ gint64 serverTimeOffset = ddm_data_model_get_server_time_offset(model);
double timestamp = hippo_chat_message_get_timestamp(message) * 1000. - serverTimeOffset;
if (listener_)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]