[gdl] Add a "selected" signal to GdlDockItem
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gdl] Add a "selected" signal to GdlDockItem
- Date: Tue, 27 Oct 2009 07:31:34 +0000 (UTC)
commit 7822921840396d2b31ab5a91fd208df3556342d7
Author: James Liggett <jrliggett cox net>
Date: Tue Oct 27 00:29:45 2009 -0700
Add a "selected" signal to GdlDockItem
This signal is emitted when the item is selected from the switcher.
gdl/gdl-dock-item.c | 30 ++++++++++++++++++++++++++++++
gdl/gdl-dock-item.h | 2 +-
gdl/gdl-dock-notebook.c | 5 +++++
3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/gdl/gdl-dock-item.c b/gdl/gdl-dock-item.c
index 204cfce..2255974 100644
--- a/gdl/gdl-dock-item.c
+++ b/gdl/gdl-dock-item.c
@@ -157,6 +157,7 @@ enum {
DOCK_DRAG_BEGIN,
DOCK_DRAG_MOTION,
DOCK_DRAG_END,
+ SELECTED,
LAST_SIGNAL
};
@@ -364,6 +365,22 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
1,
G_TYPE_BOOLEAN);
+ /**
+ * GdlDockItem::selected:
+ *
+ * Signals that this dock has been selected from a switcher.
+ */
+ gdl_dock_item_signals [SELECTED] =
+ g_signal_new ("selected",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
klass->has_grip = TRUE;
klass->dock_drag_begin = NULL;
klass->dock_drag_motion = NULL;
@@ -1838,6 +1855,19 @@ gdl_dock_item_show_grip (GdlDockItem *item)
};
}
+/**
+ * gdl_dock_item_notify_selected:
+ * @item: the dock item to emit a selected signal on.
+ *
+ * This function emits the selected signal. It is to be used by #GdlSwitcher
+ * to let clients know that this item has been switched to.
+ **/
+void
+gdl_dock_item_notify_selected (GdlDockItem *item)
+{
+ g_signal_emit (item, gdl_dock_item_signals [SELECTED], 0);
+}
+
/* convenient function (and to preserve source compat) */
/**
* gdl_dock_item_bind:
diff --git a/gdl/gdl-dock-item.h b/gdl/gdl-dock-item.h
index 8b666e8..ea47a83 100644
--- a/gdl/gdl-dock-item.h
+++ b/gdl/gdl-dock-item.h
@@ -99,7 +99,6 @@ struct _GdlDockItemClass {
gint y);
void (* dock_drag_end) (GdlDockItem *item,
gboolean cancelled);
-
void (* set_orientation) (GdlDockItem *item,
GtkOrientation orientation);
};
@@ -159,6 +158,7 @@ void gdl_dock_item_set_tablabel (GdlDockItem *item,
GtkWidget *gdl_dock_item_get_grip (GdlDockItem *item);
void gdl_dock_item_hide_grip (GdlDockItem *item);
void gdl_dock_item_show_grip (GdlDockItem *item);
+void gdl_dock_item_notify_selected (GdlDockItem *item);
/* bind and unbind items to a dock */
void gdl_dock_item_bind (GdlDockItem *item,
diff --git a/gdl/gdl-dock-notebook.c b/gdl/gdl-dock-notebook.c
index 3f59226..21179de 100644
--- a/gdl/gdl-dock-notebook.c
+++ b/gdl/gdl-dock-notebook.c
@@ -267,6 +267,7 @@ gdl_dock_notebook_switch_page_cb (GtkNotebook *nb,
{
GdlDockNotebook *notebook;
GtkWidget *tablabel;
+ GdlDockItem *item;
notebook = GDL_DOCK_NOTEBOOK (data);
@@ -289,6 +290,10 @@ gdl_dock_notebook_switch_page_cb (GtkNotebook *nb,
GDL_DOCK_OBJECT (notebook)->master)
g_signal_emit_by_name (GDL_DOCK_OBJECT (notebook)->master,
"layout-changed");
+
+ /* Signal that a new dock item has been selected */
+ item = GDL_DOCK_ITEM (gtk_notebook_get_nth_page (nb, page_num));
+ gdl_dock_item_notify_selected (item);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]