[gnome-packagekit] Further trivial fixes to compile with GSEAL
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-packagekit] Further trivial fixes to compile with GSEAL
- Date: Tue, 9 Jun 2009 06:06:31 -0400 (EDT)
commit 33a66f4363f03af4805024537d831c6c7789f7f5
Author: Richard Hughes <richard hughsie com>
Date: Sun Jun 7 17:14:02 2009 +0100
Further trivial fixes to compile with GSEAL
---
src/gpk-application.c | 6 ++++--
src/gpk-cell-renderer-spinner.c | 36 +++++++++++++++++++++---------------
src/gpk-cell-renderer-spinner.h | 6 ++----
src/gpk-cell-renderer-uri.c | 2 +-
src/gpk-dialog.c | 20 +++++++++++++-------
src/gpk-modal-dialog.c | 10 +++-------
6 files changed, 44 insertions(+), 36 deletions(-)
diff --git a/src/gpk-application.c b/src/gpk-application.c
index a2c5370..2760d52 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -2081,7 +2081,8 @@ gpk_application_group_add_data (GpkApplication *application, PkGroupEnum group)
static void
gpk_application_popup_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
{
- GtkWidget *widget;
+ GtkWidget *widget;
+ GdkWindow *window;
GtkRequisition requisition;
gint menu_xpos = 0;
gint menu_ypos = 0;
@@ -2089,7 +2090,8 @@ gpk_application_popup_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *
widget = GTK_WIDGET (user_data);
/* find the location */
- gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
+ window = gtk_widget_get_window (widget);
+ gdk_window_get_origin (window, &menu_xpos, &menu_ypos);
gtk_widget_size_request (GTK_WIDGET (widget), &requisition);
/* set the position */
diff --git a/src/gpk-cell-renderer-spinner.c b/src/gpk-cell-renderer-spinner.c
index 5f25560..0b0511c 100644
--- a/src/gpk-cell-renderer-spinner.c
+++ b/src/gpk-cell-renderer-spinner.c
@@ -107,13 +107,11 @@ gpk_cell_renderer_spinner_class_init (GpkCellRendererSpinnerClass *klass)
static void
gpk_cell_renderer_spinner_init (GpkCellRendererSpinner *cell)
{
- GpkCellRendererSpinnerPrivate *priv = GPK_CELL_RENDERER_SPINNER_GET_PRIVATE (cell);
-
- priv->pulse = -1;
- priv->size = GTK_ICON_SIZE_MENU;
- priv->n_images = 0;
- priv->images = NULL;
- cell->priv = priv;
+ cell->priv = GPK_CELL_RENDERER_SPINNER_GET_PRIVATE (cell);
+ cell->priv->pulse = -1;
+ cell->priv->size = GTK_ICON_SIZE_MENU;
+ cell->priv->n_images = 0;
+ cell->priv->images = NULL;
}
GtkCellRenderer*
@@ -236,23 +234,27 @@ gpk_cell_renderer_spinner_get_size (GtkCellRenderer *cellr, GtkWidget *widget, G
GpkCellRendererSpinnerPrivate *priv = cell->priv;
gdouble align;
gint w, h;
+ gint xpad, ypad;
+ gfloat xalign, yalign;
gboolean rtl;
rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
gpk_cell_renderer_spinner_ensure_images (cell, widget);
- w = gdk_pixbuf_get_width (priv->images[0]) + 2 * cellr->xpad;
- h = gdk_pixbuf_get_height (priv->images[0]) + 2 * cellr->ypad;
+ gtk_misc_get_padding (GTK_MISC (cellr), &xpad, &ypad);
+ gtk_misc_get_alignment (GTK_MISC (cellr), &xalign, &yalign);
+ w = gdk_pixbuf_get_width (priv->images[0]) + 2 * xpad;
+ h = gdk_pixbuf_get_height (priv->images[0]) + 2 * ypad;
if (cell_area) {
if (x_offset) {
- align = rtl ? 1.0 - cellr->xalign : cellr->xalign;
+ align = rtl ? 1.0 - xalign : xalign;
*x_offset = align * (cell_area->width - w);
*x_offset = MAX (*x_offset, 0);
}
if (y_offset) {
- align = rtl ? 1.0 - cellr->yalign : cellr->yalign;
+ align = rtl ? 1.0 - yalign : yalign;
*y_offset = align * (cell_area->height - h);
*y_offset = MAX (*y_offset, 0);
}
@@ -279,6 +281,7 @@ gpk_cell_renderer_spinner_render (GtkCellRenderer *cellr, GdkWindow *window, Gtk
GdkRectangle pix_rect;
GdkRectangle draw_rect;
cairo_t *cr;
+ gint xpad, ypad;
if (priv->pulse < 0)
return;
@@ -287,10 +290,11 @@ gpk_cell_renderer_spinner_render (GtkCellRenderer *cellr, GdkWindow *window, Gtk
&pix_rect.x, &pix_rect.y,
&pix_rect.width, &pix_rect.height);
- pix_rect.x += cell_area->x + cellr->xpad;
- pix_rect.y += cell_area->y + cellr->ypad;
- pix_rect.width -= cellr->xpad * 2;
- pix_rect.height -= cellr->ypad * 2;
+ gtk_misc_get_padding (GTK_MISC (cellr), &xpad, &ypad);
+ pix_rect.x += cell_area->x + xpad;
+ pix_rect.y += cell_area->y + ypad;
+ pix_rect.width -= xpad * 2;
+ pix_rect.height -= ypad * 2;
if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) ||
!gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
@@ -302,6 +306,7 @@ gpk_cell_renderer_spinner_render (GtkCellRenderer *cellr, GdkWindow *window, Gtk
pixbuf = priv->images[1 + priv->pulse % (priv->n_images - 1)];
g_object_ref (pixbuf);
+#if 0
if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive) {
GtkIconSource *source;
@@ -324,6 +329,7 @@ gpk_cell_renderer_spinner_render (GtkCellRenderer *cellr, GdkWindow *window, Gtk
"gtkcellrendererpixbuf");
gtk_icon_source_free (source);
}
+#endif
cr = gdk_cairo_create (window);
diff --git a/src/gpk-cell-renderer-spinner.h b/src/gpk-cell-renderer-spinner.h
index 69ace39..a297bc9 100644
--- a/src/gpk-cell-renderer-spinner.h
+++ b/src/gpk-cell-renderer-spinner.h
@@ -38,10 +38,8 @@ typedef struct _GpkCellRendererSpinnerPrivate GpkCellRendererSpinnerPrivate;
struct _GpkCellRendererSpinner
{
- GtkCellRenderer parent_instance;
-
- /*< private >*/
- GpkCellRendererSpinnerPrivate *GSEAL (priv);
+ GtkCellRenderer parent;
+ GpkCellRendererSpinnerPrivate *priv;
};
struct _GpkCellRendererSpinnerClass
diff --git a/src/gpk-cell-renderer-uri.c b/src/gpk-cell-renderer-uri.c
index cb0552d..7904b96 100644
--- a/src/gpk-cell-renderer-uri.c
+++ b/src/gpk-cell-renderer-uri.c
@@ -183,7 +183,7 @@ gpk_cell_renderer_uri_render (GtkCellRenderer *cell,
cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
else
cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
- gdk_window_set_cursor (widget->window, cursor);
+ gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
ret = gpk_cell_renderer_uri_is_clicked (cru);
diff --git a/src/gpk-dialog.c b/src/gpk-dialog.c
index da8c8f9..7685114 100644
--- a/src/gpk-dialog.c
+++ b/src/gpk-dialog.c
@@ -201,7 +201,9 @@ gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 150);
}
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), scroll);
+ /* add scrolled window */
+ widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
+ gtk_container_add (GTK_CONTAINER (widget), scroll);
/* free the store */
g_signal_connect (G_OBJECT (dialog), "unrealize",
@@ -254,7 +256,9 @@ gpk_dialog_embed_file_list_widget (GtkDialog *dialog, GPtrArray *files)
gtk_container_set_border_width (GTK_CONTAINER (scroll), 6);
gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 300);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), scroll);
+ /* add scrolled window */
+ widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
+ gtk_container_add (GTK_CONTAINER (widget), scroll);
g_free (text);
return TRUE;
@@ -283,22 +287,24 @@ gpk_client_checkbutton_show_depends_cb (GtkWidget *widget, const gchar *key)
gboolean
gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog, const gchar *key)
{
+ GtkWidget *check_button;
GtkWidget *widget;
gboolean checked;
GConfClient *gconf_client;
/* add a checkbutton for deps screen */
- widget = gtk_check_button_new_with_label (_("Do not show this again"));
- g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_checkbutton_show_depends_cb), (gpointer) key);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ check_button = gtk_check_button_new_with_label (_("Do not show this again"));
+ g_signal_connect (check_button, "clicked", G_CALLBACK (gpk_client_checkbutton_show_depends_cb), (gpointer) key);
+ widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
+ gtk_container_add (GTK_CONTAINER (widget), check_button);
/* checked? */
gconf_client = gconf_client_get_default ();
checked = gconf_client_get_bool (gconf_client, key, NULL);
g_object_unref (gconf_client);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !checked);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), !checked);
- gtk_widget_show (widget);
+ gtk_widget_show (check_button);
return TRUE;
}
diff --git a/src/gpk-modal-dialog.c b/src/gpk-modal-dialog.c
index 160b5db..4fe4802 100644
--- a/src/gpk-modal-dialog.c
+++ b/src/gpk-modal-dialog.c
@@ -214,6 +214,7 @@ gboolean
gpk_modal_dialog_set_parent (GpkModalDialog *dialog, GdkWindow *window)
{
GtkWidget *widget;
+ GdkWindow *window_ours;
g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
/* never set, and nothing now */
@@ -243,7 +244,8 @@ gpk_modal_dialog_set_parent (GpkModalDialog *dialog, GdkWindow *window)
widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->builder, "dialog_client"));
gtk_widget_realize (widget);
gtk_window_set_modal (GTK_WINDOW (widget), TRUE);
- gdk_window_set_transient_for (GTK_WIDGET (widget)->window, window);
+ window_ours = gtk_widget_get_window (widget);
+ gdk_window_set_transient_for (window_ours, window);
dialog->priv->has_parent = TRUE;
return TRUE;
}
@@ -367,12 +369,6 @@ gpk_modal_dialog_pulse_progress (GpkModalDialog *dialog)
widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->builder, "progressbar_percent"));
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (widget));
-
- /* if there's no slider, optimise out the polling */
- if (!GTK_WIDGET_VISIBLE (widget)) {
- dialog->priv->pulse_timer_id = 0;
- return FALSE;
- }
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]