[gnome-panel/bonobo-less] [panel] PanelAppletFrame needs to be a subclass of GtkEventBox
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/bonobo-less] [panel] PanelAppletFrame needs to be a subclass of GtkEventBox
- Date: Wed, 26 May 2010 14:10:18 +0000 (UTC)
commit 044ec26e33553cb16c31d1df0eb9fa1bde83a5d2
Author: Vincent Untz <vuntz gnome org>
Date: Wed May 26 16:08:23 2010 +0200
[panel] PanelAppletFrame needs to be a subclass of GtkEventBox
It was a subclass of GtkBin, which made it impossible to catch
right-click button events on the handles.
This also fixes the annoying bug where applets are not always visible
(this was an issue caused by the way the allocation was used when an
applet has a handle -- apparently, GtkBin doesn't work as I thought in
this case).
gnome-panel/panel-applet-frame.c | 26 ++++++++------------------
gnome-panel/panel-applet-frame.h | 4 ++--
2 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index 36db459..c75ae41 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -69,7 +69,7 @@ struct _PanelAppletFrameActivating {
/* PanelAppletFrame implementation */
-G_DEFINE_TYPE (PanelAppletFrame, panel_applet_frame, GTK_TYPE_BIN)
+G_DEFINE_TYPE (PanelAppletFrame, panel_applet_frame, GTK_TYPE_EVENT_BOX)
#define PANEL_APPLET_FRAME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET_FRAME, PanelAppletFramePrivate))
@@ -177,13 +177,11 @@ panel_applet_frame_size_request (GtkWidget *widget,
frame = PANEL_APPLET_FRAME (widget);
bin = GTK_BIN (widget);
- /* This is a GtkBin subclass, so we have to implement size request
- * ourselves in all cases, without relying on the parent class
- * implementation */
-
- requisition->width = 0;
- requisition->height = 0;
-
+ if (!frame->priv->has_handle) {
+ GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->size_request (widget, requisition);
+ return;
+ }
+
if (bin->child && gtk_widget_get_visible (bin->child)) {
gtk_widget_size_request (bin->child, &child_requisition);
@@ -191,9 +189,6 @@ panel_applet_frame_size_request (GtkWidget *widget,
requisition->height = child_requisition.height;
}
- if (!frame->priv->has_handle)
- return;
-
requisition->width += GTK_CONTAINER (widget)->border_width;
requisition->height += GTK_CONTAINER (widget)->border_width;
@@ -229,14 +224,9 @@ panel_applet_frame_size_allocate (GtkWidget *widget,
frame = PANEL_APPLET_FRAME (widget);
bin = GTK_BIN (widget);
- /* This is a GtkBin subclass, so we have to implement size allocation
- * ourselves in all cases, without relying on the parent class
- * implementation */
-
if (!frame->priv->has_handle) {
- if (bin->child && gtk_widget_get_visible (bin->child))
- gtk_widget_size_allocate (bin->child, allocation);
-
+ GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->size_allocate (widget,
+ allocation);
panel_applet_frame_update_background_size (frame,
&old_allocation,
allocation);
diff --git a/gnome-panel/panel-applet-frame.h b/gnome-panel/panel-applet-frame.h
index fbb780d..a459bb7 100644
--- a/gnome-panel/panel-applet-frame.h
+++ b/gnome-panel/panel-applet-frame.h
@@ -44,7 +44,7 @@ typedef struct _PanelAppletFrameClass PanelAppletFrameClass;
typedef struct _PanelAppletFramePrivate PanelAppletFramePrivate;
struct _PanelAppletFrameClass {
- GtkBinClass parent_class;
+ GtkEventBoxClass parent_class;
void (*init_properties) (PanelAppletFrame *frame);
@@ -70,7 +70,7 @@ struct _PanelAppletFrameClass {
};
struct _PanelAppletFrame {
- GtkBin parent;
+ GtkEventBox parent;
PanelAppletFramePrivate *priv;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]