[gnome-panel] [panel] Fix errors in previous commit (5dc31a77)
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Fix errors in previous commit (5dc31a77)
- Date: Tue, 22 Jun 2010 17:18:46 +0000 (UTC)
commit e41f428c68687ece6612da000e906533899acbd0
Author: Vincent Untz <vuntz gnome org>
Date: Tue Jun 22 19:15:47 2010 +0200
[panel] Fix errors in previous commit (5dc31a77)
Some fixes were wrong, and coding style needed some update.
gnome-panel/applet.c | 34 +++++++++-------
gnome-panel/button-widget.c | 22 +++++-----
gnome-panel/nothing.cP | 2 +-
gnome-panel/panel-applet-frame.c | 36 +++++++++++-----
gnome-panel/panel-background.c | 2 +-
gnome-panel/panel-menu-bar.c | 5 +-
gnome-panel/panel-menu-button.c | 2 +-
gnome-panel/panel-run-dialog.c | 7 +--
gnome-panel/panel-separator.c | 16 ++++---
gnome-panel/panel-toplevel.c | 84 +++++++++++++++++++------------------
gnome-panel/panel-util.c | 11 +++--
gnome-panel/panel-widget.c | 48 ++++++++++++----------
gnome-panel/panel.c | 10 +++--
13 files changed, 155 insertions(+), 124 deletions(-)
---
diff --git a/gnome-panel/applet.c b/gnome-panel/applet.c
index d007424..26b6490 100644
--- a/gnome-panel/applet.c
+++ b/gnome-panel/applet.c
@@ -42,6 +42,12 @@ static GSList *queued_position_saves = NULL;
static guint queued_position_source = 0;
+static inline PanelWidget *
+panel_applet_get_panel_widget (AppletInfo *info)
+{
+ return PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+}
+
static void
panel_applet_set_dnd_enabled (AppletInfo *info,
gboolean dnd_enabled)
@@ -81,7 +87,7 @@ panel_applet_toggle_locked (AppletInfo *info)
PanelWidget *panel_widget;
gboolean locked;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+ panel_widget = panel_applet_get_panel_widget (info);
locked = panel_widget_toggle_applet_locked (panel_widget, info->widget);
@@ -111,10 +117,11 @@ move_applet_callback (GtkWidget *widget, AppletInfo *info)
GtkWidget *parent;
PanelWidget *panel;
- parent = gtk_widget_get_parent (info->widget);
-
g_return_if_fail (info != NULL);
g_return_if_fail (info->widget != NULL);
+
+ parent = gtk_widget_get_parent (info->widget);
+
g_return_if_fail (parent != NULL);
g_return_if_fail (PANEL_IS_WIDGET (parent));
@@ -188,7 +195,7 @@ panel_applet_locked_change_notify (GConfClient *client,
locked = gconf_value_get_bool (value);
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+ panel_widget = panel_applet_get_panel_widget (info);
applet_locked = panel_widget_get_applet_locked (panel_widget,
info->widget);
@@ -219,7 +226,7 @@ applet_user_menu_get_screen (AppletUserMenu *menu)
{
PanelWidget *panel_widget;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (menu->info->widget));
+ panel_widget = panel_applet_get_panel_widget (menu->info);
return gtk_window_get_screen (GTK_WINDOW (panel_widget->toplevel));
}
@@ -290,7 +297,7 @@ applet_menu_show (GtkWidget *w,
{
PanelWidget *panel_widget;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+ panel_widget = panel_applet_get_panel_widget (info);
panel_toplevel_push_autohide_disabler (panel_widget->toplevel);
}
@@ -302,7 +309,7 @@ applet_menu_deactivate (GtkWidget *w,
{
PanelWidget *panel_widget;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+ panel_widget = panel_applet_get_panel_widget (info);
panel_toplevel_pop_autohide_disabler (panel_widget->toplevel);
}
@@ -473,7 +480,7 @@ panel_applet_create_menu (AppletInfo *info)
PanelWidget *panel_widget;
gboolean added_anything = FALSE;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (info->widget));
+ panel_widget = panel_applet_get_panel_widget (info);
menu = g_object_ref_sink (gtk_menu_new ());
@@ -662,14 +669,11 @@ static void
applet_show_menu (AppletInfo *info,
GdkEventButton *event)
{
- GtkWidget *parent;
PanelWidget *panel_widget;
g_return_if_fail (info != NULL);
- parent = gtk_widget_get_parent (info->widget);
-
- panel_widget = PANEL_WIDGET (parent);
+ panel_widget = panel_applet_get_panel_widget (info);
if (info->menu == NULL)
info->menu = panel_applet_create_menu (info);
@@ -679,7 +683,7 @@ applet_show_menu (AppletInfo *info,
panel_applet_menu_set_recurse (GTK_MENU (info->menu),
"menu_panel",
- parent);
+ panel_widget);
gtk_menu_set_screen (GTK_MENU (info->menu),
gtk_window_get_screen (GTK_WINDOW (panel_widget->toplevel)));
@@ -1094,7 +1098,7 @@ panel_applet_get_toplevel_id (AppletInfo *applet)
g_return_val_if_fail (applet != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (applet->widget), NULL);
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (applet->widget));
+ panel_widget = panel_applet_get_panel_widget (applet);
if (!panel_widget)
return NULL;
@@ -1158,7 +1162,7 @@ panel_applet_save_position (AppletInfo *applet_info,
key_type = applet_info->type == PANEL_OBJECT_APPLET ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS;
- panel_widget = PANEL_WIDGET (gtk_widget_get_parent (applet_info->widget));
+ panel_widget = panel_applet_get_panel_widget (applet_info);
/* FIXME: Instead of getting keys, comparing and setting, there
should be a dirty flag */
diff --git a/gnome-panel/button-widget.c b/gnome-panel/button-widget.c
index ad837a6..6f2fd6b 100644
--- a/gnome-panel/button-widget.c
+++ b/gnome-panel/button-widget.c
@@ -113,9 +113,9 @@ make_hc_pixbuf (GdkPixbuf *pb)
static void
button_widget_realize(GtkWidget *widget)
{
+ GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
- GtkAllocation allocation;
GtkButton *button;
g_return_if_fail (widget != NULL);
@@ -123,10 +123,11 @@ button_widget_realize(GtkWidget *widget)
button = GTK_BUTTON (widget);
- gtk_widget_realize (widget);
+ gtk_widget_set_realized (widget, TRUE);
- attributes.window_type = GDK_WINDOW_CHILD;
gtk_widget_get_allocation (widget, &allocation);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
@@ -142,7 +143,7 @@ button_widget_realize(GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y;
gtk_widget_set_window (widget, gtk_widget_get_parent_window (widget));
- g_object_ref (G_OBJECT (gtk_widget_get_window (widget)));
+ g_object_ref (gtk_widget_get_window (widget));
button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes,
@@ -368,9 +369,9 @@ button_widget_expose (GtkWidget *widget,
GdkEventExpose *event)
{
ButtonWidget *button_widget;
+ GtkButton *button;
GdkWindow *window;
GtkAllocation allocation;
- GtkButton *button;
GdkRectangle area, image_bound;
GtkStyle *style;
int off;
@@ -380,15 +381,16 @@ button_widget_expose (GtkWidget *widget,
g_return_val_if_fail (BUTTON_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
- button_widget = BUTTON_WIDGET (widget);
- button = GTK_BUTTON (widget);
-
if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget))
return FALSE;
+ button_widget = BUTTON_WIDGET (widget);
+
if (!button_widget->priv->pixbuf_hc && !button_widget->priv->pixbuf)
return FALSE;
+ button = GTK_BUTTON (widget);
+ window = gtk_widget_get_window (widget);
gtk_widget_get_allocation (widget, &allocation);
/* offset for pressed buttons */
@@ -421,8 +423,6 @@ button_widget_expose (GtkWidget *widget,
image_bound.height = h;
area = event->area;
-
- window = gtk_widget_get_window (widget);
if (gdk_rectangle_intersect (&area, &allocation, &area) &&
gdk_rectangle_intersect (&image_bound, &area, &image_bound))
@@ -434,7 +434,7 @@ button_widget_expose (GtkWidget *widget,
0, 0);
g_object_unref (pb);
-
+
style = gtk_widget_get_style (widget);
if (button_widget->priv->arrow) {
diff --git a/gnome-panel/nothing.cP b/gnome-panel/nothing.cP
index 9965f3a..67e1c8e 100644
--- a/gnome-panel/nothing.cP
+++ b/gnome-panel/nothing.cP
@@ -1329,7 +1329,7 @@ geginv_realized (GtkWidget *w, gpointer data)
if (geginv_pixmap == NULL)
geginv_pixmap = gdk_pixmap_new (gtk_widget_get_window (w),
inv_width, inv_height,
- gdk_visual_get_best_depth());
+ gdk_visual_get_depth (gtk_widget_get_visual (w)));
}
static gboolean
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index 6316e74..5452eb8 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -172,6 +172,7 @@ panel_applet_frame_size_request (GtkWidget *widget,
{
PanelAppletFrame *frame;
GtkBin *bin;
+ GtkWidget *child;
GtkRequisition child_requisition;
guint border_width;
@@ -183,8 +184,9 @@ panel_applet_frame_size_request (GtkWidget *widget,
return;
}
- if (gtk_bin_get_child (bin) && gtk_widget_get_visible (gtk_bin_get_child (bin))) {
- gtk_widget_size_request (gtk_bin_get_child (bin), &child_requisition);
+ child = gtk_bin_get_child (bin);
+ if (child && gtk_widget_get_visible (child)) {
+ gtk_widget_size_request (child, &child_requisition);
requisition->width = child_requisition.width;
requisition->height = child_requisition.height;
@@ -215,12 +217,14 @@ panel_applet_frame_size_allocate (GtkWidget *widget,
{
PanelAppletFrame *frame;
GtkBin *bin;
+ GtkWidget *child;
+ GdkWindow *window;
GtkAllocation new_allocation;
GtkAllocation old_allocation;
GtkAllocation widget_allocation;
- guint border_width;
gtk_widget_get_allocation (widget, &widget_allocation);
+
old_allocation.x = widget_allocation.x;
old_allocation.y = widget_allocation.y;
old_allocation.width = widget_allocation.width;
@@ -238,6 +242,8 @@ panel_applet_frame_size_allocate (GtkWidget *widget,
return;
}
+ window = gtk_widget_get_window (widget);
+ child = gtk_bin_get_child (bin);
gtk_widget_set_allocation (widget, allocation);
frame->priv->handle_rect.x = 0;
@@ -288,19 +294,21 @@ panel_applet_frame_size_allocate (GtkWidget *widget,
new_allocation.y != frame->priv->child_allocation.y ||
new_allocation.width != frame->priv->child_allocation.width ||
new_allocation.height != frame->priv->child_allocation.height))
- gdk_window_invalidate_rect (gtk_widget_get_window (widget), &widget_allocation, FALSE);
+ gdk_window_invalidate_rect (window, &widget_allocation, FALSE);
if (gtk_widget_get_realized (widget)) {
+ guint border_width;
+
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gdk_window_move_resize (gtk_widget_get_window (widget),
+ gdk_window_move_resize (window,
allocation->x + border_width,
allocation->y + border_width,
MAX (allocation->width - border_width * 2, 0),
MAX (allocation->height - border_width * 2, 0));
}
- if (gtk_bin_get_child (bin) && gtk_widget_get_visible (gtk_bin_get_child (bin)))
- gtk_widget_size_allocate (gtk_bin_get_child (bin), &new_allocation);
+ if (child && gtk_widget_get_visible (child))
+ gtk_widget_size_allocate (child, &new_allocation);
frame->priv->child_allocation = new_allocation;
@@ -467,13 +475,18 @@ void
panel_applet_frame_change_background (PanelAppletFrame *frame,
PanelBackgroundType type)
{
+ GtkWidget *parent;
+
g_return_if_fail (PANEL_IS_APPLET_FRAME (frame));
- g_return_if_fail (PANEL_IS_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame))));
+
+ parent = gtk_widget_get_parent (GTK_WIDGET (frame));
+
+ g_return_if_fail (PANEL_IS_WIDGET (parent));
if (frame->priv->has_handle) {
PanelBackground *background;
- background = &PANEL_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame)))->background;
+ background = &PANEL_WIDGET (parent)->background;
panel_background_change_background_on_widget (background,
GTK_WIDGET (frame));
}
@@ -753,11 +766,12 @@ void
_panel_applet_frame_applet_move (PanelAppletFrame *frame)
{
GtkWidget *widget = GTK_WIDGET (frame);
+ GtkWidget *parent = gtk_widget_get_parent (widget);
- if (!PANEL_IS_WIDGET (gtk_widget_get_parent (widget)))
+ if (!PANEL_IS_WIDGET (parent))
return;
- panel_widget_applet_drag_start (PANEL_WIDGET (gtk_widget_get_parent (widget)),
+ panel_widget_applet_drag_start (PANEL_WIDGET (parent),
widget,
PW_DRAG_OFF_CENTER,
GDK_CURRENT_TIME);
diff --git a/gnome-panel/panel-background.c b/gnome-panel/panel-background.c
index 283c024..6341b29 100644
--- a/gnome-panel/panel-background.c
+++ b/gnome-panel/panel-background.c
@@ -1073,10 +1073,10 @@ panel_background_set_image_background_on_widget (PanelBackground *background,
GtkWidget *widget)
{
const GdkPixmap *bg_pixmap;
+ GtkAllocation allocation;
GdkPixmap *pixmap;
cairo_t *cr;
cairo_pattern_t *pattern;
- GtkAllocation allocation;
GtkStyle *style;
bg_pixmap = panel_background_get_pixmap (background);
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index cd20163..e004a9f 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -219,8 +219,8 @@ static void
panel_menu_bar_parent_set (GtkWidget *widget,
GtkWidget *previous_parent)
{
- GtkWidget *parent;
PanelMenuBar *menubar = PANEL_MENU_BAR (widget);
+ GtkWidget *parent;
parent = gtk_widget_get_parent (widget);
g_assert (!parent || PANEL_IS_WIDGET (parent));
@@ -248,6 +248,7 @@ panel_menu_bar_size_allocate (GtkWidget *widget,
PanelBackground *background;
gtk_widget_get_allocation (widget, &widget_allocation);
+
old_allocation.x = widget_allocation.x;
old_allocation.y = widget_allocation.y;
old_allocation.width = widget_allocation.width;
@@ -312,7 +313,7 @@ panel_menu_bar_on_expose (GtkWidget *widget,
if (gtk_widget_has_focus (GTK_WIDGET (menubar)))
gtk_paint_focus (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
+ gtk_widget_get_window (widget),
gtk_widget_get_state (GTK_WIDGET (menubar)),
NULL,
widget,
diff --git a/gnome-panel/panel-menu-button.c b/gnome-panel/panel-menu-button.c
index 69020d2..2d93056 100644
--- a/gnome-panel/panel-menu-button.c
+++ b/gnome-panel/panel-menu-button.c
@@ -306,8 +306,8 @@ static void
panel_menu_button_parent_set (GtkWidget *widget,
GtkWidget *previous_parent)
{
- GtkWidget *parent;
PanelMenuButton *button = PANEL_MENU_BUTTON (widget);
+ GtkWidget *parent;
parent = gtk_widget_get_parent (widget);
g_return_if_fail (!parent || PANEL_IS_WIDGET (parent));
diff --git a/gnome-panel/panel-run-dialog.c b/gnome-panel/panel-run-dialog.c
index 1a0bc0f..e525d49 100644
--- a/gnome-panel/panel-run-dialog.c
+++ b/gnome-panel/panel-run-dialog.c
@@ -1160,11 +1160,10 @@ static void
panel_run_dialog_update_content (PanelRunDialog *dialog,
gboolean show_list)
{
- GtkWidget *parent;
-
- parent = gtk_widget_get_parent (dialog->list_expander);
-
if (!panel_profile_get_enable_program_list ()) {
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (dialog->list_expander);
if (parent)
gtk_container_remove (GTK_CONTAINER (parent),
dialog->list_expander);
diff --git a/gnome-panel/panel-separator.c b/gnome-panel/panel-separator.c
index 1aa6b0c..7d7f696 100644
--- a/gnome-panel/panel-separator.c
+++ b/gnome-panel/panel-separator.c
@@ -45,24 +45,26 @@ static void
panel_separator_paint (GtkWidget *widget,
GdkRectangle *area)
{
- GtkAllocation allocation;
- GtkStyle *style;
PanelSeparator *separator;
+ GdkWindow *window;
+ GtkStyle *style;
+ GtkAllocation allocation;
separator = PANEL_SEPARATOR (widget);
- gtk_widget_get_allocation (widget, &allocation);
+ window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
+ gtk_widget_get_allocation (widget, &allocation);
if (separator->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
- gtk_paint_vline (style, gtk_widget_get_window (widget),
+ gtk_paint_vline (style, window,
gtk_widget_get_state (widget),
area, widget, "separator",
style->xthickness,
allocation.height - style->xthickness,
(allocation.width - style->xthickness) / 2);
} else {
- gtk_paint_hline (style, gtk_widget_get_window (widget),
+ gtk_paint_hline (style, window,
gtk_widget_get_state (widget),
area, widget, "separator",
style->ythickness,
@@ -113,6 +115,7 @@ panel_separator_size_allocate (GtkWidget *widget,
PanelBackground *background;
gtk_widget_get_allocation (widget, &widget_allocation);
+
old_allocation.x = widget_allocation.x;
old_allocation.y = widget_allocation.y;
old_allocation.width = widget_allocation.width;
@@ -139,13 +142,12 @@ static void
panel_separator_parent_set (GtkWidget *widget,
GtkWidget *previous_parent)
{
- GtkWidget *parent;
PanelSeparator *separator;
+ GtkWidget *parent;
separator = PANEL_SEPARATOR (widget);
parent = gtk_widget_get_parent (widget);
-
g_assert (!parent || PANEL_IS_WIDGET (parent));
separator->priv->panel = (PanelWidget *) parent;
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index 88f6f8e..dbd9294 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -443,6 +443,7 @@ panel_toplevel_begin_grab_op (PanelToplevel *toplevel,
guint32 time_)
{
GtkWidget *widget;
+ GdkWindow *window;
GdkCursorType cursor_type;
GdkCursor *cursor;
@@ -474,6 +475,7 @@ panel_toplevel_begin_grab_op (PanelToplevel *toplevel,
}
widget = GTK_WIDGET (toplevel);
+ window = gtk_widget_get_window (widget);
toplevel->priv->grab_op = op_type;
toplevel->priv->grab_is_keyboard = grab_keyboard;
@@ -497,13 +499,13 @@ panel_toplevel_begin_grab_op (PanelToplevel *toplevel,
toplevel, toplevel->priv->grab_op);
cursor = gdk_cursor_new (cursor_type);
- gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
+ gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, cursor, time_);
gdk_cursor_unref (cursor);
if (grab_keyboard)
- gdk_keyboard_grab (gtk_widget_get_window (widget), FALSE, time_);
+ gdk_keyboard_grab (window, FALSE, time_);
}
static void
@@ -1689,11 +1691,11 @@ panel_toplevel_update_attached_position (PanelToplevel *toplevel,
int *w,
int *h)
{
+ GtkAllocation attach_allocation;
PanelOrientation attach_orientation;
GdkRectangle toplevel_box;
GdkRectangle parent_box;
GdkRectangle attach_box;
- GtkAllocation allocation;
int x_origin = 0, y_origin = 0;
int monitor_x, monitor_y;
int monitor_width, monitor_height;
@@ -1702,11 +1704,11 @@ panel_toplevel_update_attached_position (PanelToplevel *toplevel,
!gtk_widget_get_realized (toplevel->priv->attach_widget))
return;
+ gtk_widget_get_allocation (GTK_WIDGET (toplevel->priv->attach_widget), &attach_allocation);
+
toplevel_box = toplevel->priv->geometry;
parent_box = toplevel->priv->attach_toplevel->priv->geometry;
-
- gtk_widget_get_allocation (GTK_WIDGET (toplevel->priv->attach_widget), &allocation);
- attach_box = allocation;
+ attach_box = attach_allocation;
if (attach_box.x != -1) {
gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (toplevel->priv->attach_widget)),
@@ -1914,10 +1916,10 @@ panel_toplevel_update_hidden_position (PanelToplevel *toplevel,
int *w,
int *h)
{
- GtkAllocation allocation;
int width, height;
int min_hide_size;
int monitor_height, monitor_width;
+ GtkAllocation hide_allocation;
g_assert (x != NULL && y != NULL);
@@ -1942,20 +1944,24 @@ panel_toplevel_update_hidden_position (PanelToplevel *toplevel,
switch (toplevel->priv->state) {
case PANEL_STATE_HIDDEN_UP:
- gtk_widget_get_allocation (toplevel->priv->hide_button_bottom, &allocation);
- *y = - (height - MAX (allocation.height, min_hide_size));
+ gtk_widget_get_allocation (toplevel->priv->hide_button_bottom,
+ &hide_allocation);
+ *y = - (height - MAX (hide_allocation.height, min_hide_size));
break;
case PANEL_STATE_HIDDEN_DOWN:
- gtk_widget_get_allocation (toplevel->priv->hide_button_top, &allocation);
- *y = monitor_height - MAX (allocation.height, min_hide_size);
+ gtk_widget_get_allocation (toplevel->priv->hide_button_top,
+ &hide_allocation);
+ *y = monitor_height - MAX (hide_allocation.height, min_hide_size);
break;
case PANEL_STATE_HIDDEN_LEFT:
- gtk_widget_get_allocation (toplevel->priv->hide_button_right, &allocation);
- *x = - (width - MAX (allocation.width, min_hide_size));
+ gtk_widget_get_allocation (toplevel->priv->hide_button_right,
+ &hide_allocation);
+ *x = - (width - MAX (hide_allocation.width, min_hide_size));
break;
case PANEL_STATE_HIDDEN_RIGHT:
- gtk_widget_get_allocation (toplevel->priv->hide_button_left, &allocation);
- *x = monitor_width - MAX (allocation.width, min_hide_size);
+ gtk_widget_get_allocation (toplevel->priv->hide_button_left,
+ &hide_allocation);
+ *x = monitor_width - MAX (hide_allocation.width, min_hide_size);
break;
default:
g_assert_not_reached ();
@@ -2308,8 +2314,8 @@ calculate_minimum_height (GtkWidget *widget,
int descent;
int thickness;
- context = gtk_widget_get_pango_context (widget);
style = gtk_widget_get_style (widget);
+ context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
style->font_desc,
pango_context_get_language (context));
@@ -2422,8 +2428,8 @@ static void
panel_toplevel_update_size (PanelToplevel *toplevel,
GtkRequisition *requisition)
{
- GtkStyle *style;
GtkWidget *widget;
+ GtkStyle *style;
int monitor_width, monitor_height;
int width, height;
int minimum_height;
@@ -2433,6 +2439,7 @@ panel_toplevel_update_size (PanelToplevel *toplevel,
return;
widget = GTK_WIDGET (toplevel);
+ style = gtk_widget_get_style (widget);
panel_toplevel_get_monitor_geometry (
toplevel, NULL, NULL, &monitor_width, &monitor_height);
@@ -2510,7 +2517,6 @@ panel_toplevel_update_size (PanelToplevel *toplevel,
height = MAX (MINIMUM_WIDTH, height);
}
- style = gtk_widget_get_style (widget);
if (toplevel->priv->edges & PANEL_EDGE_TOP)
height += style->ythickness;
if (toplevel->priv->edges & PANEL_EDGE_BOTTOM)
@@ -2954,8 +2960,8 @@ panel_toplevel_initially_hide (PanelToplevel *toplevel)
static void
panel_toplevel_realize (GtkWidget *widget)
{
- GdkWindow *window;
PanelToplevel *toplevel = (PanelToplevel *) widget;
+ GdkWindow *window;
gtk_window_set_decorated (GTK_WINDOW (widget), FALSE);
gtk_window_stick (GTK_WINDOW (widget));
@@ -2963,9 +2969,9 @@ panel_toplevel_realize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->realize)
GTK_WIDGET_CLASS (panel_toplevel_parent_class)->realize (widget);
- panel_struts_set_window_hint (toplevel);
-
window = gtk_widget_get_window (widget);
+
+ panel_struts_set_window_hint (toplevel);
panel_xutils_set_window_type (window, PANEL_XUTILS_TYPE_DOCK);
gdk_window_set_group (window, window);
@@ -3037,8 +3043,8 @@ panel_toplevel_check_resize (GtkContainer *container)
requisition.height = -1;
gtk_widget_size_request (widget, &requisition);
-
gtk_widget_get_allocation (widget, &widget_allocation);
+
if (widget_allocation.width != requisition.width ||
widget_allocation.height != requisition.height)
return;
@@ -3053,8 +3059,8 @@ panel_toplevel_size_request (GtkWidget *widget,
{
PanelToplevel *toplevel;
GtkBin *bin;
- GdkRectangle old_geometry;
GtkWidget *child;
+ GdkRectangle old_geometry;
int position_changed = FALSE;
int size_changed = FALSE;
@@ -3096,10 +3102,10 @@ panel_toplevel_size_allocate (GtkWidget *widget,
{
PanelToplevel *toplevel = (PanelToplevel *) widget;
GtkBin *bin = (GtkBin *) widget;
- GtkAllocation challoc;
- GtkAllocation child_allocation;
GtkStyle *style;
GtkWidget *child;
+ GtkAllocation challoc;
+ GtkAllocation child_allocation;
gtk_widget_set_allocation (widget, allocation);
@@ -3143,8 +3149,8 @@ panel_toplevel_size_allocate (GtkWidget *widget,
challoc.height = MAX (1, challoc.height);
child = gtk_bin_get_child (bin);
-
gtk_widget_get_allocation (child, &child_allocation);
+
if (gtk_widget_get_mapped (widget) &&
(challoc.x != child_allocation.x ||
challoc.y != child_allocation.y ||
@@ -3160,13 +3166,13 @@ static gboolean
panel_toplevel_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- GdkWindow *window;
- GtkAllocation allocation;
- GtkStateType state;
- GtkStyle *style;
PanelToplevel *toplevel = (PanelToplevel *) widget;
PanelFrameEdge edges;
gboolean retval = FALSE;
+ GdkWindow *window;
+ GtkStyle *style;
+ GtkStateType state;
+ GtkAllocation allocation;
if (!gtk_widget_is_drawable (widget))
return retval;
@@ -3182,10 +3188,10 @@ panel_toplevel_expose (GtkWidget *widget,
toplevel->priv->attached)
return retval;
- gtk_widget_get_allocation (widget, &allocation);
- state = gtk_widget_get_state (widget);
- style = gtk_widget_get_style (widget);
window = gtk_widget_get_window (widget);
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
+ gtk_widget_get_allocation (widget, &allocation);
if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) {
int x, y, width, height;
@@ -3208,8 +3214,7 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_LEFT)
x += xthickness;
- gtk_paint_handle (style, window,
- state,
+ gtk_paint_handle (style, window, state,
GTK_SHADOW_OUT,
&event->area, widget, "handlebox",
x, y, width, height,
@@ -3219,8 +3224,7 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_RIGHT)
x -= xthickness;
- gtk_paint_handle (style, window,
- state,
+ gtk_paint_handle (style, window, state,
GTK_SHADOW_OUT,
&event->area, widget, "handlebox",
x, y, width, height,
@@ -3246,8 +3250,7 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_TOP)
y += ythickness;
- gtk_paint_handle (style, window,
- state,
+ gtk_paint_handle (style, window, state,
GTK_SHADOW_OUT,
&event->area, widget, "handlebox",
x, y, width, height,
@@ -3257,8 +3260,7 @@ panel_toplevel_expose (GtkWidget *widget,
if (edges & PANEL_EDGE_BOTTOM)
y -= ythickness;
- gtk_paint_handle (style, window,
- state,
+ gtk_paint_handle (style, window, state,
GTK_SHADOW_OUT,
&event->area, widget, "handlebox",
x, y, width, height,
diff --git a/gnome-panel/panel-util.c b/gnome-panel/panel-util.c
index 7fe2973..8a5298b 100644
--- a/gnome-panel/panel-util.c
+++ b/gnome-panel/panel-util.c
@@ -96,15 +96,16 @@ panel_find_applet_index (GtkWidget *widget)
void
panel_push_window_busy (GtkWidget *window)
{
- GdkWindow *win;
-
int busy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
"Panel:WindowBusy"));
busy ++;
if (busy == 1) {
+ GdkWindow *win;
+
gtk_widget_set_sensitive (window, FALSE);
+
win = gtk_widget_get_window (window);
if (win != NULL) {
GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
@@ -121,17 +122,19 @@ panel_push_window_busy (GtkWidget *window)
void
panel_pop_window_busy (GtkWidget *window)
{
- GdkWindow *win;
-
int busy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
"Panel:WindowBusy"));
busy --;
if (busy <= 0) {
+ GdkWindow *win;
+
gtk_widget_set_sensitive (window, TRUE);
+
win = gtk_widget_get_window (window);
if (win != NULL)
gdk_window_set_cursor (win, NULL);
+
g_object_set_data (G_OBJECT (window),
"Panel:WindowBusy", NULL);
} else {
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index c80b756..a594114 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -1309,8 +1309,8 @@ static void
panel_widget_set_background_region (PanelWidget *panel)
{
GtkWidget *widget;
- GtkAllocation allocation;
- int origin_x = -1, origin_y = -1;
+ int origin_x = -1, origin_y = -1;
+ GtkAllocation allocation;
widget = GTK_WIDGET (panel);
@@ -1526,10 +1526,10 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
gboolean
panel_widget_is_cursor(PanelWidget *panel, int overlap)
{
- int x,y;
- int w,h;
- GtkAllocation allocation;
GtkWidget *widget;
+ GtkAllocation allocation;
+ int x,y;
+ int w,h;
g_return_val_if_fail(PANEL_IS_WIDGET(panel),FALSE);
@@ -1541,6 +1541,7 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap)
return FALSE;
gtk_widget_get_pointer(widget, &x, &y);
+
gtk_widget_get_allocation (widget, &allocation);
w = allocation.width;
h = allocation.height;
@@ -1557,34 +1558,36 @@ static void
panel_widget_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
- GtkStateType state;
GtkStyle *style;
+ GtkStateType state;
- state = gtk_widget_get_state (widget);
- style = gtk_widget_get_style (widget);
+ if (gtk_widget_get_realized (widget)) {
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
- if (gtk_widget_get_realized (widget))
panel_background_set_default_style (
&PANEL_WIDGET (widget)->background,
&style->bg [state],
style->bg_pixmap [state]);
+ }
}
static void
panel_widget_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
- GtkStateType state;
GtkStyle *style;
+ GtkStateType state;
- state = gtk_widget_get_state (widget);
- style = gtk_widget_get_style (widget);
+ if (gtk_widget_get_realized (widget)) {
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
- if (gtk_widget_get_realized (widget))
panel_background_set_default_style (
&PANEL_WIDGET (widget)->background,
&style->bg [state],
style->bg_pixmap [state]);
+ }
}
static gboolean
@@ -1600,13 +1603,10 @@ toplevel_configure_event (GtkWidget *widget,
static void
panel_widget_realize (GtkWidget *widget)
{
+ PanelWidget *panel = (PanelWidget *) widget;
GdkWindow *window;
- GtkStateType state;
GtkStyle *style;
- PanelWidget *panel = (PanelWidget *) widget;
-
- state = gtk_widget_get_state (widget);
- style = gtk_widget_get_style (widget);
+ GtkStateType state;
g_signal_connect (panel->toplevel, "configure-event",
G_CALLBACK (toplevel_configure_event), panel);
@@ -1614,6 +1614,8 @@ panel_widget_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (panel_widget_parent_class)->realize (widget);
window = gtk_widget_get_window (widget);
+ style = gtk_widget_get_style (widget);
+ state = gtk_widget_get_state (widget);
/* For auto-hidden panels with a colored background, we need native
* windows to avoid some uglyness on unhide */
@@ -2172,8 +2174,8 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
static int
move_timeout_handler(gpointer data)
{
- GtkAllocation allocation;
PanelWidget *panel = data;
+
g_return_val_if_fail(PANEL_IS_WIDGET(data),FALSE);
if(been_moved &&
@@ -2185,13 +2187,15 @@ move_timeout_handler(gpointer data)
been_moved = FALSE;
if(panel->currently_dragged_applet && repeat_if_outside) {
- int x,y;
- int w,h;
- GtkWidget *widget;
+ GtkWidget *widget;
+ GtkAllocation allocation;
+ int x,y;
+ int w,h;
widget = panel->currently_dragged_applet->applet;
gtk_widget_get_pointer(widget, &x, &y);
+
gtk_widget_get_allocation (widget, &allocation);
w = allocation.width;
h = allocation.height;
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index 273585e..b112d79 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -724,8 +724,8 @@ static gboolean
move_applet (PanelWidget *panel, int pos, int applet_index)
{
GSList *applet_list;
- GtkWidget *parent;
AppletInfo *info;
+ GtkWidget *parent;
applet_list = panel_applet_list_applets ();
@@ -1058,8 +1058,8 @@ panel_receive_dnd_data (PanelWidget *panel,
GdkDragContext *context,
guint time_)
{
- gboolean success = FALSE;
- guchar *data;
+ const guchar *data;
+ gboolean success = FALSE;
if (panel_lockdown_get_locked_down ()) {
gtk_drag_finish (context, FALSE, FALSE, time_);
@@ -1252,8 +1252,10 @@ panel_is_applet_right_stick (GtkWidget *applet)
GtkWidget *parent;
PanelWidget *panel_widget;
- parent = gtk_widget_get_parent (applet);
g_return_val_if_fail (GTK_IS_WIDGET (applet), FALSE);
+
+ parent = gtk_widget_get_parent (applet);
+
g_return_val_if_fail (PANEL_IS_WIDGET (parent), FALSE);
panel_widget = PANEL_WIDGET (parent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]