r7479 - in mugshot-client/trunk: common/stacker linux
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7479 - in mugshot-client/trunk: common/stacker linux
- Date: Mon, 12 May 2008 15:23:06 -0500 (CDT)
Author: otaylor
Date: 2008-05-12 15:23:06 -0500 (Mon, 12 May 2008)
New Revision: 7479
Added:
mugshot-client/trunk/common/stacker/hippo-block-group-revision.c
mugshot-client/trunk/common/stacker/hippo-block-group-revision.h
mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.c
mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.h
Modified:
mugshot-client/trunk/common/stacker/hippo-block.c
mugshot-client/trunk/common/stacker/hippo-block.h
mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.c
mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.h
mugshot-client/trunk/common/stacker/hippo-canvas-block.c
mugshot-client/trunk/linux/Makefile-libstacker.am
Log:
Add special handling for GROUP_REVISION blocks to make them match the web:
(http://bugzilla.mugshot.org/show_bug.cgi?id=1403)
- Add an "edit this group" link
- Display the group being changed on the right
- allow chatting if you can chat on the group
(Won't fully work until server repush, but shouldn't break either.)
Added: mugshot-client/trunk/common/stacker/hippo-block-group-revision.c
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-block-group-revision.c 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-block-group-revision.c 2008-05-12 20:23:06 UTC (rev 7479)
@@ -0,0 +1,244 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#include "hippo-stacker-internal.h"
+#include "hippo-block-group-revision.h"
+#include <hippo/hippo-group.h>
+#include <hippo/hippo-person.h>
+#include <string.h>
+
+static void hippo_block_group_revision_init (HippoBlockGroupRevision *block_group_revision);
+static void hippo_block_group_revision_class_init (HippoBlockGroupRevisionClass *klass);
+
+static void hippo_block_group_revision_dispose (GObject *object);
+static void hippo_block_group_revision_finalize (GObject *object);
+
+static void hippo_block_group_revision_update (HippoBlock *block);
+
+static void hippo_block_group_revision_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void hippo_block_group_revision_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+struct _HippoBlockGroupRevision {
+ HippoBlock parent;
+ HippoGroup *group;
+ char *edit_link;
+};
+
+struct _HippoBlockGroupRevisionClass {
+ HippoBlockClass parent_class;
+};
+
+#if 0
+enum {
+ LAST_SIGNAL
+};
+
+static int signals[LAST_SIGNAL];
+#endif
+
+enum {
+ PROP_0,
+ PROP_GROUP,
+ PROP_EDIT_LINK,
+};
+
+G_DEFINE_TYPE(HippoBlockGroupRevision, hippo_block_group_revision, HIPPO_TYPE_BLOCK);
+
+static void
+hippo_block_group_revision_init(HippoBlockGroupRevision *block_group_revision)
+{
+}
+
+static void
+hippo_block_group_revision_class_init(HippoBlockGroupRevisionClass *klass)
+{
+ HippoBlockClass *block_class = HIPPO_BLOCK_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = hippo_block_group_revision_set_property;
+ object_class->get_property = hippo_block_group_revision_get_property;
+
+ object_class->dispose = hippo_block_group_revision_dispose;
+ object_class->finalize = hippo_block_group_revision_finalize;
+
+ block_class->update = hippo_block_group_revision_update;
+
+ g_object_class_install_property(object_class,
+ PROP_GROUP,
+ g_param_spec_object("group",
+ _("Group"),
+ _("Group this block is about"),
+ HIPPO_TYPE_GROUP,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property(object_class,
+ PROP_EDIT_LINK,
+ g_param_spec_string("edit-link",
+ _("Edit Link"),
+ _("Link to edit the group"),
+ NULL,
+ G_PARAM_READABLE));
+}
+static void
+set_edit_link(HippoBlockGroupRevision *block_group_revision,
+ const char *edit_link)
+{
+ if (edit_link == block_group_revision->edit_link ||
+ (edit_link != NULL && block_group_revision->edit_link != NULL && strcmp(edit_link, block_group_revision->edit_link) == 0))
+ return;
+
+ g_free(block_group_revision->edit_link);
+ block_group_revision->edit_link = g_strdup(edit_link);
+
+ g_object_notify(G_OBJECT(block_group_revision), "edit-link");
+}
+
+static void
+update_edit_link(HippoBlockGroupRevision *block_group_revision)
+{
+ HippoBlock *block = HIPPO_BLOCK(block_group_revision);
+ const char *edit_link = NULL;
+
+ /* Only active members can edit */
+ if (block_group_revision->group != NULL &&
+ hippo_group_get_status(block_group_revision->group) >= HIPPO_MEMBERSHIP_STATUS_ACTIVE)
+ {
+ ddm_data_resource_get(block->resource,
+ "editLink", DDM_DATA_URL, &edit_link,
+ NULL);
+ }
+
+ set_edit_link(block_group_revision, edit_link);
+}
+
+static void
+update_chat_id(HippoBlockGroupRevision *block_group_revision)
+{
+ HippoBlock *block = HIPPO_BLOCK(block_group_revision);
+ const char *chat_id = NULL;
+
+ /* Only invited and active members can chat */
+ if (block_group_revision->group != NULL &&
+ hippo_group_get_status(block_group_revision->group) >= HIPPO_MEMBERSHIP_STATUS_INVITED)
+ {
+ ddm_data_resource_get(block->resource,
+ "chatId", DDM_DATA_STRING, &chat_id,
+ NULL);
+ }
+
+ hippo_block_set_chat_id(block, chat_id);
+}
+
+static void
+on_group_changed(HippoGroup *group,
+ HippoBlockGroupRevision *block_group_revision)
+{
+ update_edit_link(block_group_revision);
+ update_chat_id(block_group_revision);
+}
+
+static void
+set_group(HippoBlockGroupRevision *block_group_revision,
+ HippoGroup *group)
+{
+ if (group == block_group_revision->group)
+ return;
+
+ if (block_group_revision->group) {
+ g_signal_handlers_disconnect_by_func(block_group_revision->group,
+ (gpointer)on_group_changed,
+ block_group_revision);
+
+ g_object_unref(block_group_revision->group);
+ block_group_revision->group = NULL;
+ }
+
+ if (group) {
+ g_object_ref(group);
+ block_group_revision->group = group;
+
+ g_signal_connect(group, "changed",
+ G_CALLBACK(on_group_changed), block_group_revision);
+ }
+
+ on_group_changed(group, block_group_revision);
+
+ g_object_notify(G_OBJECT(block_group_revision), "group");
+}
+
+static void
+hippo_block_group_revision_dispose(GObject *object)
+{
+ HippoBlockGroupRevision *block_group_revision = HIPPO_BLOCK_GROUP_REVISION(object);
+
+ set_group(block_group_revision, NULL);
+ set_edit_link(block_group_revision, NULL);
+
+ G_OBJECT_CLASS(hippo_block_group_revision_parent_class)->dispose(object);
+}
+
+static void
+hippo_block_group_revision_finalize(GObject *object)
+{
+ G_OBJECT_CLASS(hippo_block_group_revision_parent_class)->finalize(object);
+}
+
+static void
+hippo_block_group_revision_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+}
+
+static void
+hippo_block_group_revision_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ HippoBlockGroupRevision *block_group_revision = HIPPO_BLOCK_GROUP_REVISION(object);
+
+ switch (prop_id) {
+ case PROP_GROUP:
+ g_value_set_object(value, (GObject*) block_group_revision->group);
+ break;
+ case PROP_EDIT_LINK:
+ g_value_set_string(value, block_group_revision->edit_link);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+hippo_block_group_revision_update (HippoBlock *block)
+{
+ HippoBlockGroupRevision *block_group_revision = HIPPO_BLOCK_GROUP_REVISION(block);
+ DDMDataResource *group_resource;
+ DDMDataResource *revision_resource;
+ HippoGroup *group = NULL;
+
+ HIPPO_BLOCK_CLASS(hippo_block_group_revision_parent_class)->update(block);
+
+ ddm_data_resource_get(block->resource,
+ "group", DDM_DATA_RESOURCE, &group_resource,
+ "revision", DDM_DATA_RESOURCE, &revision_resource,
+ NULL);
+
+ if (group_resource != NULL)
+ group = hippo_group_get_for_resource(group_resource);
+
+ set_group(block_group_revision, group);
+ update_edit_link(block_group_revision);
+ update_chat_id(block_group_revision);
+
+ if (group != NULL)
+ g_object_unref(group);
+}
Added: mugshot-client/trunk/common/stacker/hippo-block-group-revision.h
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-block-group-revision.h 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-block-group-revision.h 2008-05-12 20:23:06 UTC (rev 7479)
@@ -0,0 +1,24 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#ifndef __HIPPO_BLOCK_GROUP_REVISION_H__
+#define __HIPPO_BLOCK_GROUP_REVISION_H__
+
+#include "hippo-block.h"
+
+G_BEGIN_DECLS
+
+typedef struct _HippoBlockGroupRevision HippoBlockGroupRevision;
+typedef struct _HippoBlockGroupRevisionClass HippoBlockGroupRevisionClass;
+
+
+#define HIPPO_TYPE_BLOCK_GROUP_REVISION (hippo_block_group_revision_get_type ())
+#define HIPPO_BLOCK_GROUP_REVISION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_BLOCK_GROUP_REVISION, HippoBlockGroupRevision))
+#define HIPPO_BLOCK_GROUP_REVISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HIPPO_TYPE_BLOCK_GROUP_REVISION, HippoBlockGroupRevisionClass))
+#define HIPPO_IS_BLOCK_GROUP_REVISION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HIPPO_TYPE_BLOCK_GROUP_REVISION))
+#define HIPPO_IS_BLOCK_GROUP_REVISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_BLOCK_GROUP_REVISION))
+#define HIPPO_BLOCK_GROUP_REVISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HIPPO_TYPE_BLOCK_GROUP_REVISION, HippoBlockGroupRevisionClass))
+
+GType hippo_block_group_revision_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __HIPPO_BLOCK_GROUP_REVISION_H__ */
Modified: mugshot-client/trunk/common/stacker/hippo-block.c
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-block.c 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-block.c 2008-05-12 20:23:06 UTC (rev 7479)
@@ -5,6 +5,7 @@
#include "hippo-block-generic.h"
#include "hippo-block-group-chat.h"
#include "hippo-block-group-member.h"
+#include "hippo-block-group-revision.h"
#include "hippo-block-post.h"
#include "hippo-block-netflix-movie.h"
#include "hippo-block-amazon-activity.h"
@@ -510,6 +511,9 @@
case HIPPO_BLOCK_TYPE_GROUP_MEMBER:
object_type = HIPPO_TYPE_BLOCK_GROUP_MEMBER;
break;
+ case HIPPO_BLOCK_TYPE_GROUP_REVISION:
+ object_type = HIPPO_TYPE_BLOCK_GROUP_REVISION;
+ break;
case HIPPO_BLOCK_TYPE_POST:
object_type = HIPPO_TYPE_BLOCK_POST;
break;
@@ -992,6 +996,7 @@
{ "POST", HIPPO_BLOCK_TYPE_POST },
{ "ACCOUNT_QUESTION", HIPPO_BLOCK_TYPE_ACCOUNT_QUESTION },
{ "GROUP_MEMBER", HIPPO_BLOCK_TYPE_GROUP_MEMBER },
+ { "GROUP_REVISION", HIPPO_BLOCK_TYPE_GROUP_REVISION },
{ "GROUP_CHAT", HIPPO_BLOCK_TYPE_GROUP_CHAT },
{ "MUSIC_CHAT", HIPPO_BLOCK_TYPE_MUSIC_CHAT },
{ "MUSIC_PERSON", HIPPO_BLOCK_TYPE_MUSIC_PERSON },
Modified: mugshot-client/trunk/common/stacker/hippo-block.h
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-block.h 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-block.h 2008-05-12 20:23:06 UTC (rev 7479)
@@ -13,6 +13,7 @@
HIPPO_BLOCK_TYPE_ACCOUNT_QUESTION,
HIPPO_BLOCK_TYPE_POST,
HIPPO_BLOCK_TYPE_GROUP_MEMBER,
+ HIPPO_BLOCK_TYPE_GROUP_REVISION,
HIPPO_BLOCK_TYPE_GROUP_CHAT,
HIPPO_BLOCK_TYPE_MUSIC_CHAT,
HIPPO_BLOCK_TYPE_MUSIC_PERSON,
Modified: mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.c
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.c 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.c 2008-05-12 20:23:06 UTC (rev 7479)
@@ -49,25 +49,6 @@
static void hippo_canvas_block_generic_update_expandable (HippoCanvasBlockGeneric *block_generic);
-struct _HippoCanvasBlockGeneric {
- HippoCanvasBlock canvas_block;
- HippoCanvasBox *description_parent;
- HippoCanvasItem *description_item;
- HippoCanvasItem *reason_item;
- HippoCanvasItem *expand_tip;
- HippoCanvasItem *quipper;
- HippoCanvasItem *last_message_preview;
- HippoCanvasItem *chat_preview;
- HippoCanvasItem *thumbnails_item;
- unsigned int have_description : 1;
- unsigned int have_thumbnails : 1;
-};
-
-struct _HippoCanvasBlockGenericClass {
- HippoCanvasBlockClass parent_class;
-
-};
-
#if 0
enum {
NO_SIGNALS_YET,
Modified: mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.h
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.h 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-canvas-block-generic.h 2008-05-12 20:23:06 UTC (rev 7479)
@@ -19,6 +19,24 @@
#define HIPPO_IS_CANVAS_BLOCK_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_CANVAS_BLOCK_GENERIC))
#define HIPPO_CANVAS_BLOCK_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HIPPO_TYPE_CANVAS_BLOCK_GENERIC, HippoCanvasBlockGenericClass))
+struct _HippoCanvasBlockGeneric {
+ HippoCanvasBlock canvas_block;
+ HippoCanvasBox *description_parent;
+ HippoCanvasItem *description_item;
+ HippoCanvasItem *reason_item;
+ HippoCanvasItem *expand_tip;
+ HippoCanvasItem *quipper;
+ HippoCanvasItem *last_message_preview;
+ HippoCanvasItem *chat_preview;
+ HippoCanvasItem *thumbnails_item;
+ unsigned int have_description : 1;
+ unsigned int have_thumbnails : 1;
+};
+
+struct _HippoCanvasBlockGenericClass {
+ HippoCanvasBlockClass parent_class;
+};
+
GType hippo_canvas_block_generic_get_type (void) G_GNUC_CONST;
G_END_DECLS
Added: mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.c
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.c 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.c 2008-05-12 20:23:06 UTC (rev 7479)
@@ -0,0 +1,265 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#include "hippo-stacker-internal.h"
+#include <hippo/hippo-group.h>
+#include "hippo-canvas-block.h"
+#include "hippo-canvas-block-generic.h"
+#include "hippo-canvas-block-group-revision.h"
+#include "hippo-canvas-entity-name.h"
+#include "hippo-canvas-url-link.h"
+#include <hippo/hippo-canvas-box.h>
+#include <hippo/hippo-canvas-image.h>
+#include <hippo/hippo-canvas-image-button.h>
+#include <hippo/hippo-canvas-text.h>
+#include <hippo/hippo-canvas-link.h>
+
+static void hippo_canvas_block_group_revision_init (HippoCanvasBlockGroupRevision *block);
+static void hippo_canvas_block_group_revision_class_init (HippoCanvasBlockGroupRevisionClass *klass);
+static void hippo_canvas_block_group_revision_iface_init (HippoCanvasItemIface *item_class);
+static void hippo_canvas_block_group_revision_dispose (GObject *object);
+static void hippo_canvas_block_group_revision_finalize (GObject *object);
+
+/* Canvas block methods */
+static void hippo_canvas_block_group_revision_append_content_items (HippoCanvasBlock *canvas_block,
+ HippoCanvasBox *box);
+static void hippo_canvas_block_group_revision_append_right_items (HippoCanvasBlock *canvas_block,
+ HippoCanvasBox *parent_box);
+
+static void hippo_canvas_block_group_revision_set_block (HippoCanvasBlock *canvas_block,
+ HippoBlock *block);
+
+static void hippo_canvas_block_group_revision_expand (HippoCanvasBlock *canvas_block);
+static void hippo_canvas_block_group_revision_unexpand (HippoCanvasBlock *canvas_block);
+
+
+struct _HippoCanvasBlockGroupRevision {
+ HippoCanvasBlockGeneric parent_instance;
+ HippoCanvasItem *edit_link;
+ HippoCanvasItem *change_item;
+};
+
+struct _HippoCanvasBlockGroupRevisionClass {
+ HippoCanvasBlockGenericClass parent_class;
+
+};
+
+#if 0
+enum {
+ NO_SIGNALS_YET,
+ LAST_SIGNAL
+};
+
+static int signals[LAST_SIGNAL];
+
+enum {
+ PROP_0
+};
+#endif
+
+G_DEFINE_TYPE_WITH_CODE(HippoCanvasBlockGroupRevision, hippo_canvas_block_group_revision, HIPPO_TYPE_CANVAS_BLOCK_GENERIC,
+ G_IMPLEMENT_INTERFACE(HIPPO_TYPE_CANVAS_ITEM, hippo_canvas_block_group_revision_iface_init));
+
+static void
+hippo_canvas_block_group_revision_init(HippoCanvasBlockGroupRevision *block_group_revision)
+{
+ HippoCanvasBlock *block = HIPPO_CANVAS_BLOCK(block_group_revision);
+
+ block->required_type = HIPPO_BLOCK_TYPE_GROUP_REVISION;
+}
+
+static HippoCanvasItemIface *item_parent_class;
+
+static void
+hippo_canvas_block_group_revision_iface_init(HippoCanvasItemIface *item_class)
+{
+ item_parent_class = g_type_interface_peek_parent(item_class);
+}
+
+static void
+hippo_canvas_block_group_revision_class_init(HippoCanvasBlockGroupRevisionClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ HippoCanvasBlockClass *canvas_block_class = HIPPO_CANVAS_BLOCK_CLASS(klass);
+
+ object_class->dispose = hippo_canvas_block_group_revision_dispose;
+ object_class->finalize = hippo_canvas_block_group_revision_finalize;
+
+ canvas_block_class->append_content_items = hippo_canvas_block_group_revision_append_content_items;
+ canvas_block_class->append_right_items = hippo_canvas_block_group_revision_append_right_items;
+ canvas_block_class->set_block = hippo_canvas_block_group_revision_set_block;
+ canvas_block_class->expand = hippo_canvas_block_group_revision_expand;
+ canvas_block_class->unexpand = hippo_canvas_block_group_revision_unexpand;
+}
+
+static void
+hippo_canvas_block_group_revision_dispose(GObject *object)
+{
+
+ G_OBJECT_CLASS(hippo_canvas_block_group_revision_parent_class)->dispose(object);
+}
+
+static void
+hippo_canvas_block_group_revision_finalize(GObject *object)
+{
+ /* HippoCanvasBlockGroupRevision *block = HIPPO_CANVAS_BLOCK_GROUP_REVISION(object); */
+
+ G_OBJECT_CLASS(hippo_canvas_block_group_revision_parent_class)->finalize(object);
+}
+
+static void
+hippo_canvas_block_group_revision_append_content_items (HippoCanvasBlock *block,
+ HippoCanvasBox *parent_box)
+{
+ HippoCanvasBlockGroupRevision *canvas_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(block);
+ HippoCanvasBox *edit_parent;
+
+ HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->append_content_items(block, parent_box);
+
+ hippo_canvas_block_set_heading(block, _("Group Change"));
+
+ edit_parent = g_object_new(HIPPO_TYPE_CANVAS_BOX,
+ "orientation", HIPPO_ORIENTATION_HORIZONTAL,
+ "spacing", 4,
+ NULL);
+ hippo_canvas_box_insert_after(parent_box, HIPPO_CANVAS_ITEM(edit_parent),
+ HIPPO_CANVAS_BLOCK_GENERIC(block)->reason_item, 0);
+
+ canvas_group_revision->edit_link = g_object_new(HIPPO_TYPE_CANVAS_URL_LINK,
+ "text", _("edit the group"),
+ "tooltip", _("Make more changes to the group"),
+ NULL);
+ hippo_canvas_box_append(edit_parent, canvas_group_revision->edit_link, 0);
+}
+
+static void
+hippo_canvas_block_group_revision_append_right_items(HippoCanvasBlock *canvas_block,
+ HippoCanvasBox *parent_box)
+{
+ HippoCanvasBlockGroupRevision *block_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(canvas_block);
+ HippoCanvasBox *change_box;
+ HippoCanvasBox *name_box;
+ HippoCanvasBox *right_box;
+ HippoCanvasItem *change_item_intro;
+
+ if (HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->append_right_items)
+ HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->append_right_items(canvas_block, parent_box);
+
+ /* Ugly... we insert the item into the box on the right after the name of the sender */
+
+ name_box = HIPPO_CANVAS_BOX(hippo_canvas_item_get_parent(canvas_block->name_item));
+ right_box= HIPPO_CANVAS_BOX(hippo_canvas_item_get_parent(HIPPO_CANVAS_ITEM(name_box)));
+
+ change_box = g_object_new(HIPPO_TYPE_CANVAS_BOX,
+ "orientation", HIPPO_ORIENTATION_HORIZONTAL,
+ "xalign", HIPPO_ALIGNMENT_END,
+ NULL);
+
+ hippo_canvas_box_insert_after(right_box, HIPPO_CANVAS_ITEM(change_box),
+ HIPPO_CANVAS_ITEM(name_box), 0);
+
+ change_item_intro = g_object_new(HIPPO_TYPE_CANVAS_TEXT,
+ "font", "12px",
+ "text", _("change to "),
+ NULL);
+ hippo_canvas_box_append(change_box, change_item_intro, 0);
+
+ block_group_revision->change_item = g_object_new(HIPPO_TYPE_CANVAS_ENTITY_NAME,
+ NULL);
+ hippo_canvas_box_append(change_box, block_group_revision->change_item, 0);
+}
+
+static void
+on_group_changed(HippoBlock *block,
+ GParamSpec *arg, /* null when first calling this */
+ HippoCanvasBlock *canvas_block)
+{
+ HippoCanvasBlockGroupRevision *canvas_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(canvas_block);
+ HippoGroup *group;
+
+ g_assert(block == canvas_block->block);
+ group = NULL;
+ g_object_get(G_OBJECT(block), "group", &group, NULL);
+
+ if (group == NULL) {
+ /* can't think of much sensible to do here, presumably it will
+ * get set back to non-null later
+ */
+ } else {
+ g_object_set(canvas_group_revision->change_item,
+ "entity", group,
+ NULL);
+ g_object_unref(group);
+ }
+}
+
+static void
+on_edit_link_changed(HippoBlock *block,
+ GParamSpec *arg, /* null when first calling this */
+ HippoCanvasBlock *canvas_block)
+{
+ HippoCanvasBlockGroupRevision *canvas_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(canvas_block);
+ char *edit_link;
+
+ g_object_get(G_OBJECT(block),
+ "edit-link", &edit_link,
+ NULL);
+
+ hippo_canvas_item_set_visible(canvas_group_revision->edit_link,
+ edit_link != NULL);
+ g_object_set(canvas_group_revision->edit_link,
+ "url", edit_link,
+ NULL);
+
+ g_free(edit_link);
+}
+
+static void
+hippo_canvas_block_group_revision_set_block(HippoCanvasBlock *canvas_block,
+ HippoBlock *block)
+{
+ /* g_debug("canvas-block-group-member set block %p", block); */
+
+ if (block == canvas_block->block)
+ return;
+
+ if (canvas_block->block != NULL) {
+ g_signal_handlers_disconnect_by_func(G_OBJECT(canvas_block->block),
+ G_CALLBACK(on_edit_link_changed),
+ canvas_block);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(canvas_block->block),
+ G_CALLBACK(on_group_changed),
+ canvas_block);
+ }
+
+ /* Chain up to get the block really changed */
+ HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->set_block(canvas_block, block);
+
+ if (canvas_block->block != NULL) {
+ g_signal_connect(G_OBJECT(canvas_block->block),
+ "notify::group",
+ G_CALLBACK(on_group_changed),
+ canvas_block);
+ g_signal_connect(G_OBJECT(canvas_block->block),
+ "notify::edit-link",
+ G_CALLBACK(on_edit_link_changed),
+ canvas_block);
+
+ on_group_changed(canvas_block->block, NULL, canvas_block);
+ on_edit_link_changed(canvas_block->block, NULL, canvas_block);
+ }
+}
+
+static void
+hippo_canvas_block_group_revision_expand(HippoCanvasBlock *canvas_block)
+{
+ /* HippoCanvasBlockGroupRevision *block_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(canvas_block); */
+
+ HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->expand(canvas_block);
+}
+
+static void
+hippo_canvas_block_group_revision_unexpand(HippoCanvasBlock *canvas_block)
+{
+ /* HippoCanvasBlockGroupRevision *block_group_revision = HIPPO_CANVAS_BLOCK_GROUP_REVISION(canvas_block); */
+
+ HIPPO_CANVAS_BLOCK_CLASS(hippo_canvas_block_group_revision_parent_class)->unexpand(canvas_block);
+}
Added: mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.h
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.h 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-canvas-block-group-revision.h 2008-05-12 20:23:06 UTC (rev 7479)
@@ -0,0 +1,25 @@
+/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+#ifndef __HIPPO_CANVAS_BLOCK_GROUP_REVISION_H__
+#define __HIPPO_CANVAS_BLOCK_GROUP_REVISION_H__
+
+/* A canvas item that displays a stacker block */
+
+#include <hippo/hippo-canvas-item.h>
+
+G_BEGIN_DECLS
+
+typedef struct _HippoCanvasBlockGroupRevision HippoCanvasBlockGroupRevision;
+typedef struct _HippoCanvasBlockGroupRevisionClass HippoCanvasBlockGroupRevisionClass;
+
+#define HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION (hippo_canvas_block_group_revision_get_type ())
+#define HIPPO_CANVAS_BLOCK_GROUP_REVISION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION, HippoCanvasBlockGroupRevision))
+#define HIPPO_CANVAS_BLOCK_GROUP_REVISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION, HippoCanvasBlockGroupRevisionClass))
+#define HIPPO_IS_CANVAS_BLOCK_GROUP_REVISION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION))
+#define HIPPO_IS_CANVAS_BLOCK_GROUP_REVISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION))
+#define HIPPO_CANVAS_BLOCK_GROUP_REVISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION, HippoCanvasBlockGroupRevisionClass))
+
+GType hippo_canvas_block_group_revision_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __HIPPO_CANVAS_BLOCK_GROUP_REVISION_H__ */
Modified: mugshot-client/trunk/common/stacker/hippo-canvas-block.c
===================================================================
--- mugshot-client/trunk/common/stacker/hippo-canvas-block.c 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/common/stacker/hippo-canvas-block.c 2008-05-12 20:23:06 UTC (rev 7479)
@@ -7,6 +7,7 @@
#include "hippo-canvas-block-post.h"
#include "hippo-canvas-block-group-chat.h"
#include "hippo-canvas-block-group-member.h"
+#include "hippo-canvas-block-group-revision.h"
#include "hippo-canvas-block-music.h"
#include "hippo-canvas-block-netflix-movie.h"
#include "hippo-canvas-block-amazon-activity.h"
@@ -302,6 +303,9 @@
case HIPPO_BLOCK_TYPE_GROUP_MEMBER:
object_type = HIPPO_TYPE_CANVAS_BLOCK_GROUP_MEMBER;
break;
+ case HIPPO_BLOCK_TYPE_GROUP_REVISION:
+ object_type = HIPPO_TYPE_CANVAS_BLOCK_GROUP_REVISION;
+ break;
case HIPPO_BLOCK_TYPE_FACEBOOK_EVENT:
object_type = HIPPO_TYPE_CANVAS_BLOCK_FACEBOOK_EVENT;
break;
Modified: mugshot-client/trunk/linux/Makefile-libstacker.am
===================================================================
--- mugshot-client/trunk/linux/Makefile-libstacker.am 2008-05-12 19:31:27 UTC (rev 7478)
+++ mugshot-client/trunk/linux/Makefile-libstacker.am 2008-05-12 20:23:06 UTC (rev 7479)
@@ -37,6 +37,8 @@
$(COMMONSRCDIR)/stacker/hippo-block-group-chat.h \
$(COMMONSRCDIR)/stacker/hippo-block-group-member.c \
$(COMMONSRCDIR)/stacker/hippo-block-group-member.h \
+ $(COMMONSRCDIR)/stacker/hippo-block-group-revision.c \
+ $(COMMONSRCDIR)/stacker/hippo-block-group-revision.h \
$(COMMONSRCDIR)/stacker/hippo-block-account-question.c \
$(COMMONSRCDIR)/stacker/hippo-block-account-question.h \
$(COMMONSRCDIR)/stacker/hippo-block-abstract-person.c \
@@ -63,6 +65,8 @@
$(COMMONSRCDIR)/stacker/hippo-canvas-block-group-chat.h \
$(COMMONSRCDIR)/stacker/hippo-canvas-block-group-member.c \
$(COMMONSRCDIR)/stacker/hippo-canvas-block-group-member.h \
+ $(COMMONSRCDIR)/stacker/hippo-canvas-block-group-revision.c \
+ $(COMMONSRCDIR)/stacker/hippo-canvas-block-group-revision.h \
$(COMMONSRCDIR)/stacker/hippo-canvas-block-music.c \
$(COMMONSRCDIR)/stacker/hippo-canvas-block-music.h \
$(COMMONSRCDIR)/stacker/hippo-canvas-block-netflix-movie.c \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]