[gtk+] Silence new gcc warnings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Silence new gcc warnings
- Date: Mon, 24 Jan 2011 02:51:41 +0000 (UTC)
commit d9fcc4c630f3668dd014c258c2deb22d61e438d0
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 23 21:50:39 2011 -0500
Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
gtk/gtkassistant.c | 714 ++++++++++----------
gtk/gtkbbox.c | 2 -
gtk/gtkbutton.c | 2 -
gtk/gtkcalendar.c | 1331 ++++++++++++++++++------------------
gtk/gtkcellarea.c | 5 +-
gtk/gtkcellareaboxcontext.c | 2 -
gtk/gtkcellrenderer.c | 8 +-
gtk/gtkcellrendererspinner.c | 4 +-
gtk/gtkcellrenderertext.c | 32 +-
gtk/gtkcheckmenuitem.c | 3 -
gtk/gtkcolorsel.c | 1447 ++++++++++++++++++++--------------------
gtk/gtkcontainer.c | 1022 ++++++++++++++--------------
gtk/gtkcssprovider.c | 2 -
gtk/gtkcustompaperunixdialog.c | 2 -
gtk/gtkentry.c | 13 +-
gtk/gtkfilechooserbutton.c | 130 ++--
gtk/gtkfilechooserdefault.c | 140 ++---
gtk/gtkfilechooserentry.c | 113 ++--
gtk/gtkfontsel.c | 20 +-
gtk/gtkhandlebox.c | 52 +-
gtk/gtkhsv.c | 4 +-
gtk/gtkiconfactory.c | 83 +--
gtk/gtkiconview.c | 135 ++--
gtk/gtkinfobar.c | 12 +-
gtk/gtklabel.c | 42 +-
gtk/gtkliststore.c | 6 +-
gtk/gtkmenu.c | 19 +-
gtk/gtkmenuitem.c | 2 -
gtk/gtkmountoperation-x11.c | 3 -
gtk/gtknotebook.c | 60 +-
gtk/gtkoffscreenwindow.c | 3 -
gtk/gtkpapersize.c | 18 +-
gtk/gtkpathbar.c | 34 +-
gtk/gtkprintcontext.c | 8 +-
gtk/gtkradiobutton.c | 8 +-
gtk/gtkrange.c | 80 +--
gtk/gtkrecentmanager.c | 45 +-
gtk/gtkscale.c | 11 +-
gtk/gtkscalebutton.c | 39 +-
gtk/gtkscrolledwindow.c | 6 +-
gtk/gtkseparator.c | 8 +-
gtk/gtkspinner.c | 2 -
gtk/gtkstatusbar.c | 18 +-
gtk/gtkstylecontext.c | 7 +-
gtk/gtktearoffmenuitem.c | 84 ++--
gtk/gtkthemingengine.c | 59 +-
gtk/gtktimeline.c | 2 -
gtk/gtktoolbar.c | 359 +++++-----
gtk/gtktoolitemgroup.c | 23 +-
gtk/gtktooltip.c | 21 +-
gtk/gtktreemodelfilter.c | 8 +-
gtk/gtktreeview.c | 19 +-
gtk/gtkwidget.c | 333 +++++-----
gtk/gtkwindow.c | 57 +-
gtk/queryimmodules.c | 6 -
gtk/updateiconcache.c | 166 +++---
56 files changed, 3319 insertions(+), 3515 deletions(-)
---
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 7cedc51..e4ef82c 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -1,4 +1,4 @@
-/*
+/*
* GTK - The GIMP Toolkit
* Copyright (C) 1999 Red Hat, Inc.
* Copyright (C) 2002 Anders Carlsson <andersca gnu org>
@@ -134,33 +134,33 @@ static void gtk_assistant_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_assistant_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ GtkAllocation *allocation);
static void gtk_assistant_map (GtkWidget *widget);
static void gtk_assistant_unmap (GtkWidget *widget);
static gboolean gtk_assistant_delete_event (GtkWidget *widget,
- GdkEventAny *event);
+ GdkEventAny *event);
static gboolean gtk_assistant_draw (GtkWidget *widget,
- cairo_t *cr);
+ cairo_t *cr);
static gboolean gtk_assistant_focus (GtkWidget *widget,
- GtkDirectionType direction);
+ GtkDirectionType direction);
static void gtk_assistant_add (GtkContainer *container,
- GtkWidget *page);
+ GtkWidget *page);
static void gtk_assistant_remove (GtkContainer *container,
- GtkWidget *page);
+ GtkWidget *page);
static void gtk_assistant_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static void gtk_assistant_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ GtkWidget *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gtk_assistant_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ GtkWidget *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static AtkObject *gtk_assistant_get_accessible (GtkWidget *widget);
static GType gtk_assistant_accessible_factory_get_type (void);
@@ -250,13 +250,13 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
signals[CANCEL] =
g_signal_new (I_("cancel"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkAssistantClass, cancel),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkAssistantClass, cancel),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
/**
* GtkAssistant::prepare:
* @assistant: the #GtkAssistant
@@ -270,12 +270,12 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
signals[PREPARE] =
g_signal_new (I_("prepare"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkAssistantClass, prepare),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkAssistantClass, prepare),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
/**
* GtkAssistant::apply:
@@ -295,12 +295,12 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
signals[APPLY] =
g_signal_new (I_("apply"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkAssistantClass, apply),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkAssistantClass, apply),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkAssistant::close:
@@ -314,29 +314,29 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
signals[CLOSE] =
g_signal_new (I_("close"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkAssistantClass, close),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkAssistantClass, close),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("header-padding",
- P_("Header Padding"),
- P_("Number of pixels around the header."),
- 0,
- G_MAXINT,
- 6,
- GTK_PARAM_READABLE));
+ g_param_spec_int ("header-padding",
+ P_("Header Padding"),
+ P_("Number of pixels around the header."),
+ 0,
+ G_MAXINT,
+ 6,
+ GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("content-padding",
- P_("Content Padding"),
- P_("Number of pixels around the content pages."),
- 0,
- G_MAXINT,
- 1,
- GTK_PARAM_READABLE));
+ g_param_spec_int ("content-padding",
+ P_("Content Padding"),
+ P_("Number of pixels around the content pages."),
+ 0,
+ G_MAXINT,
+ 1,
+ GTK_PARAM_READABLE));
/**
* GtkAssistant:page-type:
@@ -346,13 +346,13 @@ gtk_assistant_class_init (GtkAssistantClass *class)
* Since: 2.10
*/
gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PAGE_TYPE,
- g_param_spec_enum ("page-type",
- P_("Page type"),
- P_("The type of the assistant page"),
- GTK_TYPE_ASSISTANT_PAGE_TYPE,
- GTK_ASSISTANT_PAGE_CONTENT,
- GTK_PARAM_READWRITE));
+ CHILD_PROP_PAGE_TYPE,
+ g_param_spec_enum ("page-type",
+ P_("Page type"),
+ P_("The type of the assistant page"),
+ GTK_TYPE_ASSISTANT_PAGE_TYPE,
+ GTK_ASSISTANT_PAGE_CONTENT,
+ GTK_PARAM_READWRITE));
/**
* GtkAssistant:title:
@@ -364,12 +364,12 @@ gtk_assistant_class_init (GtkAssistantClass *class)
* Since: 2.10
*/
gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PAGE_TITLE,
- g_param_spec_string ("title",
- P_("Page title"),
- P_("The title of the assistant page"),
- NULL,
- GTK_PARAM_READWRITE));
+ CHILD_PROP_PAGE_TITLE,
+ g_param_spec_string ("title",
+ P_("Page title"),
+ P_("The title of the assistant page"),
+ NULL,
+ GTK_PARAM_READWRITE));
/**
* GtkAssistant:header-image:
@@ -381,12 +381,12 @@ gtk_assistant_class_init (GtkAssistantClass *class)
* Since: 2.10
*/
gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PAGE_HEADER_IMAGE,
- g_param_spec_object ("header-image",
- P_("Header image"),
- P_("Header image for the assistant page"),
- GDK_TYPE_PIXBUF,
- GTK_PARAM_READWRITE));
+ CHILD_PROP_PAGE_HEADER_IMAGE,
+ g_param_spec_object ("header-image",
+ P_("Header image"),
+ P_("Header image for the assistant page"),
+ GDK_TYPE_PIXBUF,
+ GTK_PARAM_READWRITE));
/**
* GtkAssistant:header-image:
@@ -398,12 +398,12 @@ gtk_assistant_class_init (GtkAssistantClass *class)
* Since: 2.10
*/
gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PAGE_SIDEBAR_IMAGE,
- g_param_spec_object ("sidebar-image",
- P_("Sidebar image"),
- P_("Sidebar image for the assistant page"),
- GDK_TYPE_PIXBUF,
- GTK_PARAM_READWRITE));
+ CHILD_PROP_PAGE_SIDEBAR_IMAGE,
+ g_param_spec_object ("sidebar-image",
+ P_("Sidebar image"),
+ P_("Sidebar image for the assistant page"),
+ GDK_TYPE_PIXBUF,
+ GTK_PARAM_READWRITE));
/**
* GtkAssistant:complete:
*
@@ -412,14 +412,14 @@ gtk_assistant_class_init (GtkAssistantClass *class)
* to control the sensitivity of the navigation buttons.
*
* Since: 2.10
- **/
+ */
gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PAGE_COMPLETE,
- g_param_spec_boolean ("complete",
- P_("Page complete"),
- P_("Whether all required fields on the page have been filled out"),
- FALSE,
- G_PARAM_READWRITE));
+ CHILD_PROP_PAGE_COMPLETE,
+ g_param_spec_boolean ("complete",
+ P_("Page complete"),
+ P_("Whether all required fields on the page have been filled out"),
+ FALSE,
+ G_PARAM_READWRITE));
g_type_class_add_private (gobject_class, sizeof (GtkAssistantPrivate));
}
@@ -448,7 +448,7 @@ default_forward_function (gint current_page, gpointer data)
current_page++;
if (page_node)
- page_info = (GtkAssistantPage *) page_node->data;
+ page_info = (GtkAssistantPage *) page_node->data;
}
return current_page;
@@ -467,9 +467,9 @@ compute_last_button_state (GtkAssistant *assistant)
current_page_info = page_info = g_list_nth_data (priv->pages, page_num);
while (page_num >= 0 && page_num < n_pages &&
- page_info->type == GTK_ASSISTANT_PAGE_CONTENT &&
- (count == 0 || page_info->complete) &&
- count < n_pages)
+ page_info->type == GTK_ASSISTANT_PAGE_CONTENT &&
+ (count == 0 || page_info->complete) &&
+ count < n_pages)
{
page_num = (priv->forward_function) (page_num, priv->forward_function_data);
page_info = g_list_nth_data (priv->pages, page_num);
@@ -486,7 +486,7 @@ compute_last_button_state (GtkAssistant *assistant)
{
gtk_widget_show (priv->last);
gtk_widget_set_sensitive (priv->last,
- current_page_info->complete);
+ current_page_info->complete);
}
else
gtk_widget_hide (priv->last);
@@ -515,7 +515,7 @@ set_assistant_header_image (GtkAssistant *assistant)
GtkAssistantPrivate *priv = assistant->priv;
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->header_image),
- priv->current_page->header_image);
+ priv->current_page->header_image);
}
static void
@@ -524,7 +524,7 @@ set_assistant_sidebar_image (GtkAssistant *assistant)
GtkAssistantPrivate *priv = assistant->priv;
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->sidebar_image),
- priv->current_page->sidebar_image);
+ priv->current_page->sidebar_image);
if (priv->current_page->sidebar_image)
gtk_widget_show (priv->sidebar_image);
@@ -539,7 +539,7 @@ set_assistant_buttons_state (GtkAssistant *assistant)
if (!priv->current_page)
return;
-
+
switch (priv->current_page->type)
{
case GTK_ASSISTANT_PAGE_INTRO:
@@ -615,14 +615,15 @@ set_assistant_buttons_state (GtkAssistant *assistant)
gtk_widget_show (priv->cancel);
/* this is quite general, we don't want to
- * go back if it's the first page */
+ * go back if it's the first page
+ */
if (!priv->visited_pages)
gtk_widget_hide (priv->back);
}
static void
set_current_page (GtkAssistant *assistant,
- GtkAssistantPage *page)
+ GtkAssistantPage *page)
{
GtkAssistantPrivate *priv = assistant->priv;
GtkAssistantPage *old_page;
@@ -641,14 +642,15 @@ set_current_page (GtkAssistant *assistant,
g_signal_emit (assistant, signals [PREPARE], 0, priv->current_page->page);
- if (gtk_widget_get_visible (priv->current_page->page) && gtk_widget_get_mapped (GTK_WIDGET (assistant)))
+ if (gtk_widget_get_visible (priv->current_page->page) &&
+ gtk_widget_get_mapped (GTK_WIDGET (assistant)))
{
gtk_widget_set_child_visible (priv->current_page->page, TRUE);
gtk_widget_set_child_visible (priv->current_page->title, TRUE);
gtk_widget_map (priv->current_page->page);
gtk_widget_map (priv->current_page->title);
}
-
+
if (old_page && gtk_widget_get_mapped (old_page->page))
{
gtk_widget_set_child_visible (old_page->page, FALSE);
@@ -671,7 +673,8 @@ set_current_page (GtkAssistant *assistant,
button[5] = priv->last;
for (i = 0; i < 6; i++)
{
- if (gtk_widget_get_visible (button[i]) && gtk_widget_get_sensitive (button[i]))
+ if (gtk_widget_get_visible (button[i]) &&
+ gtk_widget_get_sensitive (button[i]))
{
gtk_widget_grab_focus (button[i]);
break;
@@ -694,7 +697,7 @@ compute_next_step (GtkAssistant *assistant)
n_pages = gtk_assistant_get_n_pages (assistant);
next_page = (priv->forward_function) (current_page,
- priv->forward_function_data);
+ priv->forward_function_data);
if (next_page >= 0 && next_page < n_pages)
{
@@ -759,7 +762,7 @@ on_assistant_last (GtkWidget *widget,
GtkAssistantPrivate *priv = assistant->priv;
while (priv->current_page->type == GTK_ASSISTANT_PAGE_CONTENT &&
- priv->current_page->complete)
+ priv->current_page->complete)
compute_next_step (assistant);
}
@@ -774,8 +777,8 @@ alternative_button_order (GtkAssistant *assistant)
settings = gtk_settings_get_for_screen (screen);
g_object_get (settings,
- "gtk-alternative-button-order", &result,
- NULL);
+ "gtk-alternative-button-order", &result,
+ NULL);
return result;
}
@@ -870,47 +873,47 @@ gtk_assistant_init (GtkAssistant *assistant)
priv->forward_data_destroy = NULL;
g_signal_connect (G_OBJECT (priv->close), "clicked",
- G_CALLBACK (on_assistant_close), assistant);
+ G_CALLBACK (on_assistant_close), assistant);
g_signal_connect (G_OBJECT (priv->apply), "clicked",
- G_CALLBACK (on_assistant_apply), assistant);
+ G_CALLBACK (on_assistant_apply), assistant);
g_signal_connect (G_OBJECT (priv->forward), "clicked",
- G_CALLBACK (on_assistant_forward), assistant);
+ G_CALLBACK (on_assistant_forward), assistant);
g_signal_connect (G_OBJECT (priv->back), "clicked",
- G_CALLBACK (on_assistant_back), assistant);
+ G_CALLBACK (on_assistant_back), assistant);
g_signal_connect (G_OBJECT (priv->cancel), "clicked",
- G_CALLBACK (on_assistant_cancel), assistant);
+ G_CALLBACK (on_assistant_cancel), assistant);
g_signal_connect (G_OBJECT (priv->last), "clicked",
- G_CALLBACK (on_assistant_last), assistant);
+ G_CALLBACK (on_assistant_last), assistant);
}
static void
gtk_assistant_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ GtkWidget *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (property_id)
{
case CHILD_PROP_PAGE_TYPE:
gtk_assistant_set_page_type (GTK_ASSISTANT (container), child,
- g_value_get_enum (value));
+ g_value_get_enum (value));
break;
case CHILD_PROP_PAGE_TITLE:
gtk_assistant_set_page_title (GTK_ASSISTANT (container), child,
- g_value_get_string (value));
+ g_value_get_string (value));
break;
case CHILD_PROP_PAGE_HEADER_IMAGE:
gtk_assistant_set_page_header_image (GTK_ASSISTANT (container), child,
- g_value_get_object (value));
+ g_value_get_object (value));
break;
case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
gtk_assistant_set_page_side_image (GTK_ASSISTANT (container), child,
- g_value_get_object (value));
+ g_value_get_object (value));
break;
case CHILD_PROP_PAGE_COMPLETE:
gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
@@ -920,32 +923,32 @@ gtk_assistant_set_child_property (GtkContainer *container,
static void
gtk_assistant_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ GtkWidget *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (property_id)
{
case CHILD_PROP_PAGE_TYPE:
g_value_set_enum (value,
- gtk_assistant_get_page_type (GTK_ASSISTANT (container), child));
+ gtk_assistant_get_page_type (GTK_ASSISTANT (container), child));
break;
case CHILD_PROP_PAGE_TITLE:
g_value_set_string (value,
- gtk_assistant_get_page_title (GTK_ASSISTANT (container), child));
+ gtk_assistant_get_page_title (GTK_ASSISTANT (container), child));
break;
case CHILD_PROP_PAGE_HEADER_IMAGE:
g_value_set_object (value,
- gtk_assistant_get_page_header_image (GTK_ASSISTANT (container), child));
+ gtk_assistant_get_page_header_image (GTK_ASSISTANT (container), child));
break;
case CHILD_PROP_PAGE_SIDEBAR_IMAGE:
g_value_set_object (value,
- gtk_assistant_get_page_side_image (GTK_ASSISTANT (container), child));
+ gtk_assistant_get_page_side_image (GTK_ASSISTANT (container), child));
break;
case CHILD_PROP_PAGE_COMPLETE:
g_value_set_boolean (value,
- gtk_assistant_get_page_complete (GTK_ASSISTANT (container), child));
+ gtk_assistant_get_page_complete (GTK_ASSISTANT (container), child));
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
@@ -955,8 +958,8 @@ gtk_assistant_get_child_property (GtkContainer *container,
static void
on_page_notify_visibility (GtkWidget *widget,
- GParamSpec *arg,
- gpointer data)
+ GParamSpec *arg,
+ gpointer data)
{
GtkAssistant *assistant = GTK_ASSISTANT (data);
@@ -966,8 +969,8 @@ on_page_notify_visibility (GtkWidget *widget,
}
static void
-remove_page (GtkAssistant *assistant,
- GList *element)
+remove_page (GtkAssistant *assistant,
+ GList *element)
{
GtkAssistantPrivate *priv = assistant->priv;
GtkAssistantPage *page_info;
@@ -980,21 +983,22 @@ remove_page (GtkAssistant *assistant,
{
if (!compute_next_step (assistant))
{
- /* The best we can do at this point is probably to pick the first
- * visible page.
- */
- page_node = priv->pages;
+ /* The best we can do at this point is probably to pick
+ * the first visible page.
+ */
+ page_node = priv->pages;
- while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
- page_node = page_node->next;
+ while (page_node &&
+ !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
+ page_node = page_node->next;
if (page_node == element)
page_node = page_node->next;
- if (page_node)
- priv->current_page = page_node->data;
- else
- priv->current_page = NULL;
+ if (page_node)
+ priv->current_page = page_node->data;
+ else
+ priv->current_page = NULL;
}
}
@@ -1048,8 +1052,8 @@ gtk_assistant_destroy (GtkWidget *widget)
if (priv->forward_function)
{
if (priv->forward_function_data &&
- priv->forward_data_destroy)
- priv->forward_data_destroy (priv->forward_function_data);
+ priv->forward_data_destroy)
+ priv->forward_data_destroy (priv->forward_function_data);
priv->forward_function = NULL;
priv->forward_function_data = NULL;
@@ -1074,26 +1078,26 @@ gtk_assistant_destroy (GtkWidget *widget)
static GList*
find_page (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPrivate *priv = assistant->priv;
GList *child = priv->pages;
-
+
while (child)
{
GtkAssistantPage *page_info = child->data;
if (page_info->page == page)
- return child;
+ return child;
child = child->next;
}
-
+
return NULL;
}
static void
set_title_font (GtkWidget *assistant,
- GtkWidget *title_label)
+ GtkWidget *title_label)
{
PangoFontDescription *desc;
GtkStyleContext *context;
@@ -1130,7 +1134,7 @@ gtk_assistant_style_updated (GtkWidget *widget)
static void
gtk_assistant_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+ GtkRequisition *requisition)
{
GtkAssistant *assistant = GTK_ASSISTANT (widget);
GtkAssistantPrivate *priv = assistant->priv;
@@ -1141,9 +1145,9 @@ gtk_assistant_size_request (GtkWidget *widget,
GList *list;
gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
+ "header-padding", &header_padding,
+ "content-padding", &content_padding,
+ NULL);
width = height = 0;
header_width = header_height = 0;
list = priv->pages;
@@ -1164,10 +1168,10 @@ gtk_assistant_size_request (GtkWidget *widget,
h = child_requisition.height;
if (page->header_image)
- {
- w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
- h = MAX (h, gdk_pixbuf_get_height (page->header_image));
- }
+ {
+ w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
+ h = MAX (h, gdk_pixbuf_get_height (page->header_image));
+ }
header_width = MAX (header_width, w);
header_height = MAX (header_height, h);
@@ -1225,7 +1229,7 @@ gtk_assistant_get_preferred_height (GtkWidget *widget,
static void
gtk_assistant_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+ GtkAllocation *allocation)
{
GtkAssistant *assistant = GTK_ASSISTANT (widget);
GtkAssistantPrivate *priv = assistant->priv;
@@ -1241,9 +1245,9 @@ gtk_assistant_size_allocate (GtkWidget *widget,
pages = priv->pages;
gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
+ "header-padding", &header_padding,
+ "content-padding", &content_padding,
+ NULL);
gtk_widget_set_allocation (widget, allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@@ -1304,7 +1308,7 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
if (!rtl)
- child_allocation.x += sidebar_image_allocation.width;
+ child_allocation.x += sidebar_image_allocation.width;
child_allocation.width -= sidebar_image_allocation.width;
}
@@ -1343,10 +1347,10 @@ gtk_assistant_map (GtkWidget *widget)
page_node = priv->pages;
while (page_node && !gtk_widget_get_visible (((GtkAssistantPage *) page_node->data)->page))
- page_node = page_node->next;
+ page_node = page_node->next;
if (page_node)
- page = page_node->data;
+ page = page_node->data;
}
if (page &&
@@ -1389,7 +1393,7 @@ gtk_assistant_unmap (GtkWidget *widget)
static gboolean
gtk_assistant_delete_event (GtkWidget *widget,
- GdkEventAny *event)
+ GdkEventAny *event)
{
GtkAssistant *assistant = GTK_ASSISTANT (widget);
GtkAssistantPrivate *priv = assistant->priv;
@@ -1421,9 +1425,9 @@ assistant_paint_colored_box (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
+ "header-padding", &header_padding,
+ "content-padding", &content_padding,
+ NULL);
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
@@ -1440,8 +1444,8 @@ assistant_paint_colored_box (GtkWidget *widget,
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr,
- border_width,
- border_width,
+ border_width,
+ border_width,
allocation.width - 2 * border_width,
allocation.height - action_area_allocation.height - 2 * border_width - ACTION_AREA_SPACING);
cairo_fill (cr);
@@ -1457,7 +1461,7 @@ assistant_paint_colored_box (GtkWidget *widget,
gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
if (!rtl)
- content_x += sidebar_image_allocation.width;
+ content_x += sidebar_image_allocation.width;
content_width -= sidebar_image_allocation.width;
}
@@ -1467,17 +1471,17 @@ assistant_paint_colored_box (GtkWidget *widget,
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr,
- content_x,
- header_image_allocation.height + content_padding + 2 * header_padding + border_width,
- content_width,
- allocation.height - 2 * border_width - action_area_allocation.height -
- header_image_allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
+ content_x,
+ header_image_allocation.height + content_padding + 2 * header_padding + border_width,
+ content_width,
+ allocation.height - 2 * border_width - action_area_allocation.height -
+ header_image_allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
cairo_fill (cr);
}
static gboolean
gtk_assistant_draw (GtkWidget *widget,
- cairo_t *cr)
+ cairo_t *cr)
{
GtkAssistant *assistant = GTK_ASSISTANT (widget);
GtkAssistantPrivate *priv = assistant->priv;
@@ -1503,7 +1507,7 @@ gtk_assistant_draw (GtkWidget *widget,
static gboolean
gtk_assistant_focus (GtkWidget *widget,
- GtkDirectionType direction)
+ GtkDirectionType direction)
{
GtkAssistantPrivate *priv;
GtkContainer *container;
@@ -1515,27 +1519,30 @@ gtk_assistant_focus (GtkWidget *widget,
if (gtk_container_get_focus_child (container) == priv->action_area)
{
if (!gtk_widget_child_focus (priv->action_area, direction) &&
- (priv->current_page == NULL ||
- !gtk_widget_child_focus (priv->current_page->page, direction)))
- {
- /* if we're leaving the action area and the current page hasn't
- any focusable widget, clear focus and go back to the action area */
- gtk_container_set_focus_child (GTK_CONTAINER (priv->action_area), NULL);
- gtk_widget_child_focus (priv->action_area, direction);
- }
+ (priv->current_page == NULL ||
+ !gtk_widget_child_focus (priv->current_page->page, direction)))
+ {
+ /* if we're leaving the action area and the current page has no
+ * focusable widget, clear focus and go back to the action area
+ */
+ gtk_container_set_focus_child (GTK_CONTAINER (priv->action_area), NULL);
+ gtk_widget_child_focus (priv->action_area, direction);
+ }
}
else
{
if ((priv->current_page == NULL ||
- !gtk_widget_child_focus (priv->current_page->page, direction)) &&
- !gtk_widget_child_focus (priv->action_area, direction))
- {
- /* if we're leaving the current page and there isn't nothing focusable
- in the action area, try to clear focus and go back to the page */
- gtk_window_set_focus (GTK_WINDOW (widget), NULL);
- if (priv->current_page != NULL)
- gtk_widget_child_focus (priv->current_page->page, direction);
- }
+ !gtk_widget_child_focus (priv->current_page->page, direction)) &&
+ !gtk_widget_child_focus (priv->action_area, direction))
+ {
+ /* if we're leaving the current page and there isn't nothing
+ * focusable in the action area, try to clear focus and go back
+ * to the page
+ */
+ gtk_window_set_focus (GTK_WINDOW (widget), NULL);
+ if (priv->current_page != NULL)
+ gtk_widget_child_focus (priv->current_page->page, direction);
+ }
}
return TRUE;
@@ -1543,14 +1550,14 @@ gtk_assistant_focus (GtkWidget *widget,
static void
gtk_assistant_add (GtkContainer *container,
- GtkWidget *page)
+ GtkWidget *page)
{
gtk_assistant_append_page (GTK_ASSISTANT (container), page);
}
static void
gtk_assistant_remove (GtkContainer *container,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistant *assistant = (GtkAssistant*) container;
GList *element;
@@ -1566,9 +1573,9 @@ gtk_assistant_remove (GtkContainer *container,
static void
gtk_assistant_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkAssistant *assistant = (GtkAssistant*) container;
GtkAssistantPrivate *priv = assistant->priv;
@@ -1590,7 +1597,7 @@ gtk_assistant_forall (GtkContainer *container,
(*callback) (page->page, callback_data);
if (include_internals)
- (*callback) (page->title, callback_data);
+ (*callback) (page->title, callback_data);
pages = pages->next;
}
@@ -1598,13 +1605,13 @@ gtk_assistant_forall (GtkContainer *container,
/**
* gtk_assistant_new:
- *
+ *
* Creates a new #GtkAssistant.
*
* Return value: a newly created #GtkAssistant
*
* Since: 2.10
- **/
+ */
GtkWidget*
gtk_assistant_new (void)
{
@@ -1621,11 +1628,12 @@ gtk_assistant_new (void)
*
* Returns the page number of the current page
*
- * Return value: The index (starting from 0) of the current page in
- * the @assistant, if the @assistant has no pages, -1 will be returned
+ * Return value: The index (starting from 0) of the current
+ * page in the @assistant, if the @assistant has no pages,
+ * -1 will be returned
*
* Since: 2.10
- **/
+ */
gint
gtk_assistant_get_current_page (GtkAssistant *assistant)
{
@@ -1645,19 +1653,21 @@ gtk_assistant_get_current_page (GtkAssistant *assistant)
* gtk_assistant_set_current_page:
* @assistant: a #GtkAssistant
* @page_num: index of the page to switch to, starting from 0.
- * If negative, the last page will be used. If greater
- * than the number of pages in the @assistant, nothing
- * will be done.
+ * If negative, the last page will be used. If greater
+ * than the number of pages in the @assistant, nothing
+ * will be done.
*
- * Switches the page to @page_num. Note that this will only be necessary
- * in custom buttons, as the @assistant flow can be set with
+ * Switches the page to @page_num.
+ *
+ * Note that this will only be necessary in custom buttons,
+ * as the @assistant flow can be set with
* gtk_assistant_set_forward_page_func().
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_current_page (GtkAssistant *assistant,
- gint page_num)
+ gint page_num)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page;
@@ -1676,14 +1686,13 @@ gtk_assistant_set_current_page (GtkAssistant *assistant,
if (priv->current_page == page)
return;
- /* only add the page to the visited list if the
- * assistant is mapped, if not, just use it as an
- * initial page setting, for the cases where the
- * initial page is != to 0
+ /* only add the page to the visited list if the assistant is mapped,
+ * if not, just use it as an initial page setting, for the cases where
+ * the initial page is != to 0
*/
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
priv->visited_pages = g_slist_prepend (priv->visited_pages,
- priv->current_page);
+ priv->current_page);
set_current_page (assistant, page);
}
@@ -1692,41 +1701,41 @@ gtk_assistant_set_current_page (GtkAssistant *assistant,
* gtk_assistant_next_page:
* @assistant: a #GtkAssistant
*
- * Navigate to the next page. It is a programming
- * error to call this function if there is no next page.
+ * Navigate to the next page.
+ *
+ * It is a programming error to call this function when
+ * there is no next page.
*
* This function is for use when creating pages of the
- * #GTK_ASSISTANT_PAGE_CUSTOM type.
+ * #GTK_ASSISTANT_PAGE_CUSTOM type.
*
* Since: 3.0
- **/
+ */
void
gtk_assistant_next_page (GtkAssistant *assistant)
{
- GtkAssistantPrivate *priv;
-
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
- priv = assistant->priv;
-
if (!compute_next_step (assistant))
- g_critical ("Page flow is broken, you may want to end it with a page of "
- "type GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
+ g_critical ("Page flow is broken.\n"
+ "You may want to end it with a page of type\n"
+ "GTK_ASSISTANT_PAGE_CONFIRM or GTK_ASSISTANT_PAGE_SUMMARY");
}
/**
* gtk_assistant_previous_page:
* @assistant: a #GtkAssistant
*
- * Navigate to the previous visited page. It is a programming
- * error to call this function if no previous page is
- * available.
+ * Navigate to the previous visited page.
+ *
+ * It is a programming error to call this function when
+ * no previous page is available.
*
* This function is for use when creating pages of the
- * #GTK_ASSISTANT_PAGE_CUSTOM type.
+ * #GTK_ASSISTANT_PAGE_CUSTOM type.
*
* Since: 3.0
- **/
+ */
void
gtk_assistant_previous_page (GtkAssistant *assistant)
{
@@ -1750,7 +1759,7 @@ gtk_assistant_previous_page (GtkAssistant *assistant)
g_slist_free_1 (page_node);
}
while (page_info->type == GTK_ASSISTANT_PAGE_PROGRESS ||
- !gtk_widget_get_visible (page_info->page));
+ !gtk_widget_get_visible (page_info->page));
set_current_page (assistant, page_info);
}
@@ -1761,10 +1770,10 @@ gtk_assistant_previous_page (GtkAssistant *assistant)
*
* Returns the number of pages in the @assistant
*
- * Return value: The number of pages in the @assistant.
+ * Return value: the number of pages in the @assistant
*
* Since: 2.10
- **/
+ */
gint
gtk_assistant_get_n_pages (GtkAssistant *assistant)
{
@@ -1780,18 +1789,19 @@ gtk_assistant_get_n_pages (GtkAssistant *assistant)
/**
* gtk_assistant_get_nth_page:
* @assistant: a #GtkAssistant
- * @page_num: The index of a page in the @assistant, or -1 to get the last page;
+ * @page_num: the index of a page in the @assistant,
+ * or -1 to get the last page
*
* Returns the child widget contained in page number @page_num.
*
- * Return value: (transfer none): The child widget, or %NULL
- * if @page_num is out of bounds.
+ * Return value: (transfer none): the child widget, or %NULL
+ * if @page_num is out of bounds
*
* Since: 2.10
- **/
+ */
GtkWidget*
gtk_assistant_get_nth_page (GtkAssistant *assistant,
- gint page_num)
+ gint page_num)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page;
@@ -1825,10 +1835,10 @@ gtk_assistant_get_nth_page (GtkAssistant *assistant,
* Return value: the index (starting at 0) of the inserted page
*
* Since: 2.10
- **/
+ */
gint
gtk_assistant_prepend_page (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
@@ -1846,10 +1856,10 @@ gtk_assistant_prepend_page (GtkAssistant *assistant,
* Return value: the index (starting at 0) of the inserted page
*
* Since: 2.10
- **/
+ */
gint
gtk_assistant_append_page (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
@@ -1862,18 +1872,18 @@ gtk_assistant_append_page (GtkAssistant *assistant,
* @assistant: a #GtkAssistant
* @page: a #GtkWidget
* @position: the index (starting at 0) at which to insert the page,
- * or -1 to append the page to the @assistant
+ * or -1 to append the page to the @assistant
*
* Inserts a page in the @assistant at a given position.
*
* Return value: the index (starting from 0) of the inserted page
*
* Since: 2.10
- **/
+ */
gint
gtk_assistant_insert_page (GtkAssistant *assistant,
- GtkWidget *page,
- gint position)
+ GtkWidget *page,
+ gint position)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
@@ -1892,7 +1902,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
page_info->title = gtk_label_new (NULL);
g_signal_connect (G_OBJECT (page), "notify::visible",
- G_CALLBACK (on_page_notify_visibility), assistant);
+ G_CALLBACK (on_page_notify_visibility), assistant);
gtk_misc_set_alignment (GTK_MISC (page_info->title), 0.,0.5);
set_title_font (GTK_WIDGET (assistant), page_info->title);
@@ -1927,23 +1937,26 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
/**
* gtk_assistant_set_forward_page_func:
* @assistant: a #GtkAssistant
- * @page_func: (allow-none): the #GtkAssistantPageFunc, or %NULL to use the default one
+ * @page_func: (allow-none): the #GtkAssistantPageFunc, or %NULL
+ * to use the default one
* @data: user data for @page_func
* @destroy: destroy notifier for @data
*
- * Sets the page forwarding function to be @page_func, this function will
- * be used to determine what will be the next page when the user presses
- * the forward button. Setting @page_func to %NULL will make the assistant
- * to use the default forward function, which just goes to the next visible
- * page.
+ * Sets the page forwarding function to be @page_func.
+ *
+ * This function will be used to determine what will be
+ * the next page when the user presses the forward button.
+ * Setting @page_func to %NULL will make the assistant to
+ * use the default forward function, which just goes to the
+ * next visible page.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
- GtkAssistantPageFunc page_func,
- gpointer data,
- GDestroyNotify destroy)
+ GtkAssistantPageFunc page_func,
+ gpointer data,
+ GDestroyNotify destroy)
{
GtkAssistantPrivate *priv;
@@ -1969,7 +1982,8 @@ gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
}
/* Page flow has possibly changed, so the
- buttons state might need to change too */
+ * buttons state might need to change too
+ */
set_assistant_buttons_state (assistant);
}
@@ -1977,14 +1991,14 @@ gtk_assistant_set_forward_page_func (GtkAssistant *assistant,
* gtk_assistant_add_action_widget:
* @assistant: a #GtkAssistant
* @child: a #GtkWidget
- *
+ *
* Adds a widget to the action area of a #GtkAssistant.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_add_action_widget (GtkAssistant *assistant,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkAssistantPrivate *priv;
@@ -2007,10 +2021,10 @@ gtk_assistant_add_action_widget (GtkAssistant *assistant,
* Removes a widget from the action area of a #GtkAssistant.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_remove_action_widget (GtkAssistant *assistant,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkAssistantPrivate *priv;
@@ -2030,16 +2044,18 @@ gtk_assistant_remove_action_widget (GtkAssistant *assistant,
* @assistant: a #GtkAssistant
* @page: a page of @assistant
* @title: the new title for @page
- *
- * Sets a title for @page. The title is displayed in the header
- * area of the assistant when @page is the current page.
+ *
+ * Sets a title for @page.
+ *
+ * The title is displayed in the header area of the assistant
+ * when @page is the current page.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_page_title (GtkAssistant *assistant,
- GtkWidget *page,
- const gchar *title)
+ GtkWidget *page,
+ const gchar *title)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2062,16 +2078,16 @@ gtk_assistant_set_page_title (GtkAssistant *assistant,
* gtk_assistant_get_page_title:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
- *
- * Gets the title for @page.
- *
- * Return value: the title for @page.
+ *
+ * Gets the title for @page.
+ *
+ * Return value: the title for @page
*
* Since: 2.10
- **/
+ */
G_CONST_RETURN gchar*
gtk_assistant_get_page_title (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2093,25 +2109,24 @@ gtk_assistant_get_page_title (GtkAssistant *assistant,
* @assistant: a #GtkAssistant
* @page: a page of @assistant
* @type: the new type for @page
- *
- * Sets the page type for @page. The page type determines the page
- * behavior in the @assistant.
+ *
+ * Sets the page type for @page.
+ *
+ * The page type determines the page behavior in the @assistant.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_page_type (GtkAssistant *assistant,
- GtkWidget *page,
- GtkAssistantPageType type)
+ GtkWidget *page,
+ GtkAssistantPageType type)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
g_return_if_fail (GTK_IS_WIDGET (page));
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_if_fail (child != NULL);
@@ -2130,7 +2145,8 @@ gtk_assistant_set_page_type (GtkAssistant *assistant,
}
/* Always set buttons state, a change in a future page
- might change current page buttons */
+ * might change current page buttons
+ */
set_assistant_buttons_state (assistant);
gtk_widget_child_notify (page, "page-type");
@@ -2144,13 +2160,13 @@ gtk_assistant_set_page_type (GtkAssistant *assistant,
*
* Gets the page type of @page.
*
- * Return value: the page type of @page.
+ * Return value: the page type of @page
*
* Since: 2.10
- **/
+ */
GtkAssistantPageType
gtk_assistant_get_page_type (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2173,15 +2189,17 @@ gtk_assistant_get_page_type (GtkAssistant *assistant,
* @page: a page of @assistant
* @pixbuf: (allow-none): the new header image @page
*
- * Sets a header image for @page. This image is displayed in the header
- * area of the assistant when @page is the current page.
+ * Sets a header image for @page.
+ *
+ * This image is displayed in the header area of the assistant
+ * when @page is the current page.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_page_header_image (GtkAssistant *assistant,
- GtkWidget *page,
- GdkPixbuf *pixbuf)
+ GtkWidget *page,
+ GdkPixbuf *pixbuf)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
@@ -2201,16 +2219,16 @@ gtk_assistant_set_page_header_image (GtkAssistant *assistant,
if (pixbuf != page_info->header_image)
{
if (page_info->header_image)
- {
- g_object_unref (page_info->header_image);
- page_info->header_image = NULL;
- }
+ {
+ g_object_unref (page_info->header_image);
+ page_info->header_image = NULL;
+ }
if (pixbuf)
- page_info->header_image = g_object_ref (pixbuf);
+ page_info->header_image = g_object_ref (pixbuf);
if (page_info == priv->current_page)
- set_assistant_header_image (assistant);
+ set_assistant_header_image (assistant);
gtk_widget_child_notify (page, "header-image");
}
@@ -2223,14 +2241,14 @@ gtk_assistant_set_page_header_image (GtkAssistant *assistant,
*
* Gets the header image for @page.
*
- * Return value: (transfer none): the header image for @page, or %NULL
- * if there's no header image for the page.
+ * Return value: (transfer none): the header image for @page,
+ * or %NULL if there's no header image for the page
*
* Since: 2.10
- **/
+ */
GdkPixbuf*
gtk_assistant_get_page_header_image (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2253,15 +2271,17 @@ gtk_assistant_get_page_header_image (GtkAssistant *assistant,
* @page: a page of @assistant
* @pixbuf: (allow-none): the new header image @page
*
- * Sets a header image for @page. This image is displayed in the side
- * area of the assistant when @page is the current page.
+ * Sets a header image for @page.
+ *
+ * This image is displayed in the side area of the assistant
+ * when @page is the current page.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_page_side_image (GtkAssistant *assistant,
- GtkWidget *page,
- GdkPixbuf *pixbuf)
+ GtkWidget *page,
+ GdkPixbuf *pixbuf)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
@@ -2281,16 +2301,16 @@ gtk_assistant_set_page_side_image (GtkAssistant *assistant,
if (pixbuf != page_info->sidebar_image)
{
if (page_info->sidebar_image)
- {
- g_object_unref (page_info->sidebar_image);
- page_info->sidebar_image = NULL;
- }
+ {
+ g_object_unref (page_info->sidebar_image);
+ page_info->sidebar_image = NULL;
+ }
if (pixbuf)
- page_info->sidebar_image = g_object_ref (pixbuf);
+ page_info->sidebar_image = g_object_ref (pixbuf);
if (page_info == priv->current_page)
- set_assistant_sidebar_image (assistant);
+ set_assistant_sidebar_image (assistant);
gtk_widget_child_notify (page, "sidebar-image");
}
@@ -2303,14 +2323,14 @@ gtk_assistant_set_page_side_image (GtkAssistant *assistant,
*
* Gets the header image for @page.
*
- * Return value: (transfer none): the side image for @page, or %NULL
- * if there's no side image for the page.
+ * Return value: (transfer none): the side image for @page,
+ * or %NULL if there's no side image for the page
*
* Since: 2.10
- **/
+ */
GdkPixbuf*
gtk_assistant_get_page_side_image (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2332,25 +2352,25 @@ gtk_assistant_get_page_side_image (GtkAssistant *assistant,
* @assistant: a #GtkAssistant
* @page: a page of @assistant
* @complete: the completeness status of the page
- *
- * Sets whether @page contents are complete. This will make
- * @assistant update the buttons state to be able to continue the task.
+ *
+ * Sets whether @page contents are complete.
+ *
+ * This will make @assistant update the buttons state
+ * to be able to continue the task.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_set_page_complete (GtkAssistant *assistant,
- GtkWidget *page,
- gboolean complete)
+ GtkWidget *page,
+ gboolean complete)
{
- GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
GList *child;
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
g_return_if_fail (GTK_IS_WIDGET (page));
- priv = assistant->priv;
child = find_page (assistant, page);
g_return_if_fail (child != NULL);
@@ -2363,7 +2383,8 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
page_info->complete_set = TRUE;
/* Always set buttons state, a change in a future page
- might change current page buttons */
+ * might change current page buttons
+ */
set_assistant_buttons_state (assistant);
gtk_widget_child_notify (page, "complete");
@@ -2374,16 +2395,16 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
* gtk_assistant_get_page_complete:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
- *
+ *
* Gets whether @page is complete.
- *
+ *
* Return value: %TRUE if @page is complete.
*
* Since: 2.10
- **/
+ */
gboolean
gtk_assistant_get_page_complete (GtkAssistant *assistant,
- GtkWidget *page)
+ GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
@@ -2403,10 +2424,10 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
/**
* gtk_assistant_update_buttons_state:
* @assistant: a #GtkAssistant
- *
+ *
* Forces @assistant to recompute the buttons state.
- *
- * GTK+ automatically takes care of this in most situations,
+ *
+ * GTK+ automatically takes care of this in most situations,
* e.g. when the user goes to a different page, or when the
* visibility or completeness of a page changes.
*
@@ -2415,7 +2436,7 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
* affects the future page flow of the assistant.
*
* Since: 2.10
- **/
+ */
void
gtk_assistant_update_buttons_state (GtkAssistant *assistant)
{
@@ -2434,12 +2455,12 @@ gtk_assistant_update_buttons_state (GtkAssistant *assistant)
*
* Use this when the information provided up to the current
* page is hereafter deemed permanent and cannot be modified
- * or undone. For example, showing a progress page to track
+ * or undone. For example, showing a progress page to track
* a long-running, unreversible operation after the user has
* clicked apply on a confirmation page.
*
* Since: 2.22
- **/
+ */
void
gtk_assistant_commit (GtkAssistant *assistant)
{
@@ -2465,10 +2486,9 @@ gtk_assistant_get_accessible (GtkWidget *widget)
GType derived_type;
GType derived_atk_type;
- /*
- * Figure out whether accessibility is enabled by looking at the
- * type of the accessible object which would be created for
- * the parent type of GtkAssistant.
+ /* Figure out whether accessibility is enabled by looking
+ * at the type of the accessible object which would be
+ * created for the parent type of GtkAssistant.
*/
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
@@ -2508,7 +2528,7 @@ gtk_assistant_accessible_get_n_children (AtkObject *accessible)
static AtkObject *
gtk_assistant_accessible_ref_child (AtkObject *accessible,
- gint index)
+ gint index)
{
GtkAssistant *assistant;
GtkAssistantPrivate *priv;
@@ -2541,7 +2561,7 @@ gtk_assistant_accessible_ref_child (AtkObject *accessible,
}
else
return NULL;
-
+
obj = gtk_widget_get_accessible (child);
if (title)
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 24bdf1c..c5e57db 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -418,7 +418,6 @@ gtk_button_box_child_requisition (GtkWidget *widget,
gint **widths,
gint **heights)
{
- GtkButtonBoxPrivate *priv;
GtkButtonBox *bbox;
GList *children, *list;
gint nchildren;
@@ -439,7 +438,6 @@ gtk_button_box_child_requisition (GtkWidget *widget,
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
bbox = GTK_BUTTON_BOX (widget);
- priv = bbox->priv;
homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index d038b31..9bc416e 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1566,7 +1566,6 @@ _gtk_button_paint (GtkButton *button,
gint focus_width;
gint focus_pad;
GtkAllocation allocation;
- GdkWindow *window;
GtkStyleContext *context;
widget = GTK_WIDGET (button);
@@ -1582,7 +1581,6 @@ _gtk_button_paint (GtkButton *button,
NULL);
gtk_widget_get_allocation (widget, &allocation);
- window = gtk_widget_get_window (widget);
x = 0;
y = 0;
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 3aa1be4..59bac5e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -3,7 +3,7 @@
*
* GTK Calendar Widget
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson and Mattias Groenlund
- *
+ *
* lib_date routines
* Copyright (c) 1995, 1996, 1997, 1998 by Steffen Beyer
*
@@ -14,7 +14,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -26,7 +26,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/**
@@ -83,7 +83,7 @@
#include "gtkprivate.h"
/***************************************************************************/
-/* The following date routines are taken from the lib_date package.
+/* The following date routines are taken from the lib_date package.
* They have been minimally edited to avoid conflict with types defined
* in win32 headers.
*/
@@ -103,20 +103,20 @@ static const guint days_in_months[2][14] =
static glong calc_days(guint year, guint mm, guint dd);
static guint day_of_week(guint year, guint mm, guint dd);
static glong dates_difference(guint year1, guint mm1, guint dd1,
- guint year2, guint mm2, guint dd2);
+ guint year2, guint mm2, guint dd2);
static guint weeks_in_year(guint year);
-static gboolean
+static gboolean
leap (guint year)
{
return((((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0));
}
-static guint
+static guint
day_of_week (guint year, guint mm, guint dd)
{
glong days;
-
+
days = calc_days(year, mm, dd);
if (days > 0L)
{
@@ -132,7 +132,7 @@ static guint weeks_in_year(guint year)
return(52 + ((day_of_week(year,1,1)==4) || (day_of_week(year,12,31)==4)));
}
-static gboolean
+static gboolean
check_date(guint year, guint mm, guint dd)
{
if (year < 1) return FALSE;
@@ -141,55 +141,55 @@ check_date(guint year, guint mm, guint dd)
return TRUE;
}
-static guint
+static guint
week_number(guint year, guint mm, guint dd)
{
guint first;
-
+
first = day_of_week(year,1,1) - 1;
return( (guint) ( (dates_difference(year,1,1, year,mm,dd) + first) / 7L ) +
- (first < 4) );
+ (first < 4) );
}
-static glong
+static glong
year_to_days(guint year)
{
return( year * 365L + (year / 4) - (year / 100) + (year / 400) );
}
-static glong
+static glong
calc_days(guint year, guint mm, guint dd)
{
gboolean lp;
-
+
if (year < 1) return(0L);
if ((mm < 1) || (mm > 12)) return(0L);
if ((dd < 1) || (dd > month_length[(lp = leap(year))][mm])) return(0L);
return( year_to_days(--year) + days_in_months[lp][mm] + dd );
}
-static gboolean
+static gboolean
week_of_year(guint *week, guint *year, guint mm, guint dd)
{
if (check_date(*year,mm,dd))
{
*week = week_number(*year,mm,dd);
- if (*week == 0)
- *week = weeks_in_year(--(*year));
+ if (*week == 0)
+ *week = weeks_in_year(--(*year));
else if (*week > weeks_in_year(*year))
- {
- *week = 1;
- (*year)++;
- }
+ {
+ *week = 1;
+ (*year)++;
+ }
return TRUE;
}
return FALSE;
}
-static glong
+static glong
dates_difference(guint year1, guint mm1, guint dd1,
- guint year2, guint mm2, guint dd2)
+ guint year2, guint mm2, guint dd2)
{
return( calc_days(year2, mm2, dd2) - calc_days(year1, mm1, dd1) );
}
@@ -197,10 +197,10 @@ dates_difference(guint year1, guint mm1, guint dd1,
/*** END OF lib_date routines ********************************************/
/* Spacing around day/week headers and main area, inside those windows */
-#define CALENDAR_MARGIN 0
+#define CALENDAR_MARGIN 0
-#define DAY_XSEP 0 /* not really good for small calendar */
-#define DAY_YSEP 0 /* not really good for small calendar */
+#define DAY_XSEP 0 /* not really good for small calendar */
+#define DAY_YSEP 0 /* not really good for small calendar */
#define SCROLL_DELAY_FACTOR 5
@@ -272,10 +272,10 @@ struct _GtkCalendarPrivate
guint day_name_h;
guint main_h;
- guint arrow_state[4];
- guint arrow_width;
- guint max_month_width;
- guint max_year_width;
+ guint arrow_state[4];
+ guint arrow_width;
+ guint max_month_width;
+ guint max_year_width;
guint day_width;
guint week_width;
@@ -287,7 +287,7 @@ struct _GtkCalendarPrivate
guint max_label_char_ascent;
guint max_label_char_descent;
guint max_week_char_width;
-
+
/* flags */
guint year_before : 1;
@@ -320,13 +320,13 @@ struct _GtkCalendarPrivate
static void gtk_calendar_finalize (GObject *calendar);
static void gtk_calendar_destroy (GtkWidget *widget);
static void gtk_calendar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gtk_calendar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void gtk_calendar_realize (GtkWidget *widget);
static void gtk_calendar_unrealize (GtkWidget *widget);
@@ -339,72 +339,72 @@ static void gtk_calendar_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural);
static void gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ GtkAllocation *allocation);
static gboolean gtk_calendar_draw (GtkWidget *widget,
cairo_t *cr);
static gboolean gtk_calendar_button_press (GtkWidget *widget,
- GdkEventButton *event);
+ GdkEventButton *event);
static gboolean gtk_calendar_button_release (GtkWidget *widget,
- GdkEventButton *event);
+ GdkEventButton *event);
static gboolean gtk_calendar_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
+ GdkEventMotion *event);
static gboolean gtk_calendar_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
+ GdkEventCrossing *event);
static gboolean gtk_calendar_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
+ GdkEventCrossing *event);
static gboolean gtk_calendar_scroll (GtkWidget *widget,
- GdkEventScroll *event);
+ GdkEventScroll *event);
static gboolean gtk_calendar_key_press (GtkWidget *widget,
- GdkEventKey *event);
+ GdkEventKey *event);
static gboolean gtk_calendar_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
+ GdkEventFocus *event);
static void gtk_calendar_grab_notify (GtkWidget *widget,
- gboolean was_grabbed);
+ gboolean was_grabbed);
static void gtk_calendar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static gboolean gtk_calendar_query_tooltip (GtkWidget *widget,
- gint x,
- gint y,
- gboolean keyboard_mode,
- GtkTooltip *tooltip);
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip);
static void gtk_calendar_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time);
static void gtk_calendar_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time);
static gboolean gtk_calendar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
static void gtk_calendar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time);
+ GdkDragContext *context,
+ guint time);
static gboolean gtk_calendar_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
static void calendar_start_spinning (GtkCalendar *calendar,
- gint click_child);
+ gint click_child);
static void calendar_stop_spinning (GtkCalendar *calendar);
static void calendar_invalidate_day (GtkCalendar *widget,
- gint row,
- gint col);
+ gint row,
+ gint col);
static void calendar_invalidate_day_num (GtkCalendar *widget,
- gint day);
+ gint day);
static void calendar_invalidate_arrow (GtkCalendar *widget,
- guint arrow);
+ guint arrow);
static void calendar_compute_days (GtkCalendar *calendar);
static gint calendar_get_xsep (GtkCalendar *calendar);
@@ -424,7 +424,7 @@ gtk_calendar_class_init (GtkCalendarClass *class)
gobject_class = (GObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
-
+
gobject_class->set_property = gtk_calendar_set_property;
gobject_class->get_property = gtk_calendar_get_property;
gobject_class->finalize = gtk_calendar_finalize;
@@ -455,49 +455,49 @@ gtk_calendar_class_init (GtkCalendarClass *class)
widget_class->drag_leave = gtk_calendar_drag_leave;
widget_class->drag_drop = gtk_calendar_drag_drop;
widget_class->drag_data_received = gtk_calendar_drag_data_received;
-
+
/**
* GtkCalendar:year:
*
- * The selected year.
+ * The selected year.
* This property gets initially set to the current year.
- */
+ */
g_object_class_install_property (gobject_class,
PROP_YEAR,
g_param_spec_int ("year",
- P_("Year"),
- P_("The selected year"),
- 0, G_MAXINT >> 9, 0,
- GTK_PARAM_READWRITE));
+ P_("Year"),
+ P_("The selected year"),
+ 0, G_MAXINT >> 9, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:month:
*
- * The selected month (as a number between 0 and 11).
+ * The selected month (as a number between 0 and 11).
* This property gets initially set to the current month.
*/
g_object_class_install_property (gobject_class,
PROP_MONTH,
g_param_spec_int ("month",
- P_("Month"),
- P_("The selected month (as a number between 0 and 11)"),
- 0, 11, 0,
- GTK_PARAM_READWRITE));
+ P_("Month"),
+ P_("The selected month (as a number between 0 and 11)"),
+ 0, 11, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:day:
*
- * The selected day (as a number between 1 and 31, or 0
+ * The selected day (as a number between 1 and 31, or 0
* to unselect the currently selected day).
* This property gets initially set to the current day.
*/
g_object_class_install_property (gobject_class,
PROP_DAY,
g_param_spec_int ("day",
- P_("Day"),
- P_("The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)"),
- 0, 31, 0,
- GTK_PARAM_READWRITE));
+ P_("Day"),
+ P_("The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)"),
+ 0, 31, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:show-heading:
@@ -509,10 +509,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_SHOW_HEADING,
g_param_spec_boolean ("show-heading",
- P_("Show Heading"),
- P_("If TRUE, a heading is displayed"),
- TRUE,
- GTK_PARAM_READWRITE));
+ P_("Show Heading"),
+ P_("If TRUE, a heading is displayed"),
+ TRUE,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:show-day-names:
@@ -524,10 +524,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_SHOW_DAY_NAMES,
g_param_spec_boolean ("show-day-names",
- P_("Show Day Names"),
- P_("If TRUE, day names are displayed"),
- TRUE,
- GTK_PARAM_READWRITE));
+ P_("Show Day Names"),
+ P_("If TRUE, day names are displayed"),
+ TRUE,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:no-month-change:
*
@@ -538,10 +538,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_NO_MONTH_CHANGE,
g_param_spec_boolean ("no-month-change",
- P_("No Month Change"),
- P_("If TRUE, the selected month cannot be changed"),
- FALSE,
- GTK_PARAM_READWRITE));
+ P_("No Month Change"),
+ P_("If TRUE, the selected month cannot be changed"),
+ FALSE,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:show-week-numbers:
@@ -553,10 +553,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_SHOW_WEEK_NUMBERS,
g_param_spec_boolean ("show-week-numbers",
- P_("Show Week Numbers"),
- P_("If TRUE, week numbers are displayed"),
- FALSE,
- GTK_PARAM_READWRITE));
+ P_("Show Week Numbers"),
+ P_("If TRUE, week numbers are displayed"),
+ FALSE,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:detail-width-chars:
@@ -569,10 +569,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_DETAIL_WIDTH_CHARS,
g_param_spec_int ("detail-width-chars",
- P_("Details Width"),
- P_("Details width in characters"),
- 0, 127, 0,
- GTK_PARAM_READWRITE));
+ P_("Details Width"),
+ P_("Details width in characters"),
+ 0, 127, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:detail-height-rows:
@@ -585,10 +585,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_DETAIL_HEIGHT_ROWS,
g_param_spec_int ("detail-height-rows",
- P_("Details Height"),
- P_("Details height in rows"),
- 0, 127, 0,
- GTK_PARAM_READWRITE));
+ P_("Details Height"),
+ P_("Details height in rows"),
+ 0, 127, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkCalendar:show-details:
@@ -602,10 +602,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
g_object_class_install_property (gobject_class,
PROP_SHOW_DETAILS,
g_param_spec_boolean ("show-details",
- P_("Show Details"),
- P_("If TRUE, details are shown"),
- TRUE,
- GTK_PARAM_READWRITE));
+ P_("Show Details"),
+ P_("If TRUE, details are shown"),
+ TRUE,
+ GTK_PARAM_READWRITE));
/**
@@ -653,12 +653,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
g_signal_new (I_("month-changed"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, month_changed),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, month_changed),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::day-selected:
@@ -668,12 +668,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[DAY_SELECTED_SIGNAL] =
g_signal_new (I_("day-selected"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, day_selected),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, day_selected),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::day-selected-double-click:
@@ -683,12 +683,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] =
g_signal_new (I_("day-selected-double-click"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, day_selected_double_click),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, day_selected_double_click),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::prev-month:
@@ -698,12 +698,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[PREV_MONTH_SIGNAL] =
g_signal_new (I_("prev-month"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, prev_month),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, prev_month),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::next-month:
@@ -713,12 +713,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[NEXT_MONTH_SIGNAL] =
g_signal_new (I_("next-month"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, next_month),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, next_month),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::prev-year:
@@ -728,12 +728,12 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[PREV_YEAR_SIGNAL] =
g_signal_new (I_("prev-year"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, prev_year),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, prev_year),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* GtkCalendar::next-year:
@@ -743,13 +743,13 @@ gtk_calendar_class_init (GtkCalendarClass *class)
*/
gtk_calendar_signals[NEXT_YEAR_SIGNAL] =
g_signal_new (I_("next-year"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkCalendarClass, next_year),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkCalendarClass, next_year),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
g_type_class_add_private (gobject_class, sizeof (GtkCalendarPrivate));
}
@@ -778,44 +778,44 @@ gtk_calendar_init (GtkCalendar *calendar)
#endif
priv = calendar->priv = G_TYPE_INSTANCE_GET_PRIVATE (calendar,
- GTK_TYPE_CALENDAR,
- GtkCalendarPrivate);
+ GTK_TYPE_CALENDAR,
+ GtkCalendarPrivate);
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_set_has_window (widget, FALSE);
-
+
if (!default_abbreviated_dayname[0])
for (i=0; i<7; i++)
{
#ifndef G_OS_WIN32
- tmp_time= (i+3)*86400;
- strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
- default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
+ tmp_time= (i+3)*86400;
+ strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
+ default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
- if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7,
- wbuffer, G_N_ELEMENTS (wbuffer)))
- default_abbreviated_dayname[i] = g_strdup_printf ("(%d)", i);
- else
- default_abbreviated_dayname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
+ if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7,
+ wbuffer, G_N_ELEMENTS (wbuffer)))
+ default_abbreviated_dayname[i] = g_strdup_printf ("(%d)", i);
+ else
+ default_abbreviated_dayname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
#endif
}
-
+
if (!default_monthname[0])
for (i=0; i<12; i++)
{
#ifndef G_OS_WIN32
- tmp_time=i*2764800;
- strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
- default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
+ tmp_time=i*2764800;
+ strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
+ default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
- if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i,
- wbuffer, G_N_ELEMENTS (wbuffer)))
- default_monthname[i] = g_strdup_printf ("(%d)", i);
- else
- default_monthname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
+ if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i,
+ wbuffer, G_N_ELEMENTS (wbuffer)))
+ default_monthname[i] = g_strdup_printf ("(%d)", i);
+ else
+ default_monthname[i] = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
#endif
}
-
+
/* Set defaults */
secs = time (NULL);
tm = localtime (&secs);
@@ -826,11 +826,11 @@ gtk_calendar_init (GtkCalendar *calendar)
priv->marked_date[i] = FALSE;
priv->num_marked_dates = 0;
priv->selected_day = tm->tm_mday;
-
+
priv->display_flags = (GTK_CALENDAR_SHOW_HEADING |
- GTK_CALENDAR_SHOW_DAY_NAMES |
- GTK_CALENDAR_SHOW_DETAILS);
-
+ GTK_CALENDAR_SHOW_DAY_NAMES |
+ GTK_CALENDAR_SHOW_DETAILS);
+
priv->focus_row = -1;
priv->focus_col = -1;
@@ -879,9 +879,9 @@ gtk_calendar_init (GtkCalendar *calendar)
week_start = NULL;
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
- wbuffer, G_N_ELEMENTS (wbuffer)))
+ wbuffer, G_N_ELEMENTS (wbuffer)))
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
-
+
if (week_start != NULL)
{
priv->week_start = (week_start[0] - '0' + 1) % 7;
@@ -905,14 +905,14 @@ gtk_calendar_init (GtkCalendar *calendar)
/* Translate to calendar:week_start:0 if you want Sunday to be the
* first day of the week to calendar:week_start:1 if you want Monday
* to be the first day of the week, and so on.
- */
+ */
week_start = _("calendar:week_start:0");
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
priv->week_start = *(week_start + 20) - '0';
- else
+ else
priv->week_start = -1;
-
+
if (priv->week_start < 0 || priv->week_start > 6)
{
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.\n");
@@ -961,11 +961,11 @@ calendar_set_month_next (GtkCalendar *calendar)
calendar_compute_days (calendar);
g_signal_emit (calendar,
- gtk_calendar_signals[NEXT_MONTH_SIGNAL],
- 0);
+ gtk_calendar_signals[NEXT_MONTH_SIGNAL],
+ 0);
g_signal_emit (calendar,
- gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
- 0);
+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
+ 0);
month_len = month_length[leap (priv->year)][priv->month + 1];
@@ -989,11 +989,11 @@ calendar_set_year_prev (GtkCalendar *calendar)
priv->year--;
calendar_compute_days (calendar);
g_signal_emit (calendar,
- gtk_calendar_signals[PREV_YEAR_SIGNAL],
- 0);
+ gtk_calendar_signals[PREV_YEAR_SIGNAL],
+ 0);
g_signal_emit (calendar,
- gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
- 0);
+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
+ 0);
month_len = month_length[leap (priv->year)][priv->month + 1];
@@ -1017,11 +1017,11 @@ calendar_set_year_next (GtkCalendar *calendar)
priv->year++;
calendar_compute_days (calendar);
g_signal_emit (calendar,
- gtk_calendar_signals[NEXT_YEAR_SIGNAL],
- 0);
+ gtk_calendar_signals[NEXT_YEAR_SIGNAL],
+ 0);
g_signal_emit (calendar,
- gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
- 0);
+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
+ 0);
month_len = month_length[leap (priv->year)][priv->month + 1];
@@ -1063,18 +1063,18 @@ calendar_compute_days (GtkCalendar *calendar)
else
ndays_in_prev_month = month_length[leap (year)][12];
day = ndays_in_prev_month - first_day + 1;
-
+
row = 0;
if (first_day > 0)
{
for (col = 0; col < first_day; col++)
- {
- priv->day[row][col] = day;
- priv->day_month[row][col] = MONTH_PREV;
- day++;
- }
+ {
+ priv->day[row][col] = day;
+ priv->day_month[row][col] = MONTH_PREV;
+ day++;
+ }
}
-
+
/* Compute days of current month */
col = first_day;
for (day = 1; day <= ndays_in_month; day++)
@@ -1084,50 +1084,50 @@ calendar_compute_days (GtkCalendar *calendar)
col++;
if (col == 7)
- {
- row++;
- col = 0;
- }
+ {
+ row++;
+ col = 0;
+ }
}
-
+
/* Compute days of next month */
day = 1;
for (; row <= 5; row++)
{
for (; col <= 6; col++)
- {
- priv->day[row][col] = day;
- priv->day_month[row][col] = MONTH_NEXT;
- day++;
- }
+ {
+ priv->day[row][col] = day;
+ priv->day_month[row][col] = MONTH_NEXT;
+ day++;
+ }
col = 0;
}
}
static void
calendar_select_and_focus_day (GtkCalendar *calendar,
- guint day)
+ guint day)
{
GtkCalendarPrivate *priv = calendar->priv;
gint old_focus_row = priv->focus_row;
gint old_focus_col = priv->focus_col;
gint row;
gint col;
-
+
for (row = 0; row < 6; row ++)
for (col = 0; col < 7; col++)
{
- if (priv->day_month[row][col] == MONTH_CURRENT
- && priv->day[row][col] == day)
- {
- priv->focus_row = row;
- priv->focus_col = col;
- }
+ if (priv->day_month[row][col] == MONTH_CURRENT
+ && priv->day[row][col] == day)
+ {
+ priv->focus_row = row;
+ priv->focus_col = col;
+ }
}
if (old_focus_row != -1 && old_focus_col != -1)
calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
-
+
gtk_calendar_select_day (calendar, day);
}
@@ -1142,8 +1142,8 @@ calendar_row_height (GtkCalendar *calendar)
GtkCalendarPrivate *priv = calendar->priv;
return (GTK_CALENDAR_GET_PRIVATE (calendar)->main_h - CALENDAR_MARGIN
- - ((priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
- ? calendar_get_ysep (calendar) : CALENDAR_MARGIN)) / 6;
+ - ((priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
+ ? calendar_get_ysep (calendar) : CALENDAR_MARGIN)) / 6;
}
@@ -1151,7 +1151,7 @@ calendar_row_height (GtkCalendar *calendar)
* for the left of the column */
static gint
calendar_left_x_for_column (GtkCalendar *calendar,
- gint column)
+ gint column)
{
GtkCalendarPrivate *priv = calendar->priv;
gint width;
@@ -1180,7 +1180,7 @@ calendar_left_x_for_column (GtkCalendar *calendar,
x_left = week_width + calendar_xsep + (width + DAY_XSEP) * column;
else
x_left = week_width + CALENDAR_MARGIN + (width + DAY_XSEP) * column;
-
+
return x_left;
}
@@ -1188,25 +1188,25 @@ calendar_left_x_for_column (GtkCalendar *calendar,
* x pixel of the xwindow is in */
static gint
calendar_column_from_x (GtkCalendar *calendar,
- gint event_x)
+ gint event_x)
{
gint c, column;
gint x_left, x_right;
-
+
column = -1;
-
+
for (c = 0; c < 7; c++)
{
x_left = calendar_left_x_for_column (calendar, c);
x_right = x_left + GTK_CALENDAR_GET_PRIVATE (calendar)->day_width;
-
+
if (event_x >= x_left && event_x < x_right)
- {
- column = c;
- break;
- }
+ {
+ column = c;
+ break;
+ }
}
-
+
return column;
}
@@ -1214,7 +1214,7 @@ calendar_column_from_x (GtkCalendar *calendar,
* for the top of the row */
static gint
calendar_top_y_for_row (GtkCalendar *calendar,
- gint row)
+ gint row)
{
GtkStyleContext *context;
GtkAllocation allocation;
@@ -1230,8 +1230,8 @@ calendar_top_y_for_row (GtkCalendar *calendar,
return allocation.height
- padding.top - inner_border
- - (CALENDAR_MARGIN + (6 - row)
- * calendar_row_height (calendar));
+ - (CALENDAR_MARGIN + (6 - row)
+ * calendar_row_height (calendar));
}
/* row_from_y: returns the row 0-5 that the
@@ -1243,29 +1243,29 @@ calendar_row_from_y (GtkCalendar *calendar,
gint r, row;
gint height;
gint y_top, y_bottom;
-
+
height = calendar_row_height (calendar);
row = -1;
-
+
for (r = 0; r < 6; r++)
{
y_top = calendar_top_y_for_row (calendar, r);
y_bottom = y_top + height;
-
+
if (event_y >= y_top && event_y < y_bottom)
- {
- row = r;
- break;
- }
+ {
+ row = r;
+ break;
+ }
}
-
+
return row;
}
static void
calendar_arrow_rectangle (GtkCalendar *calendar,
- guint arrow,
- GdkRectangle *rect)
+ guint arrow,
+ GdkRectangle *rect)
{
GtkWidget *widget = GTK_WIDGET (calendar);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
@@ -1297,18 +1297,18 @@ calendar_arrow_rectangle (GtkCalendar *calendar,
rect->x = (allocation.width - padding.left - padding.right
- (3 + 2 * priv->arrow_width + priv->max_month_width));
else
- rect->x = 3;
+ rect->x = 3;
break;
case ARROW_MONTH_RIGHT:
if (year_left)
rect->x = (allocation.width - padding.left - padding.right
- - 3 - priv->arrow_width);
+ - 3 - priv->arrow_width);
else
- rect->x = (priv->arrow_width + priv->max_month_width);
+ rect->x = (priv->arrow_width + priv->max_month_width);
break;
case ARROW_YEAR_LEFT:
if (year_left)
- rect->x = 3;
+ rect->x = 3;
else
rect->x = (allocation.width - padding.left - padding.right
- (3 + 2 * priv->arrow_width + priv->max_year_width));
@@ -1318,7 +1318,7 @@ calendar_arrow_rectangle (GtkCalendar *calendar,
rect->x = (priv->arrow_width + priv->max_year_width);
else
rect->x = (allocation.width - padding.left - padding.right
- - 3 - priv->arrow_width);
+ - 3 - priv->arrow_width);
break;
}
@@ -1328,9 +1328,9 @@ calendar_arrow_rectangle (GtkCalendar *calendar,
static void
calendar_day_rectangle (GtkCalendar *calendar,
- gint row,
- gint col,
- GdkRectangle *rect)
+ gint row,
+ gint col,
+ GdkRectangle *rect)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
@@ -1345,7 +1345,7 @@ calendar_set_month_prev (GtkCalendar *calendar)
{
GtkCalendarPrivate *priv = calendar->priv;
gint month_len;
-
+
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
return;
@@ -1360,13 +1360,13 @@ calendar_set_month_prev (GtkCalendar *calendar)
month_len = month_length[leap (priv->year)][priv->month + 1];
calendar_compute_days (calendar);
-
+
g_signal_emit (calendar,
- gtk_calendar_signals[PREV_MONTH_SIGNAL],
- 0);
+ gtk_calendar_signals[PREV_MONTH_SIGNAL],
+ 0);
g_signal_emit (calendar,
- gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
- 0);
+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
+ 0);
if (month_len < priv->selected_day)
{
@@ -1376,7 +1376,7 @@ calendar_set_month_prev (GtkCalendar *calendar)
else
{
if (priv->selected_day < 0)
- priv->selected_day = priv->selected_day + 1 + month_length[leap (priv->year)][priv->month + 1];
+ priv->selected_day = priv->selected_day + 1 + month_length[leap (priv->year)][priv->month + 1];
gtk_calendar_select_day (calendar, priv->selected_day);
}
@@ -1415,8 +1415,8 @@ gtk_calendar_destroy (GtkWidget *widget)
static void
calendar_set_display_option (GtkCalendar *calendar,
- GtkCalendarDisplayOptions flag,
- gboolean setting)
+ GtkCalendarDisplayOptions flag,
+ gboolean setting)
{
GtkCalendarPrivate *priv = calendar->priv;
GtkCalendarDisplayOptions flags;
@@ -1430,62 +1430,62 @@ calendar_set_display_option (GtkCalendar *calendar,
static gboolean
calendar_get_display_option (GtkCalendar *calendar,
- GtkCalendarDisplayOptions flag)
+ GtkCalendarDisplayOptions flag)
{
GtkCalendarPrivate *priv = calendar->priv;
return (priv->display_flags & flag) != 0;
}
-static void
+static void
gtk_calendar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GtkCalendar *calendar = GTK_CALENDAR (object);
GtkCalendarPrivate *priv = calendar->priv;
- switch (prop_id)
+ switch (prop_id)
{
case PROP_YEAR:
gtk_calendar_select_month (calendar,
- priv->month,
- g_value_get_int (value));
+ priv->month,
+ g_value_get_int (value));
break;
case PROP_MONTH:
gtk_calendar_select_month (calendar,
- g_value_get_int (value),
- priv->year);
+ g_value_get_int (value),
+ priv->year);
break;
case PROP_DAY:
gtk_calendar_select_day (calendar,
- g_value_get_int (value));
+ g_value_get_int (value));
break;
case PROP_SHOW_HEADING:
calendar_set_display_option (calendar,
- GTK_CALENDAR_SHOW_HEADING,
- g_value_get_boolean (value));
+ GTK_CALENDAR_SHOW_HEADING,
+ g_value_get_boolean (value));
break;
case PROP_SHOW_DAY_NAMES:
calendar_set_display_option (calendar,
- GTK_CALENDAR_SHOW_DAY_NAMES,
- g_value_get_boolean (value));
+ GTK_CALENDAR_SHOW_DAY_NAMES,
+ g_value_get_boolean (value));
break;
case PROP_NO_MONTH_CHANGE:
calendar_set_display_option (calendar,
- GTK_CALENDAR_NO_MONTH_CHANGE,
- g_value_get_boolean (value));
+ GTK_CALENDAR_NO_MONTH_CHANGE,
+ g_value_get_boolean (value));
break;
case PROP_SHOW_WEEK_NUMBERS:
calendar_set_display_option (calendar,
- GTK_CALENDAR_SHOW_WEEK_NUMBERS,
- g_value_get_boolean (value));
+ GTK_CALENDAR_SHOW_WEEK_NUMBERS,
+ g_value_get_boolean (value));
break;
case PROP_SHOW_DETAILS:
calendar_set_display_option (calendar,
- GTK_CALENDAR_SHOW_DETAILS,
- g_value_get_boolean (value));
+ GTK_CALENDAR_SHOW_DETAILS,
+ g_value_get_boolean (value));
break;
case PROP_DETAIL_WIDTH_CHARS:
gtk_calendar_set_detail_width_chars (calendar,
@@ -1501,16 +1501,16 @@ gtk_calendar_set_property (GObject *object,
}
}
-static void
+static void
gtk_calendar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GtkCalendar *calendar = GTK_CALENDAR (object);
GtkCalendarPrivate *priv = calendar->priv;
- switch (prop_id)
+ switch (prop_id)
{
case PROP_YEAR:
g_value_set_int (value, priv->year);
@@ -1523,23 +1523,23 @@ gtk_calendar_get_property (GObject *object,
break;
case PROP_SHOW_HEADING:
g_value_set_boolean (value, calendar_get_display_option (calendar,
- GTK_CALENDAR_SHOW_HEADING));
+ GTK_CALENDAR_SHOW_HEADING));
break;
case PROP_SHOW_DAY_NAMES:
g_value_set_boolean (value, calendar_get_display_option (calendar,
- GTK_CALENDAR_SHOW_DAY_NAMES));
+ GTK_CALENDAR_SHOW_DAY_NAMES));
break;
case PROP_NO_MONTH_CHANGE:
g_value_set_boolean (value, calendar_get_display_option (calendar,
- GTK_CALENDAR_NO_MONTH_CHANGE));
+ GTK_CALENDAR_NO_MONTH_CHANGE));
break;
case PROP_SHOW_WEEK_NUMBERS:
g_value_set_boolean (value, calendar_get_display_option (calendar,
- GTK_CALENDAR_SHOW_WEEK_NUMBERS));
+ GTK_CALENDAR_SHOW_WEEK_NUMBERS));
break;
case PROP_SHOW_DETAILS:
g_value_set_boolean (value, calendar_get_display_option (calendar,
- GTK_CALENDAR_SHOW_DETAILS));
+ GTK_CALENDAR_SHOW_DETAILS));
break;
case PROP_DETAIL_WIDTH_CHARS:
g_value_set_int (value, priv->detail_width_chars);
@@ -1580,28 +1580,28 @@ calendar_realize_arrows (GtkCalendar *calendar)
| GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y;
for (i = 0; i < 4; i++)
- {
- GdkRectangle rect;
- calendar_arrow_rectangle (calendar, i, &rect);
-
- attributes.x = allocation.x + rect.x;
- attributes.y = allocation.y + rect.y;
- attributes.width = rect.width;
- attributes.height = rect.height;
- priv->arrow_win[i] = gdk_window_new (gtk_widget_get_window (widget),
- &attributes,
- attributes_mask);
-
- if (!gtk_widget_is_sensitive (widget))
- priv->arrow_state[i] = GTK_STATE_FLAG_INSENSITIVE;
-
- gdk_window_set_user_data (priv->arrow_win[i], widget);
- }
+ {
+ GdkRectangle rect;
+ calendar_arrow_rectangle (calendar, i, &rect);
+
+ attributes.x = allocation.x + rect.x;
+ attributes.y = allocation.y + rect.y;
+ attributes.width = rect.width;
+ attributes.height = rect.height;
+ priv->arrow_win[i] = gdk_window_new (gtk_widget_get_window (widget),
+ &attributes,
+ attributes_mask);
+
+ if (!gtk_widget_is_sensitive (widget))
+ priv->arrow_state[i] = GTK_STATE_FLAG_INSENSITIVE;
+
+ gdk_window_set_user_data (priv->arrow_win[i], widget);
+ }
}
else
{
for (i = 0; i < 4; i++)
- priv->arrow_win[i] = NULL;
+ priv->arrow_win[i] = NULL;
}
}
@@ -1853,8 +1853,8 @@ gtk_calendar_query_tooltip (GtkWidget *widget,
****************************************/
static void
-gtk_calendar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gtk_calendar_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
@@ -1877,29 +1877,29 @@ gtk_calendar_size_request (GtkWidget *widget,
gint calendar_xsep = calendar_get_xsep (calendar);
gtk_widget_style_get (GTK_WIDGET (widget),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_padding,
- NULL);
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_padding,
+ NULL);
layout = gtk_widget_create_pango_layout (widget, NULL);
-
+
/*
- * Calculate the requisition width for the widget.
+ * Calculate the requisition width for the widget.
*/
-
+
/* Header width */
-
+
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING)
{
priv->max_month_width = 0;
for (i = 0; i < 12; i++)
- {
- pango_layout_set_text (layout, default_monthname[i], -1);
- pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
- priv->max_month_width = MAX (priv->max_month_width,
- logical_rect.width + 8);
- max_header_height = MAX (max_header_height, logical_rect.height);
- }
+ {
+ pango_layout_set_text (layout, default_monthname[i], -1);
+ pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+ priv->max_month_width = MAX (priv->max_month_width,
+ logical_rect.width + 8);
+ max_header_height = MAX (max_header_height, logical_rect.height);
+ }
priv->max_year_width = 0;
/* Translators: This is a text measurement template.
@@ -1907,29 +1907,29 @@ gtk_calendar_size_request (GtkWidget *widget,
*
* If you don't understand this, leave it as "2000"
*/
- pango_layout_set_text (layout, C_("year measurement template", "2000"), -1);
+ pango_layout_set_text (layout, C_("year measurement template", "2000"), -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
priv->max_year_width = MAX (priv->max_year_width,
- logical_rect.width + 8);
- max_header_height = MAX (max_header_height, logical_rect.height);
- }
- else
+ logical_rect.width + 8);
+ max_header_height = MAX (max_header_height, logical_rect.height);
+ }
+ else
{
priv->max_month_width = 0;
priv->max_year_width = 0;
}
-
+
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
- header_width = (priv->max_month_width
- + priv->max_year_width
- + 3 * 3);
+ header_width = (priv->max_month_width
+ + priv->max_year_width
+ + 3 * 3);
else
- header_width = (priv->max_month_width
- + priv->max_year_width
- + 4 * priv->arrow_width + 3 * 3);
+ header_width = (priv->max_month_width
+ + priv->max_year_width
+ + 4 * priv->arrow_width + 3 * 3);
/* Mainwindow labels width */
-
+
priv->max_day_char_width = 0;
priv->max_day_char_ascent = 0;
priv->max_day_char_descent = 0;
@@ -1939,44 +1939,44 @@ gtk_calendar_size_request (GtkWidget *widget,
{
gchar buffer[32];
g_snprintf (buffer, sizeof (buffer), C_("calendar:day:digits", "%d"), i * 11);
- pango_layout_set_text (layout, buffer, -1);
+ pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
priv->min_day_width = MAX (priv->min_day_width,
- logical_rect.width);
+ logical_rect.width);
priv->max_day_char_ascent = MAX (priv->max_day_char_ascent,
- PANGO_ASCENT (logical_rect));
- priv->max_day_char_descent = MAX (priv->max_day_char_descent,
- PANGO_DESCENT (logical_rect));
+ PANGO_ASCENT (logical_rect));
+ priv->max_day_char_descent = MAX (priv->max_day_char_descent,
+ PANGO_DESCENT (logical_rect));
}
-
+
priv->max_label_char_ascent = 0;
priv->max_label_char_descent = 0;
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
for (i = 0; i < 7; i++)
{
- pango_layout_set_text (layout, default_abbreviated_dayname[i], -1);
- pango_layout_line_get_pixel_extents (pango_layout_get_lines_readonly (layout)->data, NULL, &logical_rect);
-
- priv->min_day_width = MAX (priv->min_day_width, logical_rect.width);
- priv->max_label_char_ascent = MAX (priv->max_label_char_ascent,
- PANGO_ASCENT (logical_rect));
- priv->max_label_char_descent = MAX (priv->max_label_char_descent,
- PANGO_DESCENT (logical_rect));
+ pango_layout_set_text (layout, default_abbreviated_dayname[i], -1);
+ pango_layout_line_get_pixel_extents (pango_layout_get_lines_readonly (layout)->data, NULL, &logical_rect);
+
+ priv->min_day_width = MAX (priv->min_day_width, logical_rect.width);
+ priv->max_label_char_ascent = MAX (priv->max_label_char_ascent,
+ PANGO_ASCENT (logical_rect));
+ priv->max_label_char_descent = MAX (priv->max_label_char_descent,
+ PANGO_DESCENT (logical_rect));
}
-
+
priv->max_week_char_width = 0;
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
for (i = 0; i < 9; i++)
{
- gchar buffer[32];
- g_snprintf (buffer, sizeof (buffer), C_("calendar:week:digits", "%d"), i * 11);
- pango_layout_set_text (layout, buffer, -1);
- pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
- priv->max_week_char_width = MAX (priv->max_week_char_width,
- logical_rect.width / 2);
+ gchar buffer[32];
+ g_snprintf (buffer, sizeof (buffer), C_("calendar:week:digits", "%d"), i * 11);
+ pango_layout_set_text (layout, buffer, -1);
+ pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+ priv->max_week_char_width = MAX (priv->max_week_char_width,
+ logical_rect.width / 2);
}
-
+
/* Calculate detail extents. Do this as late as possible since
* pango_layout_set_markup is called which alters font settings. */
max_detail_height = 0;
@@ -2049,9 +2049,9 @@ gtk_calendar_size_request (GtkWidget *widget,
priv->max_day_char_width = priv->min_day_width / 2 + 1;
main_width = (7 * (priv->min_day_width + (focus_padding + focus_width) * 2) + (DAY_XSEP * 6) + CALENDAR_MARGIN * 2
- + (priv->max_week_char_width
- ? priv->max_week_char_width * 2 + (focus_padding + focus_width) * 2 + calendar_xsep * 2
- : 0));
+ + (priv->max_week_char_width
+ ? priv->max_week_char_width * 2 + (focus_padding + focus_width) * 2 + calendar_xsep * 2
+ : 0));
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
@@ -2062,7 +2062,7 @@ gtk_calendar_size_request (GtkWidget *widget,
/*
* Calculate the requisition height for the widget.
*/
-
+
if (priv->display_flags & GTK_CALENDAR_SHOW_HEADING)
{
priv->header_h = (max_header_height + calendar_ysep * 2);
@@ -2071,25 +2071,25 @@ gtk_calendar_size_request (GtkWidget *widget,
{
priv->header_h = 0;
}
-
+
if (priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
{
priv->day_name_h = (priv->max_label_char_ascent
- + priv->max_label_char_descent
- + 2 * (focus_padding + focus_width) + calendar_margin);
+ + priv->max_label_char_descent
+ + 2 * (focus_padding + focus_width) + calendar_margin);
calendar_margin = calendar_ysep;
- }
+ }
else
{
priv->day_name_h = 0;
}
priv->main_h = (CALENDAR_MARGIN + calendar_margin
- + 6 * (priv->max_day_char_ascent
- + priv->max_day_char_descent
+ + 6 * (priv->max_day_char_ascent
+ + priv->max_day_char_descent
+ max_detail_height
- + 2 * (focus_padding + focus_width))
- + DAY_YSEP * 5);
+ + 2 * (focus_padding + focus_width))
+ + DAY_YSEP * 5);
height = priv->header_h + priv->day_name_h + priv->main_h;
@@ -2123,8 +2123,8 @@ gtk_calendar_get_preferred_height (GtkWidget *widget,
}
static void
-gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_calendar_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
@@ -2144,23 +2144,23 @@ gtk_calendar_size_allocate (GtkWidget *widget,
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
{
priv->day_width = (priv->min_day_width
- * ((allocation->width - (inner_border * 2) - padding.left - padding.right
- - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
- / (7 * priv->min_day_width + priv->max_week_char_width * 2));
+ * ((allocation->width - (inner_border * 2) - padding.left - padding.right
+ - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2))
+ / (7 * priv->min_day_width + priv->max_week_char_width * 2));
priv->week_width = ((allocation->width - (inner_border * 2) - padding.left - padding.right
- - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
- - priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
- }
- else
+ - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - calendar_xsep * 2 )
+ - priv->day_width * 7 + CALENDAR_MARGIN + calendar_xsep);
+ }
+ else
{
priv->day_width = (allocation->width
- - (inner_border * 2)
+ - (inner_border * 2)
- padding.left - padding.right
- - (CALENDAR_MARGIN * 2)
- - (DAY_XSEP * 6))/7;
+ - (CALENDAR_MARGIN * 2)
+ - (DAY_XSEP * 6))/7;
priv->week_width = 0;
}
-
+
if (gtk_widget_get_realized (widget))
{
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
@@ -2269,26 +2269,26 @@ calendar_paint_header (GtkCalendar *calendar, cairo_t *cr)
str = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
layout = gtk_widget_create_pango_layout (widget, str);
g_free (str);
-
+
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
+
/* Draw title */
y = (priv->header_h - logical_rect.height) / 2;
-
+
/* Draw year and its arrows */
-
+
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
if (year_left)
x = 3 + (max_year_width - logical_rect.width)/2;
else
x = header_width - (3 + max_year_width
- - (max_year_width - logical_rect.width)/2);
+ - (max_year_width - logical_rect.width)/2);
else
if (year_left)
x = 3 + priv->arrow_width + (max_year_width - logical_rect.width)/2;
else
x = header_width - (3 + priv->arrow_width + max_year_width
- - (max_year_width - logical_rect.width)/2);
+ - (max_year_width - logical_rect.width)/2);
gtk_render_layout (context, cr, x, y, layout);
@@ -2300,13 +2300,13 @@ calendar_paint_header (GtkCalendar *calendar, cairo_t *cr)
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
if (year_left)
x = header_width - (3 + max_month_width
- - (max_month_width - logical_rect.width)/2);
+ - (max_month_width - logical_rect.width)/2);
else
x = 3 + (max_month_width - logical_rect.width) / 2;
else
if (year_left)
x = header_width - (3 + priv->arrow_width + max_month_width
- - (max_month_width - logical_rect.width)/2);
+ - (max_month_width - logical_rect.width)/2);
else
x = 3 + priv->arrow_width + (max_month_width - logical_rect.width)/2;
@@ -2350,16 +2350,16 @@ calendar_paint_day_names (GtkCalendar *calendar,
priv->header_h + padding.top + inner_border);
gtk_widget_style_get (GTK_WIDGET (widget),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_padding,
- NULL);
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_padding,
+ NULL);
gtk_widget_get_allocation (widget, &allocation);
day_width = priv->day_width;
cal_width = allocation.width - (inner_border * 2) - padding.left - padding.right;
day_wid_sep = day_width + DAY_XSEP;
-
+
/*
* Draw rectangles as inverted background for the labels.
*/
@@ -2387,9 +2387,9 @@ calendar_paint_day_names (GtkCalendar *calendar,
for (i = 0; i < 7; i++)
{
if (gtk_widget_get_direction (GTK_WIDGET (calendar)) == GTK_TEXT_DIR_RTL)
- day = 6 - i;
+ day = 6 - i;
else
- day = i;
+ day = i;
day = (day + priv->week_start) % 7;
g_snprintf (buffer, sizeof (buffer), "%s", default_abbreviated_dayname[day]);
@@ -2447,9 +2447,9 @@ calendar_paint_week_numbers (GtkCalendar *calendar,
x = gtk_widget_get_allocated_width (widget) - priv->week_width - (padding.right + inner_border);
gtk_widget_style_get (GTK_WIDGET (widget),
- "focus-line-width", &focus_width,
- "focus-padding", &focus_padding,
- NULL);
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_padding,
+ NULL);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
@@ -2479,11 +2479,11 @@ calendar_paint_week_numbers (GtkCalendar *calendar,
year = priv->year;
if (priv->day[row][6] < 15 && row > 3 && priv->month == 11)
- year++;
+ year++;
result = week_of_year (&week, &year,
- ((priv->day[row][6] < 15 && row > 3 ? 1 : 0)
- + priv->month) % 12 + 1, priv->day[row][6]);
+ ((priv->day[row][6] < 15 && row > 3 ? 1 : 0)
+ + priv->month) % 12 + 1, priv->day[row][6]);
g_return_if_fail (result);
/* Translators: this defines whether the week numbers should use
@@ -2503,8 +2503,8 @@ calendar_paint_week_numbers (GtkCalendar *calendar,
y_loc = calendar_top_y_for_row (calendar, row) + (day_height - logical_rect.height) / 2;
x_loc = x + (priv->week_width
- - logical_rect.width
- - calendar_xsep - focus_padding - focus_width);
+ - logical_rect.width
+ - calendar_xsep - focus_padding - focus_width);
gtk_render_layout (context, cr, x_loc, y_loc, layout);
}
@@ -2517,32 +2517,32 @@ calendar_paint_week_numbers (GtkCalendar *calendar,
static void
calendar_invalidate_day_num (GtkCalendar *calendar,
- gint day)
+ gint day)
{
GtkCalendarPrivate *priv = calendar->priv;
gint r, c, row, col;
-
+
row = -1;
col = -1;
for (r = 0; r < 6; r++)
for (c = 0; c < 7; c++)
if (priv->day_month[r][c] == MONTH_CURRENT &&
- priv->day[r][c] == day)
- {
- row = r;
- col = c;
- }
-
+ priv->day[r][c] == day)
+ {
+ row = r;
+ col = c;
+ }
+
g_return_if_fail (row != -1);
g_return_if_fail (col != -1);
-
+
calendar_invalidate_day (calendar, row, col);
}
static void
calendar_invalidate_day (GtkCalendar *calendar,
- gint row,
- gint col)
+ gint row,
+ gint col)
{
GdkRectangle day_rect;
GtkAllocation allocation;
@@ -2566,8 +2566,8 @@ is_color_attribute (PangoAttribute *attribute,
static void
calendar_paint_day (GtkCalendar *calendar,
cairo_t *cr,
- gint row,
- gint col)
+ gint row,
+ gint col)
{
GtkWidget *widget = GTK_WIDGET (calendar);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
@@ -2644,7 +2644,7 @@ calendar_paint_day (GtkCalendar *calendar,
layout = gtk_widget_create_pango_layout (widget, buffer);
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
+
x_loc = day_rect.x + (day_rect.width - logical_rect.width) / 2;
y_loc = day_rect.y;
@@ -2729,7 +2729,7 @@ calendar_paint_main (GtkCalendar *calendar,
cairo_t *cr)
{
gint row, col;
-
+
cairo_save (cr);
for (col = 0; col < 7; col++)
@@ -2741,7 +2741,7 @@ calendar_paint_main (GtkCalendar *calendar,
static void
calendar_invalidate_arrow (GtkCalendar *calendar,
- guint arrow)
+ guint arrow)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
@@ -2854,7 +2854,7 @@ gtk_calendar_draw (GtkWidget *widget,
static void
calendar_arrow_action (GtkCalendar *calendar,
- guint arrow)
+ guint arrow)
{
switch (arrow)
{
@@ -2881,27 +2881,27 @@ calendar_timer (gpointer data)
GtkCalendar *calendar = data;
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
gboolean retval = FALSE;
-
+
if (priv->timer)
{
calendar_arrow_action (calendar, priv->click_child);
if (priv->need_timer)
- {
+ {
GtkSettings *settings;
guint timeout;
settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
- priv->need_timer = FALSE;
- priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
- timeout * SCROLL_DELAY_FACTOR,
- (GSourceFunc) calendar_timer,
- (gpointer) calendar, NULL);
- }
- else
- retval = TRUE;
+ priv->need_timer = FALSE;
+ priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
+ timeout * SCROLL_DELAY_FACTOR,
+ (GSourceFunc) calendar_timer,
+ (gpointer) calendar, NULL);
+ }
+ else
+ retval = TRUE;
}
return retval;
@@ -2909,12 +2909,12 @@ calendar_timer (gpointer data)
static void
calendar_start_spinning (GtkCalendar *calendar,
- gint click_child)
+ gint click_child)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
priv->click_child = click_child;
-
+
if (!priv->timer)
{
GtkSettings *settings;
@@ -2925,9 +2925,9 @@ calendar_start_spinning (GtkCalendar *calendar,
priv->need_timer = TRUE;
priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
- timeout,
- (GSourceFunc) calendar_timer,
- (gpointer) calendar, NULL);
+ timeout,
+ (GSourceFunc) calendar_timer,
+ (gpointer) calendar, NULL);
}
}
@@ -3020,27 +3020,27 @@ gtk_calendar_button_press (GtkWidget *widget,
for (arrow = ARROW_YEAR_LEFT; arrow <= ARROW_MONTH_RIGHT; arrow++)
{
if (event->window == priv->arrow_win[arrow])
- {
+ {
- /* only call the action on single click, not double */
- if (event->type == GDK_BUTTON_PRESS)
- {
- if (event->button == 1)
- calendar_start_spinning (calendar, arrow);
+ /* only call the action on single click, not double */
+ if (event->type == GDK_BUTTON_PRESS)
+ {
+ if (event->button == 1)
+ calendar_start_spinning (calendar, arrow);
- calendar_arrow_action (calendar, arrow);
- }
+ calendar_arrow_action (calendar, arrow);
+ }
- return TRUE;
- }
+ return TRUE;
+ }
}
return FALSE;
}
static gboolean
-gtk_calendar_button_release (GtkWidget *widget,
- GdkEventButton *event)
+gtk_calendar_button_release (GtkWidget *widget,
+ GdkEventButton *event)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
@@ -3050,21 +3050,17 @@ gtk_calendar_button_release (GtkWidget *widget,
calendar_stop_spinning (calendar);
if (priv->in_drag)
- priv->in_drag = 0;
+ priv->in_drag = 0;
}
return TRUE;
}
static gboolean
-gtk_calendar_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
+gtk_calendar_motion_notify (GtkWidget *widget,
+ GdkEventMotion *event)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
- gint event_x, event_y;
-
- event_x = (gint) (event->x);
- event_y = (gint) (event->y);
if (priv->in_drag)
{
@@ -3088,42 +3084,42 @@ gtk_calendar_motion_notify (GtkWidget *widget,
}
static gboolean
-gtk_calendar_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
+gtk_calendar_enter_notify (GtkWidget *widget,
+ GdkEventCrossing *event)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
-
+
if (event->window == priv->arrow_win[ARROW_MONTH_LEFT])
{
priv->arrow_state[ARROW_MONTH_LEFT] |= GTK_STATE_FLAG_PRELIGHT;
calendar_invalidate_arrow (calendar, ARROW_MONTH_LEFT);
}
-
+
if (event->window == priv->arrow_win[ARROW_MONTH_RIGHT])
{
priv->arrow_state[ARROW_MONTH_RIGHT] |= GTK_STATE_FLAG_PRELIGHT;
calendar_invalidate_arrow (calendar, ARROW_MONTH_RIGHT);
}
-
+
if (event->window == priv->arrow_win[ARROW_YEAR_LEFT])
{
priv->arrow_state[ARROW_YEAR_LEFT] |= GTK_STATE_FLAG_PRELIGHT;
calendar_invalidate_arrow (calendar, ARROW_YEAR_LEFT);
}
-
+
if (event->window == priv->arrow_win[ARROW_YEAR_RIGHT])
{
priv->arrow_state[ARROW_YEAR_RIGHT] |= GTK_STATE_FLAG_PRELIGHT;
calendar_invalidate_arrow (calendar, ARROW_YEAR_RIGHT);
}
-
+
return TRUE;
}
static gboolean
gtk_calendar_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
+ GdkEventCrossing *event)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
@@ -3133,44 +3129,44 @@ gtk_calendar_leave_notify (GtkWidget *widget,
priv->arrow_state[ARROW_MONTH_LEFT] &= ~(GTK_STATE_FLAG_PRELIGHT);
calendar_invalidate_arrow (calendar, ARROW_MONTH_LEFT);
}
-
+
if (event->window == priv->arrow_win[ARROW_MONTH_RIGHT])
{
priv->arrow_state[ARROW_MONTH_RIGHT] &= ~(GTK_STATE_FLAG_PRELIGHT);
calendar_invalidate_arrow (calendar, ARROW_MONTH_RIGHT);
}
-
+
if (event->window == priv->arrow_win[ARROW_YEAR_LEFT])
{
priv->arrow_state[ARROW_YEAR_LEFT] &= ~(GTK_STATE_FLAG_PRELIGHT);
calendar_invalidate_arrow (calendar, ARROW_YEAR_LEFT);
}
-
+
if (event->window == priv->arrow_win[ARROW_YEAR_RIGHT])
{
priv->arrow_state[ARROW_YEAR_RIGHT] &= ~(GTK_STATE_FLAG_PRELIGHT);
calendar_invalidate_arrow (calendar, ARROW_YEAR_RIGHT);
}
-
+
return TRUE;
}
static gboolean
gtk_calendar_scroll (GtkWidget *widget,
- GdkEventScroll *event)
+ GdkEventScroll *event)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- if (event->direction == GDK_SCROLL_UP)
+ if (event->direction == GDK_SCROLL_UP)
{
if (!gtk_widget_has_focus (widget))
- gtk_widget_grab_focus (widget);
+ gtk_widget_grab_focus (widget);
calendar_set_month_prev (calendar);
}
- else if (event->direction == GDK_SCROLL_DOWN)
+ else if (event->direction == GDK_SCROLL_DOWN)
{
if (!gtk_widget_has_focus (widget))
- gtk_widget_grab_focus (widget);
+ gtk_widget_grab_focus (widget);
calendar_set_month_next (calendar);
}
else
@@ -3184,38 +3180,38 @@ gtk_calendar_scroll (GtkWidget *widget,
* Key handling *
****************************************/
-static void
-move_focus (GtkCalendar *calendar,
- gint direction)
+static void
+move_focus (GtkCalendar *calendar,
+ gint direction)
{
GtkCalendarPrivate *priv = calendar->priv;
GtkTextDirection text_dir = gtk_widget_get_direction (GTK_WIDGET (calendar));
-
+
if ((text_dir == GTK_TEXT_DIR_LTR && direction == -1) ||
- (text_dir == GTK_TEXT_DIR_RTL && direction == 1))
+ (text_dir == GTK_TEXT_DIR_RTL && direction == 1))
{
if (priv->focus_col > 0)
- priv->focus_col--;
+ priv->focus_col--;
else if (priv->focus_row > 0)
- {
- priv->focus_col = 6;
- priv->focus_row--;
- }
+ {
+ priv->focus_col = 6;
+ priv->focus_row--;
+ }
if (priv->focus_col < 0)
priv->focus_col = 6;
if (priv->focus_row < 0)
priv->focus_row = 5;
}
- else
+ else
{
if (priv->focus_col < 6)
- priv->focus_col++;
+ priv->focus_col++;
else if (priv->focus_row < 5)
- {
- priv->focus_col = 0;
- priv->focus_row++;
- }
+ {
+ priv->focus_col = 0;
+ priv->focus_row++;
+ }
if (priv->focus_col < 0)
priv->focus_col = 0;
@@ -3226,7 +3222,7 @@ move_focus (GtkCalendar *calendar,
static gboolean
gtk_calendar_key_press (GtkWidget *widget,
- GdkEventKey *event)
+ GdkEventKey *event)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
@@ -3246,81 +3242,81 @@ gtk_calendar_key_press (GtkWidget *widget,
case GDK_KEY_Left:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
- calendar_set_month_prev (calendar);
+ calendar_set_month_prev (calendar);
else
- {
- move_focus (calendar, -1);
- calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
- calendar_invalidate_day (calendar, priv->focus_row,
- priv->focus_col);
- }
+ {
+ move_focus (calendar, -1);
+ calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
+ calendar_invalidate_day (calendar, priv->focus_row,
+ priv->focus_col);
+ }
break;
case GDK_KEY_KP_Right:
case GDK_KEY_Right:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
- calendar_set_month_next (calendar);
+ calendar_set_month_next (calendar);
else
- {
- move_focus (calendar, 1);
- calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
- calendar_invalidate_day (calendar, priv->focus_row,
- priv->focus_col);
- }
+ {
+ move_focus (calendar, 1);
+ calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
+ calendar_invalidate_day (calendar, priv->focus_row,
+ priv->focus_col);
+ }
break;
case GDK_KEY_KP_Up:
case GDK_KEY_Up:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
- calendar_set_year_prev (calendar);
+ calendar_set_year_prev (calendar);
else
- {
- if (priv->focus_row > 0)
- priv->focus_row--;
+ {
+ if (priv->focus_row > 0)
+ priv->focus_row--;
if (priv->focus_row < 0)
priv->focus_row = 5;
if (priv->focus_col < 0)
priv->focus_col = 6;
- calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
- calendar_invalidate_day (calendar, priv->focus_row,
- priv->focus_col);
- }
+ calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
+ calendar_invalidate_day (calendar, priv->focus_row,
+ priv->focus_col);
+ }
break;
case GDK_KEY_KP_Down:
case GDK_KEY_Down:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
- calendar_set_year_next (calendar);
+ calendar_set_year_next (calendar);
else
- {
- if (priv->focus_row < 5)
- priv->focus_row++;
+ {
+ if (priv->focus_row < 5)
+ priv->focus_row++;
if (priv->focus_col < 0)
priv->focus_col = 0;
- calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
- calendar_invalidate_day (calendar, priv->focus_row,
- priv->focus_col);
- }
+ calendar_invalidate_day (calendar, old_focus_row, old_focus_col);
+ calendar_invalidate_day (calendar, priv->focus_row,
+ priv->focus_col);
+ }
break;
case GDK_KEY_KP_Space:
case GDK_KEY_space:
row = priv->focus_row;
col = priv->focus_col;
-
+
if (row > -1 && col > -1)
- {
- return_val = TRUE;
+ {
+ return_val = TRUE;
day = priv->day[row][col];
- if (priv->day_month[row][col] == MONTH_PREV)
- calendar_set_month_prev (calendar);
- else if (priv->day_month[row][col] == MONTH_NEXT)
- calendar_set_month_next (calendar);
-
- calendar_select_and_focus_day (calendar, day);
- }
- }
-
+ if (priv->day_month[row][col] == MONTH_PREV)
+ calendar_set_month_prev (calendar);
+ else if (priv->day_month[row][col] == MONTH_NEXT)
+ calendar_set_month_next (calendar);
+
+ calendar_select_and_focus_day (calendar, day);
+ }
+ }
+
return return_val;
}
@@ -3352,7 +3348,7 @@ gtk_calendar_state_flags_changed (GtkWidget *widget,
static void
gtk_calendar_grab_notify (GtkWidget *widget,
- gboolean was_grabbed)
+ gboolean was_grabbed)
{
if (!was_grabbed)
calendar_stop_spinning (GTK_CALENDAR (widget));
@@ -3360,7 +3356,7 @@ gtk_calendar_grab_notify (GtkWidget *widget,
static gboolean
gtk_calendar_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
+ GdkEventFocus *event)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
GtkCalendar *calendar = GTK_CALENDAR (widget);
@@ -3380,10 +3376,10 @@ gtk_calendar_focus_out (GtkWidget *widget,
static void
gtk_calendar_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time)
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
@@ -3394,7 +3390,7 @@ gtk_calendar_drag_data_get (GtkWidget *widget,
date = g_date_new_dmy (priv->selected_day, priv->month + 1, priv->year);
len = g_date_strftime (str, 127, "%x", date);
gtk_selection_data_set_text (selection_data, str, len);
-
+
g_free (date);
}
@@ -3420,22 +3416,22 @@ get_status_pending (GdkDragContext *context)
static void
gtk_calendar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time)
+ GdkDragContext *context,
+ guint time)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
priv->drag_highlight = 0;
gtk_drag_unhighlight (widget);
-
+
}
static gboolean
gtk_calendar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time)
{
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget);
GdkAtom target;
@@ -3454,25 +3450,25 @@ gtk_calendar_drag_motion (GtkWidget *widget,
set_status_pending (context, gdk_drag_context_get_suggested_action (context));
gtk_drag_get_data (widget, context, target, time);
}
-
+
return TRUE;
}
static gboolean
gtk_calendar_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time)
{
GdkAtom target;
- target = gtk_drag_dest_find_target (widget, context, NULL);
+ target = gtk_drag_dest_find_target (widget, context, NULL);
if (target != GDK_NONE)
{
- gtk_drag_get_data (widget, context,
- target,
- time);
+ gtk_drag_get_data (widget, context,
+ target,
+ time);
return TRUE;
}
@@ -3481,12 +3477,12 @@ gtk_calendar_drag_drop (GtkWidget *widget,
static void
gtk_calendar_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time)
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
@@ -3497,10 +3493,10 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
suggested_action = get_status_pending (context);
- if (suggested_action)
+ if (suggested_action)
{
set_status_pending (context, 0);
-
+
/* We are getting this data due to a request in drag_motion,
* rather than due to a request in drag_drop, so we are just
* supposed to call drag_status, not actually paste in the
@@ -3508,17 +3504,17 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
*/
str = (gchar*) gtk_selection_data_get_text (selection_data);
- if (str)
- {
- date = g_date_new ();
- g_date_set_parse (date, str);
- if (!g_date_valid (date))
- suggested_action = 0;
- g_date_free (date);
- g_free (str);
- }
+ if (str)
+ {
+ date = g_date_new ();
+ g_date_set_parse (date, str);
+ if (!g_date_valid (date))
+ suggested_action = 0;
+ g_date_free (date);
+ g_free (str);
+ }
else
- suggested_action = 0;
+ suggested_action = 0;
gdk_drag_status (context, suggested_action, time);
@@ -3527,16 +3523,16 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
date = g_date_new ();
str = (gchar*) gtk_selection_data_get_text (selection_data);
- if (str)
+ if (str)
{
g_date_set_parse (date, str);
g_free (str);
}
-
- if (!g_date_valid (date))
+
+ if (!g_date_valid (date))
{
g_warning ("Received invalid date data\n");
- g_date_free (date);
+ g_date_free (date);
gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
@@ -3544,17 +3540,17 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
day = g_date_get_day (date);
month = g_date_get_month (date);
year = g_date_get_year (date);
- g_date_free (date);
+ g_date_free (date);
gtk_drag_finish (context, TRUE, FALSE, time);
-
+
g_object_freeze_notify (G_OBJECT (calendar));
if (!(priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
&& (priv->display_flags & GTK_CALENDAR_SHOW_HEADING))
gtk_calendar_select_month (calendar, month - 1, year);
gtk_calendar_select_day (calendar, day);
- g_object_thaw_notify (G_OBJECT (calendar));
+ g_object_thaw_notify (G_OBJECT (calendar));
}
@@ -3564,9 +3560,9 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
/**
* gtk_calendar_new:
- *
- * Creates a new calendar, with the current date being selected.
- *
+ *
+ * Creates a new calendar, with the current date being selected.
+ *
* Return value: a newly #GtkCalendar widget
**/
GtkWidget*
@@ -3578,14 +3574,14 @@ gtk_calendar_new (void)
/**
* gtk_calendar_get_display_options:
* @calendar: a #GtkCalendar
- *
- * Returns the current display options of @calendar.
- *
+ *
+ * Returns the current display options of @calendar.
+ *
* Return value: the display options.
*
* Since: 2.4
**/
-GtkCalendarDisplayOptions
+GtkCalendarDisplayOptions
gtk_calendar_get_display_options (GtkCalendar *calendar)
{
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
@@ -3597,70 +3593,69 @@ gtk_calendar_get_display_options (GtkCalendar *calendar)
* gtk_calendar_set_display_options:
* @calendar: a #GtkCalendar
* @flags: the display options to set
- *
- * Sets display options (whether to display the heading and the month
+ *
+ * Sets display options (whether to display the heading and the month
* headings).
*
* Since: 2.4
**/
void
-gtk_calendar_set_display_options (GtkCalendar *calendar,
- GtkCalendarDisplayOptions flags)
+gtk_calendar_set_display_options (GtkCalendar *calendar,
+ GtkCalendarDisplayOptions flags)
{
GtkWidget *widget = GTK_WIDGET (calendar);
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
gint resize = 0;
GtkCalendarDisplayOptions old_flags;
-
+
g_return_if_fail (GTK_IS_CALENDAR (calendar));
-
+
old_flags = priv->display_flags;
-
+
if (gtk_widget_get_realized (widget))
{
if ((flags ^ priv->display_flags) & GTK_CALENDAR_NO_MONTH_CHANGE)
- {
- resize ++;
- if (! (flags & GTK_CALENDAR_NO_MONTH_CHANGE)
+ {
+ resize ++;
+ if (! (flags & GTK_CALENDAR_NO_MONTH_CHANGE)
&& (priv->display_flags & GTK_CALENDAR_SHOW_HEADING))
- {
- priv->display_flags &= ~GTK_CALENDAR_NO_MONTH_CHANGE;
- calendar_realize_arrows (calendar);
+ {
+ priv->display_flags &= ~GTK_CALENDAR_NO_MONTH_CHANGE;
+ calendar_realize_arrows (calendar);
if (gtk_widget_get_mapped (widget))
calendar_map_arrows (calendar);
- }
- else
- {
- calendar_unrealize_arrows (calendar);
- }
- }
-
+ }
+ else
+ {
+ calendar_unrealize_arrows (calendar);
+ }
+ }
+
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_HEADING)
- {
- resize++;
-
- if (flags & GTK_CALENDAR_SHOW_HEADING)
+ {
+ resize++;
+
+ if (flags & GTK_CALENDAR_SHOW_HEADING)
{
- priv->display_flags |= GTK_CALENDAR_SHOW_HEADING;
- calendar_realize_arrows (calendar);
+ priv->display_flags |= GTK_CALENDAR_SHOW_HEADING;
+ calendar_realize_arrows (calendar);
if (gtk_widget_get_mapped (widget))
calendar_map_arrows (calendar);
}
- else
- {
- calendar_unrealize_arrows (calendar);
- }
- }
-
-
+ else
+ {
+ calendar_unrealize_arrows (calendar);
+ }
+ }
+
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_DAY_NAMES)
- {
- resize++;
-
- if (flags & GTK_CALENDAR_SHOW_DAY_NAMES)
- priv->display_flags |= GTK_CALENDAR_SHOW_DAY_NAMES;
- }
-
+ {
+ resize++;
+
+ if (flags & GTK_CALENDAR_SHOW_DAY_NAMES)
+ priv->display_flags |= GTK_CALENDAR_SHOW_DAY_NAMES;
+ }
+
if ((flags ^ priv->display_flags) & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
{
resize++;
@@ -3674,7 +3669,7 @@ gtk_calendar_set_display_options (GtkCalendar *calendar,
priv->display_flags = flags;
if (resize)
- gtk_widget_queue_resize (GTK_WIDGET (calendar));
+ gtk_widget_queue_resize (GTK_WIDGET (calendar));
}
else
priv->display_flags = flags;
@@ -3701,8 +3696,8 @@ gtk_calendar_set_display_options (GtkCalendar *calendar,
**/
void
gtk_calendar_select_month (GtkCalendar *calendar,
- guint month,
- guint year)
+ guint month,
+ guint year)
{
GtkCalendarPrivate *priv;
@@ -3723,21 +3718,21 @@ gtk_calendar_select_month (GtkCalendar *calendar,
g_object_thaw_notify (G_OBJECT (calendar));
g_signal_emit (calendar,
- gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
- 0);
+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
+ 0);
}
/**
* gtk_calendar_select_day:
* @calendar: a #GtkCalendar.
- * @day: the day number between 1 and 31, or 0 to unselect
+ * @day: the day number between 1 and 31, or 0 to unselect
* the currently selected day.
- *
+ *
* Selects a day from the current month.
**/
void
gtk_calendar_select_day (GtkCalendar *calendar,
- guint day)
+ guint day)
{
GtkCalendarPrivate *priv;
@@ -3750,33 +3745,33 @@ gtk_calendar_select_day (GtkCalendar *calendar,
if (priv->selected_day > 0)
{
gint selected_day;
-
+
selected_day = priv->selected_day;
priv->selected_day = 0;
if (gtk_widget_is_drawable (GTK_WIDGET (calendar)))
- calendar_invalidate_day_num (calendar, selected_day);
+ calendar_invalidate_day_num (calendar, selected_day);
}
-
+
priv->selected_day = day;
-
+
/* Select the new day */
if (day != 0)
{
if (gtk_widget_is_drawable (GTK_WIDGET (calendar)))
- calendar_invalidate_day_num (calendar, day);
+ calendar_invalidate_day_num (calendar, day);
}
-
+
g_object_notify (G_OBJECT (calendar), "day");
g_signal_emit (calendar,
- gtk_calendar_signals[DAY_SELECTED_SIGNAL],
- 0);
+ gtk_calendar_signals[DAY_SELECTED_SIGNAL],
+ 0);
}
/**
* gtk_calendar_clear_marks:
* @calendar: a #GtkCalendar
- *
+ *
* Remove all visual markers.
**/
void
@@ -3807,7 +3802,7 @@ gtk_calendar_clear_marks (GtkCalendar *calendar)
*/
void
gtk_calendar_mark_day (GtkCalendar *calendar,
- guint day)
+ guint day)
{
GtkCalendarPrivate *priv;
@@ -3859,7 +3854,7 @@ gtk_calendar_get_day_is_marked (GtkCalendar *calendar,
*/
void
gtk_calendar_unmark_day (GtkCalendar *calendar,
- guint day)
+ guint day)
{
GtkCalendarPrivate *priv;
@@ -3889,9 +3884,9 @@ gtk_calendar_unmark_day (GtkCalendar *calendar,
*/
void
gtk_calendar_get_date (GtkCalendar *calendar,
- guint *year,
- guint *month,
- guint *day)
+ guint *year,
+ guint *month,
+ guint *day)
{
GtkCalendarPrivate *priv;
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c
index 2315871..bd13672 100644
--- a/gtk/gtkcellarea.c
+++ b/gtk/gtkcellarea.c
@@ -3574,8 +3574,7 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
gint *minimum_size,
gint *natural_size)
{
- GtkCellAreaPrivate *priv;
- gint focus_line_width;
+ gint focus_line_width;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
@@ -3583,8 +3582,6 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
g_return_if_fail (minimum_size != NULL);
g_return_if_fail (natural_size != NULL);
- priv = area->priv;
-
gtk_widget_style_get (widget, "focus-line-width", &focus_line_width, NULL);
focus_line_width *= 2;
diff --git a/gtk/gtkcellareaboxcontext.c b/gtk/gtkcellareaboxcontext.c
index 57793c7..de1b310 100644
--- a/gtk/gtkcellareaboxcontext.c
+++ b/gtk/gtkcellareaboxcontext.c
@@ -744,14 +744,12 @@ allocate_for_orientation (GtkCellAreaBoxContext *context,
GtkCellAreaBoxContextPrivate *priv = context->priv;
GtkCellAreaBoxAllocation *allocs;
GtkRequestedSize *sizes;
- GArray *array;
gint n_expand_groups = 0;
gint i, n_groups, position, vis_position;
gint extra_size, extra_extra;
gint avail_size = size;
sizes = _gtk_cell_area_box_context_get_requests (context, area, orientation, for_size, &n_groups);
- array = get_array (context, orientation, for_size);
n_expand_groups = count_expand_groups (context);
/* First start by naturally allocating space among groups */
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index ced210e..8a7cd76 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -1113,7 +1113,7 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
*
* Checks whether the cell renderer can do something when activated.
*
- * Returns: %TRUE if the cell renderer can do anything when activated.
+ * Returns: %TRUE if the cell renderer can do anything when activated
*
* Since: 3.0
*/
@@ -1126,9 +1126,9 @@ gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
priv = cell->priv;
- return (cell->priv->visible &&
- (cell->priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
- cell->priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
+ return (priv->visible &&
+ (priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
+ priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
}
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index e609fe7..9f92515 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -191,14 +191,12 @@ gtk_cell_renderer_spinner_update_size (GtkCellRendererSpinner *cell,
{
GtkCellRendererSpinnerPrivate *priv = cell->priv;
GdkScreen *screen;
- GtkIconTheme *icon_theme;
GtkSettings *settings;
- if (cell->priv->old_icon_size == cell->priv->icon_size)
+ if (priv->old_icon_size == priv->icon_size)
return;
screen = gtk_widget_get_screen (GTK_WIDGET (widget));
- icon_theme = gtk_icon_theme_get_for_screen (screen);
settings = gtk_settings_get_for_screen (screen);
if (!gtk_icon_size_lookup_for_settings (settings, priv->icon_size, &priv->size, NULL))
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 6e2acc4..e15deb7 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -2109,14 +2109,14 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
gint *minimum_size,
gint *natural_size)
{
- GtkCellRendererTextPrivate *priv;
+ GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
GtkStyle *style;
PangoLayout *layout;
PangoContext *context;
PangoFontMetrics *metrics;
PangoRectangle rect;
- gint char_width, digit_width, char_pixels, text_width, ellipsize_chars, xpad;
+ gint char_width, text_width, ellipsize_chars, xpad;
gint min_width, nat_width;
/* "width-chars" Hard-coded minimum width:
@@ -2145,11 +2145,9 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
/* Fetch the average size of a charachter */
context = pango_layout_get_context (layout);
metrics = pango_context_get_metrics (context, style->font_desc,
- pango_context_get_language (context));
-
+ pango_context_get_language (context));
+
char_width = pango_font_metrics_get_approximate_char_width (metrics);
- digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
- char_pixels = MAX (char_width, digit_width);
pango_font_metrics_unref (metrics);
g_object_unref (layout);
@@ -2159,12 +2157,11 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
ellipsize_chars = 3;
else
ellipsize_chars = 0;
-
+
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
- min_width =
- xpad * 2 +
- MIN (PANGO_PIXELS_CEIL (text_width),
- (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
+ min_width = xpad * 2 +
+ MIN (PANGO_PIXELS_CEIL (text_width),
+ (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
/* If no width-chars set, minimum for wrapping text will be the wrap-width */
else if (priv->wrap_width > -1)
min_width = xpad * 2 + rect.x + MIN (PANGO_PIXELS_CEIL (text_width), priv->wrap_width);
@@ -2172,14 +2169,13 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
min_width = xpad * 2 + rect.x + PANGO_PIXELS_CEIL (text_width);
if (priv->width_chars > 0)
- nat_width = xpad * 2 +
+ nat_width = xpad * 2 +
MAX ((PANGO_PIXELS (char_width) * priv->width_chars), PANGO_PIXELS_CEIL (text_width));
else
nat_width = xpad * 2 + PANGO_PIXELS_CEIL (text_width);
-
nat_width = MAX (nat_width, min_width);
-
+
if (priv->max_width_chars > 0)
{
gint max_width = xpad * 2 + PANGO_PIXELS (char_width) * priv->max_width_chars;
@@ -2202,14 +2198,12 @@ gtk_cell_renderer_text_get_preferred_height_for_width (GtkCellRenderer *cell,
gint *minimum_height,
gint *natural_height)
{
- GtkCellRendererTextPrivate *priv;
- GtkCellRendererText *celltext;
- PangoLayout *layout;
- gint text_height, xpad, ypad;
+ GtkCellRendererText *celltext;
+ PangoLayout *layout;
+ gint text_height, xpad, ypad;
celltext = GTK_CELL_RENDERER_TEXT (cell);
- priv = celltext->priv;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index f91a27d..850a811 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -506,9 +506,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
priv->always_show_toggle ||
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
{
- GdkWindow *window;
-
- window = gtk_widget_get_window (widget);
gtk_style_context_save (context);
if (priv->inconsistent)
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index c5f05fb..cc55ab3 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -22,7 +22,7 @@
* Modified by the GTK+ Team and others 1997-2001. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -95,7 +95,7 @@
#define SAMPLE_WIDTH 64
#define SAMPLE_HEIGHT 28
-#define CHECK_SIZE 16
+#define CHECK_SIZE 16
#define BIG_STEP 20
/* Conversion between 0->1 double and and guint16. See
@@ -133,16 +133,16 @@ enum {
struct _GtkColorSelectionPrivate
{
- guint has_opacity : 1;
- guint has_palette : 1;
- guint changing : 1;
- guint default_set : 1;
+ guint has_opacity : 1;
+ guint has_palette : 1;
+ guint changing : 1;
+ guint default_set : 1;
guint default_alpha_set : 1;
- guint has_grab : 1;
-
+ guint has_grab : 1;
+
gdouble color[COLORSEL_NUM_CHANNELS];
gdouble old_color[COLORSEL_NUM_CHANNELS];
-
+
GtkWidget *triangle_colorsel;
GtkWidget *hue_spinbutton;
GtkWidget *sat_spinbutton;
@@ -155,10 +155,10 @@ struct _GtkColorSelectionPrivate
GtkWidget *opacity_entry;
GtkWidget *palette_frame;
GtkWidget *hex_entry;
-
+
/* The Palette code */
GtkWidget *custom_palette [GTK_CUSTOM_PALETTE_WIDTH][GTK_CUSTOM_PALETTE_HEIGHT];
-
+
/* The color_sample stuff */
GtkWidget *sample_area;
GtkWidget *old_sample;
@@ -176,77 +176,77 @@ struct _GtkColorSelectionPrivate
};
-static void gtk_color_selection_destroy (GtkWidget *widget);
-static void gtk_color_selection_finalize (GObject *object);
-static void update_color (GtkColorSelection *colorsel);
+static void gtk_color_selection_destroy (GtkWidget *widget);
+static void gtk_color_selection_finalize (GObject *object);
+static void update_color (GtkColorSelection *colorsel);
static void gtk_color_selection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gtk_color_selection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void gtk_color_selection_realize (GtkWidget *widget);
static void gtk_color_selection_unrealize (GtkWidget *widget);
static void gtk_color_selection_show_all (GtkWidget *widget);
static gboolean gtk_color_selection_grab_broken (GtkWidget *widget,
- GdkEventGrabBroken *event);
+ GdkEventGrabBroken *event);
static void gtk_color_selection_set_palette_color (GtkColorSelection *colorsel,
gint index,
GdkColor *color);
static void set_focus_line_attributes (GtkWidget *drawing_area,
- cairo_t *cr,
- gint *focus_width);
+ cairo_t *cr,
+ gint *focus_width);
static void default_noscreen_change_palette_func (const GdkColor *colors,
- gint n_colors);
-static void default_change_palette_func (GdkScreen *screen,
- const GdkColor *colors,
- gint n_colors);
+ gint n_colors);
+static void default_change_palette_func (GdkScreen *screen,
+ const GdkColor *colors,
+ gint n_colors);
static void make_control_relations (AtkObject *atk_obj,
GtkWidget *widget);
static void make_all_relations (AtkObject *atk_obj,
GtkColorSelectionPrivate *priv);
-static void hsv_changed (GtkWidget *hsv,
- gpointer data);
-static void get_screen_color (GtkWidget *button);
-static void adjustment_changed (GtkAdjustment *adjustment,
- gpointer data);
-static void opacity_entry_changed (GtkWidget *opacity_entry,
- gpointer data);
-static void hex_changed (GtkWidget *hex_entry,
- gpointer data);
-static gboolean hex_focus_out (GtkWidget *hex_entry,
- GdkEventFocus *event,
- gpointer data);
-static void color_sample_new (GtkColorSelection *colorsel);
-static void make_label_spinbutton (GtkColorSelection *colorsel,
- GtkWidget **spinbutton,
- gchar *text,
- GtkWidget *table,
- gint i,
- gint j,
- gint channel_type,
- const gchar *tooltip);
-static void make_palette_frame (GtkColorSelection *colorsel,
- GtkWidget *table,
- gint i,
- gint j);
-static void set_selected_palette (GtkColorSelection *colorsel,
- int x,
- int y);
-static void set_focus_line_attributes (GtkWidget *drawing_area,
- cairo_t *cr,
- gint *focus_width);
-static gboolean mouse_press (GtkWidget *invisible,
- GdkEventButton *event,
- gpointer data);
+static void hsv_changed (GtkWidget *hsv,
+ gpointer data);
+static void get_screen_color (GtkWidget *button);
+static void adjustment_changed (GtkAdjustment *adjustment,
+ gpointer data);
+static void opacity_entry_changed (GtkWidget *opacity_entry,
+ gpointer data);
+static void hex_changed (GtkWidget *hex_entry,
+ gpointer data);
+static gboolean hex_focus_out (GtkWidget *hex_entry,
+ GdkEventFocus *event,
+ gpointer data);
+static void color_sample_new (GtkColorSelection *colorsel);
+static void make_label_spinbutton (GtkColorSelection *colorsel,
+ GtkWidget **spinbutton,
+ gchar *text,
+ GtkWidget *table,
+ gint i,
+ gint j,
+ gint channel_type,
+ const gchar *tooltip);
+static void make_palette_frame (GtkColorSelection *colorsel,
+ GtkWidget *table,
+ gint i,
+ gint j);
+static void set_selected_palette (GtkColorSelection *colorsel,
+ int x,
+ int y);
+static void set_focus_line_attributes (GtkWidget *drawing_area,
+ cairo_t *cr,
+ gint *focus_width);
+static gboolean mouse_press (GtkWidget *invisible,
+ GdkEventButton *event,
+ gpointer data);
static void palette_change_notify_instance (GObject *object,
- GParamSpec *pspec,
- gpointer data);
+ GParamSpec *pspec,
+ gpointer data);
static void update_palette (GtkColorSelection *colorsel);
static void shutdown_eyedropper (GtkWidget *widget);
@@ -305,7 +305,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
-
+
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = gtk_color_selection_finalize;
gobject_class->set_property = gtk_color_selection_set_property;
@@ -317,21 +317,21 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
widget_class->unrealize = gtk_color_selection_unrealize;
widget_class->show_all = gtk_color_selection_show_all;
widget_class->grab_broken_event = gtk_color_selection_grab_broken;
-
+
g_object_class_install_property (gobject_class,
PROP_HAS_OPACITY_CONTROL,
g_param_spec_boolean ("has-opacity-control",
- P_("Has Opacity Control"),
- P_("Whether the color selector should allow setting opacity"),
- FALSE,
- GTK_PARAM_READWRITE));
+ P_("Has Opacity Control"),
+ P_("Whether the color selector should allow setting opacity"),
+ FALSE,
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_HAS_PALETTE,
g_param_spec_boolean ("has-palette",
- P_("Has palette"),
- P_("Whether a palette should be used"),
- FALSE,
- GTK_PARAM_READWRITE));
+ P_("Has palette"),
+ P_("Whether a palette should be used"),
+ FALSE,
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_CURRENT_COLOR,
g_param_spec_boxed ("current-color",
@@ -342,10 +342,10 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
g_object_class_install_property (gobject_class,
PROP_CURRENT_ALPHA,
g_param_spec_uint ("current-alpha",
- P_("Current Alpha"),
- P_("The current opacity value (0 fully transparent, 65535 fully opaque)"),
- 0, 65535, 65535,
- GTK_PARAM_READWRITE));
+ P_("Current Alpha"),
+ P_("The current opacity value (0 fully transparent, 65535 fully opaque)"),
+ 0, 65535, 65535,
+ GTK_PARAM_READWRITE));
/**
* GtkColorSelection:current-rgba
@@ -371,12 +371,12 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
*/
color_selection_signals[COLOR_CHANGED] =
g_signal_new (I_("color-changed"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkColorSelectionClass, color_changed),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkColorSelectionClass, color_changed),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
g_type_class_add_private (gobject_class, sizeof (GtkColorSelectionPrivate));
}
@@ -393,17 +393,17 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
GtkColorSelectionPrivate *priv;
AtkObject *atk_obj;
GList *focus_chain = NULL;
-
+
gtk_widget_push_composite_child ();
priv = colorsel->private_data = G_TYPE_INSTANCE_GET_PRIVATE (colorsel, GTK_TYPE_COLOR_SELECTION, GtkColorSelectionPrivate);
priv->changing = FALSE;
priv->default_set = FALSE;
priv->default_alpha_set = FALSE;
-
+
top_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
-
+
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
priv->triangle_colorsel = gtk_hsv_new ();
g_signal_connect (priv->triangle_colorsel, "changed",
@@ -412,22 +412,24 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_box_pack_start (GTK_BOX (top_hbox), vbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0);
gtk_widget_set_tooltip_text (priv->triangle_colorsel,
- _("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
-
+ _("Select the color you want from the outer ring. "
+ "Select the darkness or lightness of that color "
+ "using the inner triangle."));
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
+
frame = gtk_frame_new (NULL);
gtk_widget_set_size_request (frame, -1, 30);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
color_sample_new (colorsel);
gtk_container_add (GTK_CONTAINER (frame), priv->sample_area);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
-
+
button = gtk_button_new ();
gtk_widget_set_events (button, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
- g_object_set_data (G_OBJECT (button), I_("COLORSEL"), colorsel);
+ g_object_set_data (G_OBJECT (button), I_("COLORSEL"), colorsel);
g_signal_connect (button, "clicked",
G_CALLBACK (get_screen_color), NULL);
picker_image = gtk_image_new_from_stock (GTK_STOCK_COLOR_PICKER, GTK_ICON_SIZE_BUTTON);
@@ -436,15 +438,16 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_set_tooltip_text (button,
- _("Click the eyedropper, then click a color anywhere on your screen to select that color."));
-
+ _("Click the eyedropper, then click a color "
+ "anywhere on your screen to select that color."));
+
top_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
table = gtk_table_new (8, 6, FALSE);
gtk_box_pack_start (GTK_BOX (top_right_vbox), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
-
+
make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), table, 0, 0, COLORSEL_HUE,
_("Position on the color wheel."));
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (priv->hue_spinbutton), TRUE);
@@ -458,13 +461,13 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
_("Amount of green light in the color."));
make_label_spinbutton (colorsel, &priv->blue_spinbutton, _("_Blue:"), table, 6, 2, COLORSEL_BLUE,
_("Amount of blue light in the color."));
- gtk_table_attach_defaults (GTK_TABLE (table), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), 0, 8, 3, 4);
+ gtk_table_attach_defaults (GTK_TABLE (table), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), 0, 8, 3, 4);
- priv->opacity_label = gtk_label_new_with_mnemonic (_("Op_acity:"));
- gtk_misc_set_alignment (GTK_MISC (priv->opacity_label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_label, 0, 1, 4, 5);
+ priv->opacity_label = gtk_label_new_with_mnemonic (_("Op_acity:"));
+ gtk_misc_set_alignment (GTK_MISC (priv->opacity_label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_label, 0, 1, 4, 5);
adjust = gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0);
- g_object_set_data (G_OBJECT (adjust), I_("COLORSEL"), colorsel);
+ g_object_set_data (G_OBJECT (adjust), I_("COLORSEL"), colorsel);
priv->opacity_slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjust);
gtk_widget_set_tooltip_text (priv->opacity_slider,
_("Transparency of the color."));
@@ -474,16 +477,16 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
g_signal_connect (adjust, "value-changed",
G_CALLBACK (adjustment_changed),
GINT_TO_POINTER (COLORSEL_OPACITY));
- gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_slider, 1, 7, 4, 5);
- priv->opacity_entry = gtk_entry_new ();
+ gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_slider, 1, 7, 4, 5);
+ priv->opacity_entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (priv->opacity_entry,
_("Transparency of the color."));
- gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
+ gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
g_signal_connect (priv->opacity_entry, "activate",
G_CALLBACK (opacity_entry_changed), colorsel);
gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_entry, 7, 8, 4, 5);
-
+
label = gtk_label_new_with_mnemonic (_("Color _name:"));
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -498,8 +501,10 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
G_CALLBACK (hex_focus_out), colorsel);
gtk_widget_set_tooltip_text (priv->hex_entry,
- _("You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry."));
-
+ _("You can enter an HTML-style hexadecimal color "
+ "value, or simply a color name such as 'orange' "
+ "in this entry."));
+
gtk_entry_set_width_chars (GTK_ENTRY (priv->hex_entry), 7);
gtk_table_attach_defaults (GTK_TABLE (table), priv->hex_entry, 1, 5, 5, 6);
@@ -522,9 +527,9 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
{
for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
- {
- make_palette_frame (colorsel, table, i, j);
- }
+ {
+ make_palette_frame (colorsel, table, i, j);
+ }
}
set_selected_palette (colorsel, 0, 0);
priv->palette_frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
@@ -534,21 +539,21 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
priv->custom_palette[0][0]);
-
+
gtk_box_pack_end (GTK_BOX (top_right_vbox), priv->palette_frame, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->palette_frame), table, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (top_hbox);
/* hide unused stuff */
-
+
if (priv->has_opacity == FALSE)
{
gtk_widget_hide (priv->opacity_label);
gtk_widget_hide (priv->opacity_slider);
gtk_widget_hide (priv->opacity_entry);
}
-
+
if (priv->has_palette == FALSE)
{
gtk_widget_hide (priv->palette_frame);
@@ -560,7 +565,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
atk_object_set_name (atk_obj, _("Color Wheel"));
atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (colorsel)), ATK_ROLE_COLOR_CHOOSER);
make_all_relations (atk_obj, priv);
- }
+ }
gtk_widget_pop_composite_child ();
}
@@ -574,21 +579,21 @@ gtk_color_selection_finalize (GObject *object)
static void
gtk_color_selection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (object);
-
+
switch (prop_id)
{
case PROP_HAS_OPACITY_CONTROL:
- gtk_color_selection_set_has_opacity_control (colorsel,
- g_value_get_boolean (value));
+ gtk_color_selection_set_has_opacity_control (colorsel,
+ g_value_get_boolean (value));
break;
case PROP_HAS_PALETTE:
- gtk_color_selection_set_has_palette (colorsel,
- g_value_get_boolean (value));
+ gtk_color_selection_set_has_palette (colorsel,
+ g_value_get_boolean (value));
break;
case PROP_CURRENT_COLOR:
gtk_color_selection_set_current_color (colorsel, g_value_get_boxed (value));
@@ -603,18 +608,18 @@ gtk_color_selection_set_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-
+
}
static void
gtk_color_selection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (object);
GdkColor color;
-
+
switch (prop_id)
{
case PROP_HAS_OPACITY_CONTROL:
@@ -669,9 +674,9 @@ gtk_color_selection_realize (GtkWidget *widget)
GtkSettings *settings = gtk_widget_get_settings (widget);
priv->settings_connection = g_signal_connect (settings,
- "notify::gtk-color-palette",
- G_CALLBACK (palette_change_notify_instance),
- widget);
+ "notify::gtk-color-palette",
+ G_CALLBACK (palette_change_notify_instance),
+ widget);
update_palette (colorsel);
GTK_WIDGET_CLASS (gtk_color_selection_parent_class)->realize (widget);
@@ -699,9 +704,9 @@ gtk_color_selection_show_all (GtkWidget *widget)
gtk_widget_show (widget);
}
-static gboolean
+static gboolean
gtk_color_selection_grab_broken (GtkWidget *widget,
- GdkEventGrabBroken *event)
+ GdkEventGrabBroken *event)
{
shutdown_eyedropper (widget);
@@ -721,11 +726,11 @@ static void color_sample_update_samples (GtkColorSelection *colorsel);
static void
set_color_internal (GtkColorSelection *colorsel,
- gdouble *color)
+ gdouble *color)
{
GtkColorSelectionPrivate *priv;
gint i;
-
+
priv = colorsel->private_data;
priv->changing = TRUE;
priv->color[COLORSEL_RED] = color[0];
@@ -733,15 +738,15 @@ set_color_internal (GtkColorSelection *colorsel,
priv->color[COLORSEL_BLUE] = color[2];
priv->color[COLORSEL_OPACITY] = color[3];
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
if (priv->default_set == FALSE)
{
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
- priv->old_color[i] = priv->color[i];
+ priv->old_color[i] = priv->color[i];
}
priv->default_set = TRUE;
priv->default_alpha_set = TRUE;
@@ -750,35 +755,35 @@ set_color_internal (GtkColorSelection *colorsel,
static void
set_color_icon (GdkDragContext *context,
- gdouble *colors)
+ gdouble *colors)
{
GdkPixbuf *pixbuf;
guint32 pixel;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE,
- 8, 48, 32);
+ 8, 48, 32);
pixel = (((UNSCALE (colors[COLORSEL_RED]) & 0xff00) << 16) |
- ((UNSCALE (colors[COLORSEL_GREEN]) & 0xff00) << 8) |
- ((UNSCALE (colors[COLORSEL_BLUE]) & 0xff00)));
+ ((UNSCALE (colors[COLORSEL_GREEN]) & 0xff00) << 8) |
+ ((UNSCALE (colors[COLORSEL_BLUE]) & 0xff00)));
gdk_pixbuf_fill (pixbuf, pixel);
-
+
gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
g_object_unref (pixbuf);
}
static void
color_sample_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
+ GdkDragContext *context,
+ gpointer data)
{
GtkColorSelection *colorsel = data;
GtkColorSelectionPrivate *priv;
gdouble *colsrc;
-
+
priv = colorsel->private_data;
-
+
if (widget == priv->old_sample)
colsrc = priv->old_color;
else
@@ -789,21 +794,21 @@ color_sample_drag_begin (GtkWidget *widget,
static void
color_sample_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
+ GdkDragContext *context,
+ gpointer data)
{
g_object_set_data (G_OBJECT (widget), I_("gtk-color-selection-drag-window"), NULL);
}
static void
color_sample_drop_handle (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer data)
{
GtkColorSelection *colorsel = data;
GtkColorSelectionPrivate *priv;
@@ -811,7 +816,7 @@ color_sample_drop_handle (GtkWidget *widget,
guint16 *vals;
gdouble color[4];
priv = colorsel->private_data;
-
+
/* This is currently a guint16 array of the format:
* R
* G
@@ -823,7 +828,7 @@ color_sample_drop_handle (GtkWidget *widget,
if (length < 0)
return;
-
+
/* We accept drops with the wrong format, since the KDE color
* chooser incorrectly drops application/x-color with format 8.
*/
@@ -841,39 +846,39 @@ color_sample_drop_handle (GtkWidget *widget,
color[1] = (gdouble)vals[1] / 0xffff;
color[2] = (gdouble)vals[2] / 0xffff;
color[3] = (gdouble)vals[3] / 0xffff;
-
+
set_color_internal (colorsel, color);
}
}
static void
color_sample_drag_handle (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer data)
{
GtkColorSelection *colorsel = data;
GtkColorSelectionPrivate *priv;
guint16 vals[4];
gdouble *colsrc;
-
+
priv = colorsel->private_data;
-
+
if (widget == priv->old_sample)
colsrc = priv->old_color;
else
colsrc = priv->color;
-
+
vals[0] = colsrc[COLORSEL_RED] * 0xffff;
vals[1] = colsrc[COLORSEL_GREEN] * 0xffff;
vals[2] = colsrc[COLORSEL_BLUE] * 0xffff;
vals[3] = priv->has_opacity ? colsrc[COLORSEL_OPACITY] * 0xffff : 0xffff;
-
+
gtk_selection_data_set (selection_data,
- gdk_atom_intern_static_string ("application/x-color"),
- 16, (guchar *)vals, 8);
+ gdk_atom_intern_static_string ("application/x-color"),
+ 16, (guchar *)vals, 8);
}
/* which = 0 means draw old sample, which = 1 means draw new */
@@ -886,10 +891,10 @@ color_sample_draw_sample (GtkColorSelection *colorsel,
gint x, y, goff;
GtkColorSelectionPrivate *priv;
int width, height;
-
+
g_return_if_fail (colorsel != NULL);
priv = colorsel->private_data;
-
+
g_return_if_fail (priv->sample_area != NULL);
if (!gtk_widget_is_drawable (priv->sample_area))
return;
@@ -908,10 +913,10 @@ color_sample_draw_sample (GtkColorSelection *colorsel,
goff = old_sample_allocation.width % 32;
}
- /* Below needs tweaking for non-power-of-two */
+ /* Below needs tweaking for non-power-of-two */
width = gtk_widget_get_allocated_width (da);
height = gtk_widget_get_allocated_height (da);
-
+
if (priv->has_opacity)
{
/* Draw checks in background */
@@ -922,29 +927,29 @@ color_sample_draw_sample (GtkColorSelection *colorsel,
cairo_set_source_rgb (cr, 0.75, 0.75, 0.75);
for (x = goff & -CHECK_SIZE; x < goff + width; x += CHECK_SIZE)
- for (y = 0; y < height; y += CHECK_SIZE)
- if ((x / CHECK_SIZE + y / CHECK_SIZE) % 2 == 0)
- cairo_rectangle (cr, x - goff, y, CHECK_SIZE, CHECK_SIZE);
+ for (y = 0; y < height; y += CHECK_SIZE)
+ if ((x / CHECK_SIZE + y / CHECK_SIZE) % 2 == 0)
+ cairo_rectangle (cr, x - goff, y, CHECK_SIZE, CHECK_SIZE);
cairo_fill (cr);
}
if (which == 0)
{
cairo_set_source_rgba (cr,
- priv->old_color[COLORSEL_RED],
- priv->old_color[COLORSEL_GREEN],
- priv->old_color[COLORSEL_BLUE],
- priv->has_opacity ?
- priv->old_color[COLORSEL_OPACITY] : 1.0);
+ priv->old_color[COLORSEL_RED],
+ priv->old_color[COLORSEL_GREEN],
+ priv->old_color[COLORSEL_BLUE],
+ priv->has_opacity ?
+ priv->old_color[COLORSEL_OPACITY] : 1.0);
}
else
{
cairo_set_source_rgba (cr,
- priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- priv->has_opacity ?
- priv->color[COLORSEL_OPACITY] : 1.0);
+ priv->color[COLORSEL_RED],
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ priv->has_opacity ?
+ priv->color[COLORSEL_OPACITY] : 1.0);
}
cairo_rectangle (cr, 0, 0, width, height);
@@ -987,37 +992,37 @@ color_sample_setup_dnd (GtkColorSelection *colorsel, GtkWidget *sample)
};
GtkColorSelectionPrivate *priv;
priv = colorsel->private_data;
-
+
gtk_drag_source_set (sample,
- GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
- targets, 1,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
+ GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
+ targets, 1,
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
g_signal_connect (sample, "drag-begin",
- G_CALLBACK (color_sample_drag_begin),
- colorsel);
+ G_CALLBACK (color_sample_drag_begin),
+ colorsel);
if (sample == priv->cur_sample)
{
-
+
gtk_drag_dest_set (sample,
- GTK_DEST_DEFAULT_HIGHLIGHT |
- GTK_DEST_DEFAULT_MOTION |
- GTK_DEST_DEFAULT_DROP,
- targets, 1,
- GDK_ACTION_COPY);
-
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets, 1,
+ GDK_ACTION_COPY);
+
g_signal_connect (sample, "drag-end",
- G_CALLBACK (color_sample_drag_end),
- colorsel);
+ G_CALLBACK (color_sample_drag_end),
+ colorsel);
}
-
+
g_signal_connect (sample, "drag-data-get",
- G_CALLBACK (color_sample_drag_handle),
- colorsel);
+ G_CALLBACK (color_sample_drag_handle),
+ colorsel);
g_signal_connect (sample, "drag-data-received",
- G_CALLBACK (color_sample_drop_handle),
- colorsel);
-
+ G_CALLBACK (color_sample_drop_handle),
+ colorsel);
+
}
static void
@@ -1030,18 +1035,23 @@ update_tooltips (GtkColorSelection *colorsel)
if (priv->has_palette == TRUE)
{
gtk_widget_set_tooltip_text (priv->old_sample,
- _("The previously-selected color, for comparison to the color you're selecting now. You can drag this color to a palette entry, or select this color as current by dragging it to the other color swatch alongside."));
+ _("The previously-selected color, for comparison to the color "
+ "you're selecting now. You can drag this color to a palette "
+ "entry, or select this color as current by dragging it to the "
+ "other color swatch alongside."));
gtk_widget_set_tooltip_text (priv->cur_sample,
- _("The color you've chosen. You can drag this color to a palette entry to save it for use in the future."));
+ _("The color you've chosen. You can drag this color to a palette "
+ "entry to save it for use in the future."));
}
else
{
gtk_widget_set_tooltip_text (priv->old_sample,
- _("The previously-selected color, for comparison to the color you're selecting now."));
+ _("The previously-selected color, for comparison to the color "
+ "you're selecting now."));
gtk_widget_set_tooltip_text (priv->cur_sample,
- _("The color you've chosen."));
+ _("The color you've chosen."));
}
}
@@ -1049,25 +1059,25 @@ static void
color_sample_new (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
priv = colorsel->private_data;
-
+
priv->sample_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
priv->old_sample = gtk_drawing_area_new ();
priv->cur_sample = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->old_sample,
- TRUE, TRUE, 0);
+ TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->cur_sample,
- TRUE, TRUE, 0);
-
+ TRUE, TRUE, 0);
+
g_signal_connect (priv->old_sample, "draw",
- G_CALLBACK (color_old_sample_draw),
- colorsel);
+ G_CALLBACK (color_old_sample_draw),
+ colorsel);
g_signal_connect (priv->cur_sample, "draw",
- G_CALLBACK (color_cur_sample_draw),
- colorsel);
-
+ G_CALLBACK (color_cur_sample_draw),
+ colorsel);
+
color_sample_setup_dnd (colorsel, priv->old_sample);
color_sample_setup_dnd (colorsel, priv->cur_sample);
@@ -1077,19 +1087,15 @@ color_sample_new (GtkColorSelection *colorsel)
}
-/*
- *
- * The palette area code
- *
- */
+/* The palette area code */
static void
palette_get_color (GtkWidget *drawing_area, gdouble *color)
{
gdouble *color_val;
-
+
g_return_if_fail (color != NULL);
-
+
color_val = g_object_get_data (G_OBJECT (drawing_area), "color_val");
if (color_val == NULL)
{
@@ -1100,7 +1106,7 @@ palette_get_color (GtkWidget *drawing_area, gdouble *color)
color[3] = 1.0;
return;
}
-
+
color[0] = color_val[0];
color[1] = color_val[1];
color[2] = color_val[2];
@@ -1110,7 +1116,7 @@ palette_get_color (GtkWidget *drawing_area, gdouble *color)
static gboolean
palette_draw (GtkWidget *drawing_area,
cairo_t *cr,
- gpointer data)
+ gpointer data)
{
GtkStyleContext *context;
gint focus_width;
@@ -1137,17 +1143,17 @@ palette_draw (GtkWidget *drawing_area,
static void
set_focus_line_attributes (GtkWidget *drawing_area,
- cairo_t *cr,
- gint *focus_width)
+ cairo_t *cr,
+ gint *focus_width)
{
gdouble color[4];
gint8 *dash_list;
-
+
gtk_widget_style_get (drawing_area,
- "focus-line-width", focus_width,
- "focus-line-pattern", (gchar *)&dash_list,
- NULL);
-
+ "focus-line-width", focus_width,
+ "focus-line-pattern", (gchar *)&dash_list,
+ NULL);
+
palette_get_color (drawing_area, color);
if (INTENSITY (color[0], color[1], color[2]) > 0.5)
@@ -1166,10 +1172,10 @@ set_focus_line_attributes (GtkWidget *drawing_area,
gint i;
for (i = 0; i < n_dashes; i++)
- {
- dashes[i] = dash_list[i];
- total_length += dash_list[i];
- }
+ {
+ dashes[i] = dash_list[i];
+ total_length += dash_list[i];
+ }
/* The dash offset here aligns the pattern to integer pixels
* by starting the dash at the right side of the left border
@@ -1178,8 +1184,8 @@ set_focus_line_attributes (GtkWidget *drawing_area,
*/
dash_offset = - *focus_width / 2.;
while (dash_offset < 0)
- dash_offset += total_length;
-
+ dash_offset += total_length;
+
cairo_set_dash (cr, dashes, n_dashes, dash_offset);
g_free (dashes);
}
@@ -1189,42 +1195,42 @@ set_focus_line_attributes (GtkWidget *drawing_area,
static void
palette_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
+ GdkDragContext *context,
+ gpointer data)
{
gdouble colors[4];
-
+
palette_get_color (widget, colors);
set_color_icon (context, colors);
}
static void
palette_drag_handle (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer data)
{
guint16 vals[4];
gdouble colsrc[4];
-
+
palette_get_color (widget, colsrc);
-
+
vals[0] = colsrc[COLORSEL_RED] * 0xffff;
vals[1] = colsrc[COLORSEL_GREEN] * 0xffff;
vals[2] = colsrc[COLORSEL_BLUE] * 0xffff;
vals[3] = 0xffff;
-
+
gtk_selection_data_set (selection_data,
- gdk_atom_intern_static_string ("application/x-color"),
- 16, (guchar *)vals, 8);
+ gdk_atom_intern_static_string ("application/x-color"),
+ 16, (guchar *)vals, 8);
}
static void
palette_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
+ GdkDragContext *context,
+ gpointer data)
{
g_object_set_data (G_OBJECT (widget), I_("gtk-color-selection-drag-window"), NULL);
}
@@ -1239,7 +1245,7 @@ get_current_colors (GtkColorSelection *colorsel)
settings = gtk_widget_get_settings (GTK_WIDGET (colorsel));
g_object_get (settings, "gtk-color-palette", &palette, NULL);
-
+
if (!gtk_color_selection_palette_from_string (palette, &colors, &n_colors))
{
gtk_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
@@ -1252,23 +1258,23 @@ get_current_colors (GtkColorSelection *colorsel)
* color selection, we fill in the rest from the defaults.
*/
if (n_colors < (GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT))
- {
- GdkColor *tmp_colors = colors;
- gint tmp_n_colors = n_colors;
-
- gtk_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
+ {
+ GdkColor *tmp_colors = colors;
+ gint tmp_n_colors = n_colors;
+
+ gtk_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE,
&colors,
&n_colors);
- memcpy (colors, tmp_colors, sizeof (GdkColor) * tmp_n_colors);
+ memcpy (colors, tmp_colors, sizeof (GdkColor) * tmp_n_colors);
- g_free (tmp_colors);
- }
+ g_free (tmp_colors);
+ }
}
/* make sure that we fill every slot */
g_assert (n_colors == GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
g_free (palette);
-
+
return colors;
}
@@ -1286,16 +1292,16 @@ palette_change_color (GtkWidget *drawing_area,
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (GTK_IS_DRAWING_AREA (drawing_area));
-
+
priv = colorsel->private_data;
-
+
gdk_color.red = UNSCALE (color[0]);
gdk_color.green = UNSCALE (color[1]);
gdk_color.blue = UNSCALE (color[2]);
gdk_color.pixel = 0;
x = 0;
- y = 0; /* Quiet GCC */
+ y = 0; /* Quiet GCC */
while (x < GTK_CUSTOM_PALETTE_WIDTH)
{
y = 0;
@@ -1303,7 +1309,7 @@ palette_change_color (GtkWidget *drawing_area,
{
if (priv->custom_palette[x][y] == drawing_area)
goto out;
-
+
++y;
}
@@ -1311,7 +1317,7 @@ palette_change_color (GtkWidget *drawing_area,
}
out:
-
+
g_assert (x < GTK_CUSTOM_PALETTE_WIDTH || y < GTK_CUSTOM_PALETTE_HEIGHT);
current_colors = get_current_colors (colorsel);
@@ -1319,18 +1325,19 @@ palette_change_color (GtkWidget *drawing_area,
screen = gtk_widget_get_screen (GTK_WIDGET (colorsel));
if (change_palette_hook != default_change_palette_func)
- (* change_palette_hook) (screen, current_colors,
- GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+ (* change_palette_hook) (screen, current_colors,
+ GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
else if (noscreen_change_palette_hook != default_noscreen_change_palette_func)
{
if (screen != gdk_screen_get_default ())
- g_warning ("gtk_color_selection_set_change_palette_hook used by widget is not on the default screen.");
- (* noscreen_change_palette_hook) (current_colors,
- GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+ g_warning ("gtk_color_selection_set_change_palette_hook used by "
+ "widget is not on the default screen.");
+ (* noscreen_change_palette_hook) (current_colors,
+ GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
}
else
- (* change_palette_hook) (screen, current_colors,
- GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
+ (* change_palette_hook) (screen, current_colors,
+ GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT);
g_free (current_colors);
}
@@ -1338,45 +1345,46 @@ palette_change_color (GtkWidget *drawing_area,
/* Changes the view color */
static void
palette_set_color (GtkWidget *drawing_area,
- GtkColorSelection *colorsel,
- gdouble *color)
+ GtkColorSelection *colorsel,
+ gdouble *color)
{
gdouble *new_color = g_new (double, 4);
GdkColor gdk_color;
-
+
gdk_color.red = UNSCALE (color[0]);
gdk_color.green = UNSCALE (color[1]);
gdk_color.blue = UNSCALE (color[2]);
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &gdk_color);
-
+
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drawing_area), "color_set")) == 0)
{
static const GtkTargetEntry targets[] = {
- { "application/x-color", 0 }
+ { "application/x-color", 0 }
};
gtk_drag_source_set (drawing_area,
- GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
- targets, 1,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
+ GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
+ targets, 1,
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
g_signal_connect (drawing_area, "drag-begin",
- G_CALLBACK (palette_drag_begin),
- colorsel);
+ G_CALLBACK (palette_drag_begin),
+ colorsel);
g_signal_connect (drawing_area, "drag-data-get",
- G_CALLBACK (palette_drag_handle),
- colorsel);
-
+ G_CALLBACK (palette_drag_handle),
+ colorsel);
+
g_object_set_data (G_OBJECT (drawing_area), I_("color_set"),
- GINT_TO_POINTER (1));
+ GINT_TO_POINTER (1));
}
new_color[0] = color[0];
new_color[1] = color[1];
new_color[2] = color[2];
new_color[3] = 1.0;
-
- g_object_set_data_full (G_OBJECT (drawing_area), I_("color_val"), new_color, (GDestroyNotify)g_free);
+
+ g_object_set_data_full (G_OBJECT (drawing_area),
+ I_("color_val"), new_color, (GDestroyNotify)g_free);
}
static void
@@ -1384,16 +1392,16 @@ popup_position_func (GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
- gpointer user_data)
+ gpointer user_data)
{
GtkAllocation allocation;
GtkWidget *widget;
- GtkRequisition req;
+ GtkRequisition req;
gint root_x, root_y;
GdkScreen *screen;
-
+
widget = GTK_WIDGET (user_data);
-
+
g_return_if_fail (gtk_widget_get_realized (widget));
gdk_window_get_origin (gtk_widget_get_window (widget),
@@ -1422,13 +1430,13 @@ save_color_selected (GtkWidget *menuitem,
GtkColorSelectionPrivate *priv;
drawing_area = GTK_WIDGET (data);
-
+
colorsel = GTK_COLOR_SELECTION (g_object_get_data (G_OBJECT (drawing_area),
"gtk-color-sel"));
priv = colorsel->private_data;
-
- palette_change_color (drawing_area, colorsel, priv->color);
+
+ palette_change_color (drawing_area, colorsel, priv->color);
}
static void
@@ -1438,11 +1446,11 @@ do_popup (GtkColorSelection *colorsel,
{
GtkWidget *menu;
GtkWidget *mi;
-
+
g_object_set_data (G_OBJECT (drawing_area),
I_("gtk-color-sel"),
colorsel);
-
+
menu = gtk_menu_new ();
mi = gtk_menu_item_new_with_mnemonic (_("_Save color here"));
@@ -1450,7 +1458,7 @@ do_popup (GtkColorSelection *colorsel,
g_signal_connect (mi, "activate",
G_CALLBACK (save_color_selected),
drawing_area);
-
+
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
gtk_widget_show_all (mi);
@@ -1463,37 +1471,37 @@ do_popup (GtkColorSelection *colorsel,
static gboolean
palette_enter (GtkWidget *drawing_area,
- GdkEventCrossing *event,
- gpointer data)
+ GdkEventCrossing *event,
+ gpointer data)
{
g_object_set_data (G_OBJECT (drawing_area),
- I_("gtk-colorsel-have-pointer"),
- GUINT_TO_POINTER (TRUE));
+ I_("gtk-colorsel-have-pointer"),
+ GUINT_TO_POINTER (TRUE));
return FALSE;
}
static gboolean
palette_leave (GtkWidget *drawing_area,
- GdkEventCrossing *event,
- gpointer data)
+ GdkEventCrossing *event,
+ gpointer data)
{
g_object_set_data (G_OBJECT (drawing_area),
- I_("gtk-colorsel-have-pointer"),
- NULL);
+ I_("gtk-colorsel-have-pointer"),
+ NULL);
return FALSE;
}
static gboolean
palette_press (GtkWidget *drawing_area,
- GdkEventButton *event,
- gpointer data)
+ GdkEventButton *event,
+ gpointer data)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
gtk_widget_grab_focus (drawing_area);
-
+
if (event->button == 3 &&
event->type == GDK_BUTTON_PRESS)
{
@@ -1506,8 +1514,8 @@ palette_press (GtkWidget *drawing_area,
static gboolean
palette_release (GtkWidget *drawing_area,
- GdkEventButton *event,
- gpointer data)
+ GdkEventButton *event,
+ gpointer data)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
@@ -1515,7 +1523,7 @@ palette_release (GtkWidget *drawing_area,
if (event->button == 1 &&
g_object_get_data (G_OBJECT (drawing_area),
- "gtk-colorsel-have-pointer") != NULL)
+ "gtk-colorsel-have-pointer") != NULL)
{
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drawing_area), "color_set")) != 0)
{
@@ -1530,13 +1538,13 @@ palette_release (GtkWidget *drawing_area,
static void
palette_drop_handle (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time,
+ gpointer data)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
gint length;
@@ -1547,7 +1555,7 @@ palette_drop_handle (GtkWidget *widget,
if (length < 0)
return;
-
+
/* We accept drops with the wrong format, since the KDE color
* chooser incorrectly drops application/x-color with format 8.
*/
@@ -1569,8 +1577,8 @@ palette_drop_handle (GtkWidget *widget,
static gint
palette_activate (GtkWidget *widget,
- GdkEventKey *event,
- gpointer data)
+ GdkEventKey *event,
+ gpointer data)
{
/* should have a drawing area subclass with an activate signal */
if ((event->keyval == GDK_KEY_space) ||
@@ -1587,7 +1595,7 @@ palette_activate (GtkWidget *widget,
}
return TRUE;
}
-
+
return FALSE;
}
@@ -1600,69 +1608,64 @@ palette_popup (GtkWidget *widget,
do_popup (colorsel, widget, GDK_CURRENT_TIME);
return TRUE;
}
-
+
static GtkWidget*
palette_new (GtkColorSelection *colorsel)
{
GtkWidget *retval;
- GtkColorSelectionPrivate *priv;
-
+
static const GtkTargetEntry targets[] = {
{ "application/x-color", 0 }
};
- priv = colorsel->private_data;
-
retval = gtk_drawing_area_new ();
gtk_widget_set_can_focus (retval, TRUE);
-
- g_object_set_data (G_OBJECT (retval), I_("color_set"), GINT_TO_POINTER (0));
+
+ g_object_set_data (G_OBJECT (retval), I_("color_set"), GINT_TO_POINTER (0));
gtk_widget_set_events (retval, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_EXPOSURE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK);
-
+
g_signal_connect (retval, "draw",
- G_CALLBACK (palette_draw), colorsel);
+ G_CALLBACK (palette_draw), colorsel);
g_signal_connect (retval, "button-press-event",
- G_CALLBACK (palette_press), colorsel);
+ G_CALLBACK (palette_press), colorsel);
g_signal_connect (retval, "button-release-event",
- G_CALLBACK (palette_release), colorsel);
+ G_CALLBACK (palette_release), colorsel);
g_signal_connect (retval, "enter-notify-event",
- G_CALLBACK (palette_enter), colorsel);
+ G_CALLBACK (palette_enter), colorsel);
g_signal_connect (retval, "leave-notify-event",
- G_CALLBACK (palette_leave), colorsel);
+ G_CALLBACK (palette_leave), colorsel);
g_signal_connect (retval, "key-press-event",
- G_CALLBACK (palette_activate), colorsel);
+ G_CALLBACK (palette_activate), colorsel);
g_signal_connect (retval, "popup-menu",
- G_CALLBACK (palette_popup), colorsel);
-
+ G_CALLBACK (palette_popup), colorsel);
+
gtk_drag_dest_set (retval,
- GTK_DEST_DEFAULT_HIGHLIGHT |
- GTK_DEST_DEFAULT_MOTION |
- GTK_DEST_DEFAULT_DROP,
- targets, 1,
- GDK_ACTION_COPY);
-
+ GTK_DEST_DEFAULT_HIGHLIGHT |
+ GTK_DEST_DEFAULT_MOTION |
+ GTK_DEST_DEFAULT_DROP,
+ targets, 1,
+ GDK_ACTION_COPY);
+
g_signal_connect (retval, "drag-end",
G_CALLBACK (palette_drag_end), NULL);
g_signal_connect (retval, "drag-data-received",
G_CALLBACK (palette_drop_handle), colorsel);
gtk_widget_set_tooltip_text (retval,
- _("Click this palette entry to make it the current color. To change this entry, drag a color swatch here or right-click it and select \"Save color here.\""));
+ _("Click this palette entry to make it the current color. "
+ "To change this entry, drag a color swatch here or right-click "
+ "it and select \"Save color here.\""));
return retval;
}
-/*
- *
- * The actual GtkColorSelection widget
- *
- */
+/* The actual GtkColorSelection widget */
static GdkCursor *
make_picker_cursor (GdkScreen *screen)
@@ -1670,7 +1673,7 @@ make_picker_cursor (GdkScreen *screen)
GdkCursor *cursor;
cursor = gdk_cursor_new_from_name (gdk_screen_get_display (screen),
- "color-picker");
+ "color-picker");
if (!cursor)
{
@@ -1684,11 +1687,11 @@ make_picker_cursor (GdkScreen *screen)
cursor = gdk_cursor_new_from_pixbuf (gdk_screen_get_display (screen),
pixbuf,
- DROPPER_X_HOT, DROPPER_Y_HOT);
-
+ DROPPER_X_HOT, DROPPER_Y_HOT);
+
g_object_unref (pixbuf);
}
-
+
return cursor;
}
@@ -1705,9 +1708,9 @@ grab_color_at_pointer (GdkScreen *screen,
GtkColorSelectionPrivate *priv;
GdkColor color;
GdkWindow *root_window = gdk_screen_get_root_window (screen);
-
+
priv = colorsel->private_data;
-
+
pixbuf = gdk_pixbuf_get_from_window (root_window,
x_root, y_root,
1, 1);
@@ -1716,12 +1719,12 @@ grab_color_at_pointer (GdkScreen *screen,
gint x, y;
GdkWindow *window = gdk_device_get_window_at_position (device, &x, &y);
if (!window)
- return;
+ return;
pixbuf = gdk_pixbuf_get_from_window (window,
x, y,
1, 1);
if (!pixbuf)
- return;
+ return;
}
pixels = gdk_pixbuf_get_pixels (pixbuf);
color.red = pixels[0] * 0x101;
@@ -1732,13 +1735,13 @@ grab_color_at_pointer (GdkScreen *screen,
priv->color[COLORSEL_RED] = SCALE (color.red);
priv->color[COLORSEL_GREEN] = SCALE (color.green);
priv->color[COLORSEL_BLUE] = SCALE (color.blue);
-
+
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
update_color (colorsel);
}
@@ -1766,8 +1769,8 @@ shutdown_eyedropper (GtkWidget *widget)
static void
mouse_motion (GtkWidget *invisible,
- GdkEventMotion *event,
- gpointer data)
+ GdkEventMotion *event,
+ gpointer data)
{
grab_color_at_pointer (gdk_event_get_screen ((GdkEvent *) event),
gdk_event_get_device ((GdkEvent *) event),
@@ -1776,8 +1779,8 @@ mouse_motion (GtkWidget *invisible,
static gboolean
mouse_release (GtkWidget *invisible,
- GdkEventButton *event,
- gpointer data)
+ GdkEventButton *event,
+ gpointer data)
{
/* GtkColorSelection *colorsel = data; */
@@ -1789,13 +1792,13 @@ mouse_release (GtkWidget *invisible,
event->x_root, event->y_root, data);
shutdown_eyedropper (GTK_WIDGET (data));
-
+
g_signal_handlers_disconnect_by_func (invisible,
- mouse_motion,
- data);
+ mouse_motion,
+ data);
g_signal_handlers_disconnect_by_func (invisible,
- mouse_release,
- data);
+ mouse_release,
+ data);
return TRUE;
}
@@ -1806,7 +1809,7 @@ static gboolean
key_press (GtkWidget *invisible,
GdkEventKey *event,
gpointer data)
-{
+{
GdkScreen *screen = gdk_event_get_screen ((GdkEvent *) event);
GdkDevice *device, *pointer_device;
guint state = event->state & gtk_accelerator_get_default_mod_mask ();
@@ -1820,7 +1823,7 @@ key_press (GtkWidget *invisible,
dx = 0;
dy = 0;
- switch (event->keyval)
+ switch (event->keyval)
{
case GDK_KEY_space:
case GDK_KEY_Return:
@@ -1832,14 +1835,14 @@ key_press (GtkWidget *invisible,
case GDK_KEY_Escape:
shutdown_eyedropper (data);
-
+
g_signal_handlers_disconnect_by_func (invisible,
- mouse_press,
- data);
+ mouse_press,
+ data);
g_signal_handlers_disconnect_by_func (invisible,
- key_press,
- data);
-
+ key_press,
+ data);
+
return TRUE;
#if defined GDK_WINDOWING_X11 || defined GDK_WINDOWING_WIN32
@@ -1876,26 +1879,21 @@ key_press (GtkWidget *invisible,
static gboolean
mouse_press (GtkWidget *invisible,
- GdkEventButton *event,
- gpointer data)
+ GdkEventButton *event,
+ gpointer data)
{
- /* GtkColorSelection *colorsel = data; */
-
- if (event->type == GDK_BUTTON_PRESS &&
- event->button == 1)
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1)
{
g_signal_connect (invisible, "motion-notify-event",
- G_CALLBACK (mouse_motion),
- data);
+ G_CALLBACK (mouse_motion), data);
g_signal_connect (invisible, "button-release-event",
- G_CALLBACK (mouse_release),
- data);
+ G_CALLBACK (mouse_release), data);
g_signal_handlers_disconnect_by_func (invisible,
- mouse_press,
- data);
+ mouse_press,
+ data);
g_signal_handlers_disconnect_by_func (invisible,
- key_press,
- data);
+ key_press,
+ data);
return TRUE;
}
@@ -1940,15 +1938,15 @@ get_screen_color (GtkWidget *button)
gtk_widget_add_events (grab_widget,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK);
-
+
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (colorsel));
-
+
if (GTK_IS_WINDOW (toplevel))
- {
+ {
if (gtk_window_has_group (GTK_WINDOW (toplevel)))
- gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
- GTK_WINDOW (grab_widget));
- }
+ gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
+ GTK_WINDOW (grab_widget));
+ }
priv->dropper_grab_widget = grab_widget;
}
@@ -1995,117 +1993,117 @@ get_screen_color (GtkWidget *button)
static void
hex_changed (GtkWidget *hex_entry,
- gpointer data)
+ gpointer data)
{
GtkColorSelection *colorsel;
GtkColorSelectionPrivate *priv;
GdkColor color;
gchar *text;
-
+
colorsel = GTK_COLOR_SELECTION (data);
priv = colorsel->private_data;
-
+
if (priv->changing)
return;
-
+
text = gtk_editable_get_chars (GTK_EDITABLE (priv->hex_entry), 0, -1);
if (gdk_color_parse (text, &color))
{
- priv->color[COLORSEL_RED] = CLAMP (color.red/65535.0, 0.0, 1.0);
- priv->color[COLORSEL_GREEN] = CLAMP (color.green/65535.0, 0.0, 1.0);
- priv->color[COLORSEL_BLUE] = CLAMP (color.blue/65535.0, 0.0, 1.0);
+ priv->color[COLORSEL_RED] = CLAMP (color.red / 65535.0, 0.0, 1.0);
+ priv->color[COLORSEL_GREEN] = CLAMP (color.green / 65535.0, 0.0, 1.0);
+ priv->color[COLORSEL_BLUE] = CLAMP (color.blue / 65535.0, 0.0, 1.0);
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
update_color (colorsel);
}
g_free (text);
}
static gboolean
-hex_focus_out (GtkWidget *hex_entry,
- GdkEventFocus *event,
- gpointer data)
+hex_focus_out (GtkWidget *hex_entry,
+ GdkEventFocus *event,
+ gpointer data)
{
hex_changed (hex_entry, data);
-
+
return FALSE;
}
static void
hsv_changed (GtkWidget *hsv,
- gpointer data)
+ gpointer data)
{
GtkColorSelection *colorsel;
GtkColorSelectionPrivate *priv;
-
+
colorsel = GTK_COLOR_SELECTION (data);
priv = colorsel->private_data;
-
+
if (priv->changing)
return;
-
+
gtk_hsv_get_color (GTK_HSV (hsv),
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
- priv->color[COLORSEL_SATURATION],
- priv->color[COLORSEL_VALUE],
- &priv->color[COLORSEL_RED],
- &priv->color[COLORSEL_GREEN],
- &priv->color[COLORSEL_BLUE]);
+ priv->color[COLORSEL_SATURATION],
+ priv->color[COLORSEL_VALUE],
+ &priv->color[COLORSEL_RED],
+ &priv->color[COLORSEL_GREEN],
+ &priv->color[COLORSEL_BLUE]);
update_color (colorsel);
}
static void
adjustment_changed (GtkAdjustment *adjustment,
- gpointer data)
+ gpointer data)
{
GtkColorSelection *colorsel;
GtkColorSelectionPrivate *priv;
-
+
colorsel = GTK_COLOR_SELECTION (g_object_get_data (G_OBJECT (adjustment), "COLORSEL"));
priv = colorsel->private_data;
-
+
if (priv->changing)
return;
-
+
switch (GPOINTER_TO_INT (data))
{
case COLORSEL_SATURATION:
case COLORSEL_VALUE:
priv->color[GPOINTER_TO_INT (data)] = gtk_adjustment_get_value (adjustment) / 100;
gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
- priv->color[COLORSEL_SATURATION],
- priv->color[COLORSEL_VALUE],
- &priv->color[COLORSEL_RED],
- &priv->color[COLORSEL_GREEN],
- &priv->color[COLORSEL_BLUE]);
+ priv->color[COLORSEL_SATURATION],
+ priv->color[COLORSEL_VALUE],
+ &priv->color[COLORSEL_RED],
+ &priv->color[COLORSEL_GREEN],
+ &priv->color[COLORSEL_BLUE]);
break;
case COLORSEL_HUE:
priv->color[GPOINTER_TO_INT (data)] = gtk_adjustment_get_value (adjustment) / 360;
gtk_hsv_to_rgb (priv->color[COLORSEL_HUE],
- priv->color[COLORSEL_SATURATION],
- priv->color[COLORSEL_VALUE],
- &priv->color[COLORSEL_RED],
- &priv->color[COLORSEL_GREEN],
- &priv->color[COLORSEL_BLUE]);
+ priv->color[COLORSEL_SATURATION],
+ priv->color[COLORSEL_VALUE],
+ &priv->color[COLORSEL_RED],
+ &priv->color[COLORSEL_GREEN],
+ &priv->color[COLORSEL_BLUE]);
break;
case COLORSEL_RED:
case COLORSEL_GREEN:
case COLORSEL_BLUE:
priv->color[GPOINTER_TO_INT (data)] = gtk_adjustment_get_value (adjustment) / 255;
-
+
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
break;
default:
priv->color[GPOINTER_TO_INT (data)] = gtk_adjustment_get_value (adjustment) / 255;
@@ -2114,38 +2112,38 @@ adjustment_changed (GtkAdjustment *adjustment,
update_color (colorsel);
}
-static void
+static void
opacity_entry_changed (GtkWidget *opacity_entry,
- gpointer data)
+ gpointer data)
{
GtkColorSelection *colorsel;
GtkColorSelectionPrivate *priv;
GtkAdjustment *adj;
gchar *text;
-
+
colorsel = GTK_COLOR_SELECTION (data);
priv = colorsel->private_data;
-
+
if (priv->changing)
return;
-
+
text = gtk_editable_get_chars (GTK_EDITABLE (priv->opacity_entry), 0, -1);
adj = gtk_range_get_adjustment (GTK_RANGE (priv->opacity_slider));
- gtk_adjustment_set_value (adj, g_strtod (text, NULL));
-
+ gtk_adjustment_set_value (adj, g_strtod (text, NULL));
+
update_color (colorsel);
-
+
g_free (text);
}
static void
make_label_spinbutton (GtkColorSelection *colorsel,
- GtkWidget **spinbutton,
- gchar *text,
- GtkWidget *table,
- gint i,
- gint j,
- gint channel_type,
+ GtkWidget **spinbutton,
+ gchar *text,
+ GtkWidget *table,
+ gint i,
+ gint j,
+ gint channel_type,
const gchar *tooltip)
{
GtkWidget *label;
@@ -2156,7 +2154,7 @@ make_label_spinbutton (GtkColorSelection *colorsel,
adjust = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 1.0, 0.0);
}
else if (channel_type == COLORSEL_SATURATION ||
- channel_type == COLORSEL_VALUE)
+ channel_type == COLORSEL_VALUE)
{
adjust = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 1.0, 0.0);
}
@@ -2167,7 +2165,7 @@ make_label_spinbutton (GtkColorSelection *colorsel,
g_object_set_data (G_OBJECT (adjust), I_("COLORSEL"), colorsel);
*spinbutton = gtk_spin_button_new (adjust, 10.0, 0);
- gtk_widget_set_tooltip_text (*spinbutton, tooltip);
+ gtk_widget_set_tooltip_text (*spinbutton, tooltip);
g_signal_connect (adjust, "value-changed",
G_CALLBACK (adjustment_changed),
@@ -2182,13 +2180,13 @@ make_label_spinbutton (GtkColorSelection *colorsel,
static void
make_palette_frame (GtkColorSelection *colorsel,
- GtkWidget *table,
- gint i,
- gint j)
+ GtkWidget *table,
+ gint i,
+ gint j)
{
GtkWidget *frame;
GtkColorSelectionPrivate *priv;
-
+
priv = colorsel->private_data;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
@@ -2199,10 +2197,10 @@ make_palette_frame (GtkColorSelection *colorsel,
}
/* Set the palette entry [x][y] to be the currently selected one. */
-static void
+static void
set_selected_palette (GtkColorSelection *colorsel, int x, int y)
{
- GtkColorSelectionPrivate *priv = colorsel->private_data;
+ GtkColorSelectionPrivate *priv = colorsel->private_data;
gtk_widget_grab_focus (priv->custom_palette[x][y]);
}
@@ -2223,44 +2221,44 @@ update_color (GtkColorSelection *colorsel)
gchar entryval[12];
gchar opacity_text[32];
gchar *ptr;
-
+
priv->changing = TRUE;
color_sample_update_samples (colorsel);
-
+
gtk_hsv_set_color (GTK_HSV (priv->triangle_colorsel),
- priv->color[COLORSEL_HUE],
- priv->color[COLORSEL_SATURATION],
- priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_HUE],
+ priv->color[COLORSEL_SATURATION],
+ priv->color[COLORSEL_VALUE]);
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->hue_spinbutton)),
- scale_round (priv->color[COLORSEL_HUE], 360));
+ (GTK_SPIN_BUTTON (priv->hue_spinbutton)),
+ scale_round (priv->color[COLORSEL_HUE], 360));
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->sat_spinbutton)),
- scale_round (priv->color[COLORSEL_SATURATION], 100));
+ (GTK_SPIN_BUTTON (priv->sat_spinbutton)),
+ scale_round (priv->color[COLORSEL_SATURATION], 100));
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->val_spinbutton)),
- scale_round (priv->color[COLORSEL_VALUE], 100));
+ (GTK_SPIN_BUTTON (priv->val_spinbutton)),
+ scale_round (priv->color[COLORSEL_VALUE], 100));
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->red_spinbutton)),
- scale_round (priv->color[COLORSEL_RED], 255));
+ (GTK_SPIN_BUTTON (priv->red_spinbutton)),
+ scale_round (priv->color[COLORSEL_RED], 255));
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->green_spinbutton)),
- scale_round (priv->color[COLORSEL_GREEN], 255));
+ (GTK_SPIN_BUTTON (priv->green_spinbutton)),
+ scale_round (priv->color[COLORSEL_GREEN], 255));
gtk_adjustment_set_value (gtk_spin_button_get_adjustment
- (GTK_SPIN_BUTTON (priv->blue_spinbutton)),
- scale_round (priv->color[COLORSEL_BLUE], 255));
+ (GTK_SPIN_BUTTON (priv->blue_spinbutton)),
+ scale_round (priv->color[COLORSEL_BLUE], 255));
gtk_adjustment_set_value (gtk_range_get_adjustment
- (GTK_RANGE (priv->opacity_slider)),
- scale_round (priv->color[COLORSEL_OPACITY], 255));
-
+ (GTK_RANGE (priv->opacity_slider)),
+ scale_round (priv->color[COLORSEL_OPACITY], 255));
+
g_snprintf (opacity_text, 32, "%.0f", scale_round (priv->color[COLORSEL_OPACITY], 255));
gtk_entry_set_text (GTK_ENTRY (priv->opacity_entry), opacity_text);
-
+
g_snprintf (entryval, 11, "#%2X%2X%2X",
- (guint) (scale_round (priv->color[COLORSEL_RED], 255)),
- (guint) (scale_round (priv->color[COLORSEL_GREEN], 255)),
- (guint) (scale_round (priv->color[COLORSEL_BLUE], 255)));
-
+ (guint) (scale_round (priv->color[COLORSEL_RED], 255)),
+ (guint) (scale_round (priv->color[COLORSEL_GREEN], 255)),
+ (guint) (scale_round (priv->color[COLORSEL_BLUE], 255)));
+
for (ptr = entryval; *ptr; ptr++)
if (*ptr == ' ')
*ptr = '0';
@@ -2268,14 +2266,14 @@ update_color (GtkColorSelection *colorsel)
priv->changing = FALSE;
g_object_ref (colorsel);
-
+
g_signal_emit (colorsel, color_selection_signals[COLOR_CHANGED], 0);
-
+
g_object_freeze_notify (G_OBJECT (colorsel));
g_object_notify (G_OBJECT (colorsel), "current-color");
g_object_notify (G_OBJECT (colorsel), "current-alpha");
g_object_thaw_notify (G_OBJECT (colorsel));
-
+
g_object_unref (colorsel);
}
@@ -2286,19 +2284,19 @@ update_palette (GtkColorSelection *colorsel)
gint i, j;
current_colors = get_current_colors (colorsel);
-
+
for (i = 0; i < GTK_CUSTOM_PALETTE_HEIGHT; i++)
{
for (j = 0; j < GTK_CUSTOM_PALETTE_WIDTH; j++)
- {
+ {
gint index;
index = i * GTK_CUSTOM_PALETTE_WIDTH + j;
-
+
gtk_color_selection_set_palette_color (colorsel,
index,
¤t_colors[index]);
- }
+ }
}
g_free (current_colors);
@@ -2314,18 +2312,18 @@ palette_change_notify_instance (GObject *object,
static void
default_noscreen_change_palette_func (const GdkColor *colors,
- gint n_colors)
+ gint n_colors)
{
default_change_palette_func (gdk_screen_get_default (), colors, n_colors);
}
static void
-default_change_palette_func (GdkScreen *screen,
- const GdkColor *colors,
+default_change_palette_func (GdkScreen *screen,
+ const GdkColor *colors,
gint n_colors)
{
gchar *str;
-
+
str = gtk_color_selection_palette_to_string (colors, n_colors);
gtk_settings_set_string_property (gtk_settings_get_for_screen (screen),
@@ -2338,11 +2336,11 @@ default_change_palette_func (GdkScreen *screen,
/**
* gtk_color_selection_new:
- *
+ *
* Creates a new GtkColorSelection.
- *
+ *
* Return value: a new #GtkColorSelection
- **/
+ */
GtkWidget *
gtk_color_selection_new (void)
{
@@ -2353,125 +2351,125 @@ gtk_color_selection_new (void)
color[1] = 1.0;
color[2] = 1.0;
color[3] = 1.0;
-
+
colorsel = g_object_new (GTK_TYPE_COLOR_SELECTION, NULL);
priv = colorsel->private_data;
set_color_internal (colorsel, color);
gtk_color_selection_set_has_opacity_control (colorsel, TRUE);
-
- /* We want to make sure that default_set is FALSE */
- /* This way the user can still set it */
+
+ /* We want to make sure that default_set is FALSE.
+ * This way the user can still set it.
+ */
priv->default_set = FALSE;
priv->default_alpha_set = FALSE;
-
+
return GTK_WIDGET (colorsel);
}
/**
* gtk_color_selection_get_has_opacity_control:
- * @colorsel: a #GtkColorSelection.
- *
+ * @colorsel: a #GtkColorSelection
+ *
* Determines whether the colorsel has an opacity control.
- *
- * Return value: %TRUE if the @colorsel has an opacity control. %FALSE if it does't.
- **/
+ *
+ * Return value: %TRUE if the @colorsel has an opacity control,
+ * %FALSE if it does't
+ */
gboolean
gtk_color_selection_get_has_opacity_control (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
-
+
priv = colorsel->private_data;
-
+
return priv->has_opacity;
}
/**
* gtk_color_selection_set_has_opacity_control:
- * @colorsel: a #GtkColorSelection.
- * @has_opacity: %TRUE if @colorsel can set the opacity, %FALSE otherwise.
+ * @colorsel: a #GtkColorSelection
+ * @has_opacity: %TRUE if @colorsel can set the opacity, %FALSE otherwise
*
* Sets the @colorsel to use or not use opacity.
- *
- **/
+ */
void
gtk_color_selection_set_has_opacity_control (GtkColorSelection *colorsel,
- gboolean has_opacity)
+ gboolean has_opacity)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
+
priv = colorsel->private_data;
has_opacity = has_opacity != FALSE;
-
+
if (priv->has_opacity != has_opacity)
{
priv->has_opacity = has_opacity;
if (has_opacity)
- {
- gtk_widget_show (priv->opacity_slider);
- gtk_widget_show (priv->opacity_label);
- gtk_widget_show (priv->opacity_entry);
- }
+ {
+ gtk_widget_show (priv->opacity_slider);
+ gtk_widget_show (priv->opacity_label);
+ gtk_widget_show (priv->opacity_entry);
+ }
else
- {
- gtk_widget_hide (priv->opacity_slider);
- gtk_widget_hide (priv->opacity_label);
- gtk_widget_hide (priv->opacity_entry);
- }
+ {
+ gtk_widget_hide (priv->opacity_slider);
+ gtk_widget_hide (priv->opacity_label);
+ gtk_widget_hide (priv->opacity_entry);
+ }
color_sample_update_samples (colorsel);
-
+
g_object_notify (G_OBJECT (colorsel), "has-opacity-control");
}
}
/**
* gtk_color_selection_get_has_palette:
- * @colorsel: a #GtkColorSelection.
- *
+ * @colorsel: a #GtkColorSelection
+ *
* Determines whether the color selector has a color palette.
- *
- * Return value: %TRUE if the selector has a palette. %FALSE if it hasn't.
- **/
+ *
+ * Return value: %TRUE if the selector has a palette, %FALSE if it hasn't
+ */
gboolean
gtk_color_selection_get_has_palette (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
-
+
priv = colorsel->private_data;
-
+
return priv->has_palette;
}
/**
* gtk_color_selection_set_has_palette:
- * @colorsel: a #GtkColorSelection.
- * @has_palette: %TRUE if palette is to be visible, %FALSE otherwise.
+ * @colorsel: a #GtkColorSelection
+ * @has_palette: %TRUE if palette is to be visible, %FALSE otherwise
*
* Shows and hides the palette based upon the value of @has_palette.
- *
- **/
+ */
void
gtk_color_selection_set_has_palette (GtkColorSelection *colorsel,
- gboolean has_palette)
+ gboolean has_palette)
{
GtkColorSelectionPrivate *priv;
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
+
priv = colorsel->private_data;
has_palette = has_palette != FALSE;
-
+
if (priv->has_palette != has_palette)
{
priv->has_palette = has_palette;
if (has_palette)
- gtk_widget_show (priv->palette_frame);
+ gtk_widget_show (priv->palette_frame);
else
- gtk_widget_hide (priv->palette_frame);
+ gtk_widget_hide (priv->palette_frame);
update_tooltips (colorsel);
@@ -2481,19 +2479,21 @@ gtk_color_selection_set_has_palette (GtkColorSelection *colorsel,
/**
* gtk_color_selection_set_current_color:
- * @colorsel: a #GtkColorSelection.
- * @color: A #GdkColor to set the current color with.
+ * @colorsel: a #GtkColorSelection
+ * @color: a #GdkColor to set the current color with
*
- * Sets the current color to be @color. The first time this is called, it will
- * also set the original color to be @color too.
- **/
+ * Sets the current color to be @color.
+ *
+ * The first time this is called, it will also set
+ * the original color to be @color too.
+ */
void
gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
- const GdkColor *color)
+ const GdkColor *color)
{
GtkColorSelectionPrivate *priv;
gint i;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (color != NULL);
@@ -2503,15 +2503,15 @@ gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
priv->color[COLORSEL_GREEN] = SCALE (color->green);
priv->color[COLORSEL_BLUE] = SCALE (color->blue);
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
if (priv->default_set == FALSE)
{
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
- priv->old_color[i] = priv->color[i];
+ priv->old_color[i] = priv->color[i];
}
priv->default_set = TRUE;
update_color (colorsel);
@@ -2519,28 +2519,30 @@ gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
/**
* gtk_color_selection_set_current_alpha:
- * @colorsel: a #GtkColorSelection.
- * @alpha: an integer between 0 and 65535.
+ * @colorsel: a #GtkColorSelection
+ * @alpha: an integer between 0 and 65535
+ *
+ * Sets the current opacity to be @alpha.
*
- * Sets the current opacity to be @alpha. The first time this is called, it will
- * also set the original opacity to be @alpha too.
- **/
+ * The first time this is called, it will also set
+ * the original opacity to be @alpha too.
+ */
void
gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel,
- guint16 alpha)
+ guint16 alpha)
{
GtkColorSelectionPrivate *priv;
gint i;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
+
priv = colorsel->private_data;
priv->changing = TRUE;
priv->color[COLORSEL_OPACITY] = SCALE (alpha);
if (priv->default_alpha_set == FALSE)
{
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
- priv->old_color[i] = priv->color[i];
+ priv->old_color[i] = priv->color[i];
}
priv->default_alpha_set = TRUE;
update_color (colorsel);
@@ -2548,20 +2550,20 @@ gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_current_color:
- * @colorsel: a #GtkColorSelection.
- * @color: (out): a #GdkColor to fill in with the current color.
+ * @colorsel: a #GtkColorSelection
+ * @color: (out): a #GdkColor to fill in with the current color
*
* Sets @color to be the current color in the GtkColorSelection widget.
- **/
+ */
void
gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
- GdkColor *color)
+ GdkColor *color)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (color != NULL);
-
+
priv = colorsel->private_data;
color->red = UNSCALE (priv->color[COLORSEL_RED]);
color->green = UNSCALE (priv->color[COLORSEL_GREEN]);
@@ -2570,53 +2572,55 @@ gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_current_alpha:
- * @colorsel: a #GtkColorSelection.
+ * @colorsel: a #GtkColorSelection
*
* Returns the current alpha value.
*
- * Return value: an integer between 0 and 65535.
- **/
+ * Return value: an integer between 0 and 65535
+ */
guint16
gtk_color_selection_get_current_alpha (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), 0);
-
+
priv = colorsel->private_data;
return priv->has_opacity ? UNSCALE (priv->color[COLORSEL_OPACITY]) : 65535;
}
/**
* gtk_color_selection_set_previous_color:
- * @colorsel: a #GtkColorSelection.
- * @color: a #GdkColor to set the previous color with.
+ * @colorsel: a #GtkColorSelection
+ * @color: a #GdkColor to set the previous color with
*
- * Sets the 'previous' color to be @color. This function should be called with
- * some hesitations, as it might seem confusing to have that color change.
- * Calling gtk_color_selection_set_current_color() will also set this color the first
- * time it is called.
- **/
+ * Sets the 'previous' color to be @color.
+ *
+ * This function should be called with some hesitations,
+ * as it might seem confusing to have that color change.
+ * Calling gtk_color_selection_set_current_color() will also
+ * set this color the first time it is called.
+ */
void
gtk_color_selection_set_previous_color (GtkColorSelection *colorsel,
- const GdkColor *color)
+ const GdkColor *color)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (color != NULL);
-
+
priv = colorsel->private_data;
priv->changing = TRUE;
priv->old_color[COLORSEL_RED] = SCALE (color->red);
priv->old_color[COLORSEL_GREEN] = SCALE (color->green);
priv->old_color[COLORSEL_BLUE] = SCALE (color->blue);
gtk_rgb_to_hsv (priv->old_color[COLORSEL_RED],
- priv->old_color[COLORSEL_GREEN],
- priv->old_color[COLORSEL_BLUE],
- &priv->old_color[COLORSEL_HUE],
- &priv->old_color[COLORSEL_SATURATION],
- &priv->old_color[COLORSEL_VALUE]);
+ priv->old_color[COLORSEL_GREEN],
+ priv->old_color[COLORSEL_BLUE],
+ &priv->old_color[COLORSEL_HUE],
+ &priv->old_color[COLORSEL_SATURATION],
+ &priv->old_color[COLORSEL_VALUE]);
color_sample_update_samples (colorsel);
priv->default_set = TRUE;
priv->changing = FALSE;
@@ -2624,20 +2628,22 @@ gtk_color_selection_set_previous_color (GtkColorSelection *colorsel,
/**
* gtk_color_selection_set_previous_alpha:
- * @colorsel: a #GtkColorSelection.
- * @alpha: an integer between 0 and 65535.
+ * @colorsel: a #GtkColorSelection
+ * @alpha: an integer between 0 and 65535
*
- * Sets the 'previous' alpha to be @alpha. This function should be called with
- * some hesitations, as it might seem confusing to have that alpha change.
- **/
+ * Sets the 'previous' alpha to be @alpha.
+ *
+ * This function should be called with some hesitations,
+ * as it might seem confusing to have that alpha change.
+ */
void
gtk_color_selection_set_previous_alpha (GtkColorSelection *colorsel,
- guint16 alpha)
+ guint16 alpha)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
+
priv = colorsel->private_data;
priv->changing = TRUE;
priv->old_color[COLORSEL_OPACITY] = SCALE (alpha);
@@ -2649,20 +2655,20 @@ gtk_color_selection_set_previous_alpha (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_previous_color:
- * @colorsel: a #GtkColorSelection.
- * @color: (out): a #GdkColor to fill in with the original color value.
+ * @colorsel: a #GtkColorSelection
+ * @color: (out): a #GdkColor to fill in with the original color value
*
* Fills @color in with the original color value.
- **/
+ */
void
gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
- GdkColor *color)
+ GdkColor *color)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (color != NULL);
-
+
priv = colorsel->private_data;
color->red = UNSCALE (priv->old_color[COLORSEL_RED]);
color->green = UNSCALE (priv->old_color[COLORSEL_GREEN]);
@@ -2671,33 +2677,35 @@ gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_previous_alpha:
- * @colorsel: a #GtkColorSelection.
+ * @colorsel: a #GtkColorSelection
*
* Returns the previous alpha value.
*
- * Return value: an integer between 0 and 65535.
- **/
+ * Return value: an integer between 0 and 65535
+ */
guint16
gtk_color_selection_get_previous_alpha (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), 0);
-
+
priv = colorsel->private_data;
return priv->has_opacity ? UNSCALE (priv->old_color[COLORSEL_OPACITY]) : 65535;
}
/**
* gtk_color_selection_set_current_rgba:
- * @colorsel: a #GtkColorSelection.
+ * @colorsel: a #GtkColorSelection
* @rgba: A #GdkRGBA to set the current color with
*
- * Sets the current color to be @rgba. The first time this is called, it will
- * also set the original color to be @rgba too.
+ * Sets the current color to be @rgba.
+ *
+ * The first time this is called, it will also set
+ * the original color to be @rgba too.
*
* Since: 3.0
- **/
+ */
void
gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
const GdkRGBA *rgba)
@@ -2717,16 +2725,16 @@ gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
priv->color[COLORSEL_OPACITY] = CLAMP (rgba->alpha, 0, 1);
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
- priv->color[COLORSEL_GREEN],
- priv->color[COLORSEL_BLUE],
- &priv->color[COLORSEL_HUE],
- &priv->color[COLORSEL_SATURATION],
- &priv->color[COLORSEL_VALUE]);
+ priv->color[COLORSEL_GREEN],
+ priv->color[COLORSEL_BLUE],
+ &priv->color[COLORSEL_HUE],
+ &priv->color[COLORSEL_SATURATION],
+ &priv->color[COLORSEL_VALUE]);
if (priv->default_set == FALSE)
{
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
- priv->old_color[i] = priv->color[i];
+ priv->old_color[i] = priv->color[i];
}
priv->default_set = TRUE;
@@ -2735,13 +2743,13 @@ gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_current_rgba:
- * @colorsel: a #GtkColorSelection.
- * @rgba: (out): a #GdkRGBA to fill in with the current color.
+ * @colorsel: a #GtkColorSelection
+ * @rgba: (out): a #GdkRGBA to fill in with the current color
*
* Sets @rgba to be the current color in the GtkColorSelection widget.
*
* Since: 3.0
- **/
+ */
void
gtk_color_selection_get_current_rgba (GtkColorSelection *colorsel,
GdkRGBA *rgba)
@@ -2760,16 +2768,18 @@ gtk_color_selection_get_current_rgba (GtkColorSelection *colorsel,
/**
* gtk_color_selection_set_previous_rgba:
- * @colorsel: a #GtkColorSelection.
+ * @colorsel: a #GtkColorSelection
* @rgba: a #GdkRGBA to set the previous color with
*
- * Sets the 'previous' color to be @rgba. This function should be called with
- * some hesitations, as it might seem confusing to have that color change.
- * Calling gtk_color_selection_set_current_rgba() will also set this color the first
- * time it is called.
+ * Sets the 'previous' color to be @rgba.
+ *
+ * This function should be called with some hesitations,
+ * as it might seem confusing to have that color change.
+ * Calling gtk_color_selection_set_current_rgba() will also
+ * set this color the first time it is called.
*
* Since: 3.0
- **/
+ */
void
gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
const GdkRGBA *rgba)
@@ -2788,11 +2798,11 @@ gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
priv->old_color[COLORSEL_OPACITY] = CLAMP (rgba->alpha, 0, 1);
gtk_rgb_to_hsv (priv->old_color[COLORSEL_RED],
- priv->old_color[COLORSEL_GREEN],
- priv->old_color[COLORSEL_BLUE],
- &priv->old_color[COLORSEL_HUE],
- &priv->old_color[COLORSEL_SATURATION],
- &priv->old_color[COLORSEL_VALUE]);
+ priv->old_color[COLORSEL_GREEN],
+ priv->old_color[COLORSEL_BLUE],
+ &priv->old_color[COLORSEL_HUE],
+ &priv->old_color[COLORSEL_SATURATION],
+ &priv->old_color[COLORSEL_VALUE]);
color_sample_update_samples (colorsel);
priv->default_set = TRUE;
@@ -2801,13 +2811,13 @@ gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
/**
* gtk_color_selection_get_previous_rgba:
- * @colorsel: a #GtkColorSelection.
- * @rgba: (out): a #GdkRGBA to fill in with the original color value.
+ * @colorsel: a #GtkColorSelection
+ * @rgba: (out): a #GdkRGBA to fill in with the original color value
*
* Fills @rgba in with the original color value.
*
* Since: 3.0
- **/
+ */
void
gtk_color_selection_get_previous_rgba (GtkColorSelection *colorsel,
GdkRGBA *rgba)
@@ -2826,81 +2836,80 @@ gtk_color_selection_get_previous_rgba (GtkColorSelection *colorsel,
/**
* gtk_color_selection_set_palette_color:
- * @colorsel: a #GtkColorSelection.
- * @index: the color index of the palette.
- * @color: A #GdkColor to set the palette with.
+ * @colorsel: a #GtkColorSelection
+ * @index: the color index of the palette
+ * @color: A #GdkColor to set the palette with
*
* Sets the palette located at @index to have @color as its color.
- *
- **/
+ */
static void
-gtk_color_selection_set_palette_color (GtkColorSelection *colorsel,
- gint index,
- GdkColor *color)
+gtk_color_selection_set_palette_color (GtkColorSelection *colorsel,
+ gint index,
+ GdkColor *color)
{
GtkColorSelectionPrivate *priv;
gint x, y;
gdouble col[3];
-
+
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
g_return_if_fail (index >= 0 && index < GTK_CUSTOM_PALETTE_WIDTH*GTK_CUSTOM_PALETTE_HEIGHT);
x = index % GTK_CUSTOM_PALETTE_WIDTH;
y = index / GTK_CUSTOM_PALETTE_WIDTH;
-
+
priv = colorsel->private_data;
col[0] = SCALE (color->red);
col[1] = SCALE (color->green);
col[2] = SCALE (color->blue);
-
+
palette_set_color (priv->custom_palette[x][y], colorsel, col);
}
/**
* gtk_color_selection_is_adjusting:
- * @colorsel: a #GtkColorSelection.
+ * @colorsel: a #GtkColorSelection
*
* Gets the current state of the @colorsel.
*
- * Return value: %TRUE if the user is currently dragging a color around, and %FALSE
- * if the selection has stopped.
- **/
+ * Return value: %TRUE if the user is currently dragging
+ * a color around, and %FALSE if the selection has stopped
+ */
gboolean
gtk_color_selection_is_adjusting (GtkColorSelection *colorsel)
{
GtkColorSelectionPrivate *priv;
-
+
g_return_val_if_fail (GTK_IS_COLOR_SELECTION (colorsel), FALSE);
-
+
priv = colorsel->private_data;
-
+
return (gtk_hsv_is_adjusting (GTK_HSV (priv->triangle_colorsel)));
}
/**
* gtk_color_selection_palette_from_string:
- * @str: a string encoding a color palette.
- * @colors: (out) (array length=n_colors): return location for allocated
- * array of #GdkColor.
- * @n_colors: return location for length of array.
- *
+ * @str: a string encoding a color palette
+ * @colors: (out) (array length=n_colors): return location for
+ * allocated array of #GdkColor
+ * @n_colors: return location for length of array
+ *
* Parses a color palette string; the string is a colon-separated
* list of color names readable by gdk_color_parse().
- *
- * Return value: %TRUE if a palette was successfully parsed.
- **/
+ *
+ * Return value: %TRUE if a palette was successfully parsed
+ */
gboolean
-gtk_color_selection_palette_from_string (const gchar *str,
- GdkColor **colors,
- gint *n_colors)
+gtk_color_selection_palette_from_string (const gchar *str,
+ GdkColor **colors,
+ gint *n_colors)
{
GdkColor *retval;
gint count;
gchar *p;
gchar *start;
gchar *copy;
-
+
count = 0;
retval = NULL;
copy = g_strdup (str);
@@ -2917,7 +2926,7 @@ gtk_color_selection_palette_from_string (const gchar *str,
{
goto failed; /* empty entry */
}
-
+
if (*p)
{
*p = '\0';
@@ -2942,7 +2951,7 @@ gtk_color_selection_palette_from_string (const gchar *str,
}
g_free (copy);
-
+
if (colors)
*colors = retval;
else
@@ -2952,7 +2961,7 @@ gtk_color_selection_palette_from_string (const gchar *str,
*n_colors = count;
return TRUE;
-
+
failed:
g_free (copy);
g_free (retval);
@@ -2967,13 +2976,13 @@ gtk_color_selection_palette_from_string (const gchar *str,
/**
* gtk_color_selection_palette_to_string:
- * @colors: (array length=n_colors): an array of colors.
- * @n_colors: length of the array.
- *
+ * @colors: (array length=n_colors): an array of colors
+ * @n_colors: length of the array
+ *
* Encodes a palette as a string, useful for persistent storage.
- *
- * Return value: allocated string encoding the palette.
- **/
+ *
+ * Return value: allocated string encoding the palette
+ */
gchar*
gtk_color_selection_palette_to_string (const GdkColor *colors,
gint n_colors)
@@ -2981,7 +2990,7 @@ gtk_color_selection_palette_to_string (const GdkColor *colors,
gint i;
gchar **strs = NULL;
gchar *retval;
-
+
if (n_colors == 0)
return g_strdup ("");
@@ -2991,7 +3000,7 @@ gtk_color_selection_palette_to_string (const GdkColor *colors,
while (i < n_colors)
{
gchar *ptr;
-
+
strs[i] =
g_strdup_printf ("#%2X%2X%2X",
colors[i].red / 256,
@@ -3001,7 +3010,7 @@ gtk_color_selection_palette_to_string (const GdkColor *colors,
for (ptr = strs[i]; *ptr; ptr++)
if (*ptr == ' ')
*ptr = '0';
-
+
++i;
}
@@ -3014,17 +3023,19 @@ gtk_color_selection_palette_to_string (const GdkColor *colors,
/**
* gtk_color_selection_set_change_palette_with_screen_hook: (skip)
- * @func: a function to call when the custom palette needs saving.
- *
- * Installs a global function to be called whenever the user tries to
- * modify the palette in a color selection. This function should save
- * the new palette contents, and update the GtkSettings property
- * "gtk-color-palette" so all GtkColorSelection widgets will be modified.
- *
- * Return value: the previous change palette hook (that was replaced).
+ * @func: a function to call when the custom palette needs saving
+ *
+ * Installs a global function to be called whenever the user
+ * tries to modify the palette in a color selection.
+ *
+ * This function should save the new palette contents, and update
+ * the #GtkSettings::gtk-color-palette GtkSettings property so all
+ * GtkColorSelection widgets will be modified.
+ *
+ * Return value: the previous change palette hook (that was replaced)
*
* Since: 2.2
- **/
+ */
GtkColorSelectionChangePaletteWithScreenFunc
gtk_color_selection_set_change_palette_with_screen_hook (GtkColorSelectionChangePaletteWithScreenFunc func)
{
@@ -3049,7 +3060,7 @@ make_control_relations (AtkObject *atk_obj,
}
static void
-make_all_relations (AtkObject *atk_obj,
+make_all_relations (AtkObject *atk_obj,
GtkColorSelectionPrivate *priv)
{
make_control_relations (atk_obj, priv->hue_spinbutton);
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index d1c8c2a..4c7c44c 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -267,31 +267,31 @@ static void gtk_container_class_init (GtkContainerClass *klass);
static void gtk_container_init (GtkContainer *container);
static void gtk_container_destroy (GtkWidget *widget);
static void gtk_container_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gtk_container_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void gtk_container_add_unimplemented (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_container_remove_unimplemented (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_container_real_check_resize (GtkContainer *container);
static void gtk_container_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p);
static gboolean gtk_container_focus (GtkWidget *widget,
- GtkDirectionType direction);
+ GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static gboolean gtk_container_focus_move (GtkContainer *container,
- GList *children,
- GtkDirectionType direction);
+ GList *children,
+ GtkDirectionType direction);
static void gtk_container_children_callback (GtkWidget *widget,
- gpointer client_data);
+ gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static gint gtk_container_draw (GtkWidget *widget,
cairo_t *cr);
@@ -309,7 +309,7 @@ static void gtk_container_adjust_size_allocation (GtkWidget *widget,
gint *allocated_size);
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
- GtkWidget *child);
+ GtkWidget *child);
static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *container,
GtkWidget *child);
@@ -317,20 +317,20 @@ static GtkWidgetPath * gtk_container_real_get_path_for_child (GtkContainer *cont
/* GtkBuildable */
static void gtk_container_buildable_init (GtkBuildableIface *iface);
static void gtk_container_buildable_add_child (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *type);
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type);
static gboolean gtk_container_buildable_custom_tag_start (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *tagname,
- GMarkupParser *parser,
- gpointer *data);
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data);
static void gtk_container_buildable_custom_tag_end (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *tagname,
- gpointer *data);
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer *data);
/* --- variables --- */
@@ -338,7 +338,7 @@ static const gchar vadjustment_key[] = "gtk-vadjustment";
static guint vadjustment_key_id = 0;
static const gchar hadjustment_key[] = "gtk-hadjustment";
static guint hadjustment_key_id = 0;
-static GSList *container_resize_queue = NULL;
+static GSList *container_resize_queue = NULL;
static guint container_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL;
extern GParamSpecPool *_gtk_widget_child_property_pool;
@@ -356,32 +356,32 @@ gtk_container_get_type (void)
{
const GTypeInfo container_info =
{
- sizeof (GtkContainerClass),
- (GBaseInitFunc) gtk_container_base_class_init,
- (GBaseFinalizeFunc) gtk_container_base_class_finalize,
- (GClassInitFunc) gtk_container_class_init,
- NULL /* class_finalize */,
- NULL /* class_data */,
- sizeof (GtkContainer),
- 0 /* n_preallocs */,
- (GInstanceInitFunc) gtk_container_init,
- NULL, /* value_table */
+ sizeof (GtkContainerClass),
+ (GBaseInitFunc) gtk_container_base_class_init,
+ (GBaseFinalizeFunc) gtk_container_base_class_finalize,
+ (GClassInitFunc) gtk_container_class_init,
+ NULL /* class_finalize */,
+ NULL /* class_data */,
+ sizeof (GtkContainer),
+ 0 /* n_preallocs */,
+ (GInstanceInitFunc) gtk_container_init,
+ NULL, /* value_table */
};
const GInterfaceInfo buildable_info =
{
- (GInterfaceInitFunc) gtk_container_buildable_init,
- NULL,
- NULL
+ (GInterfaceInitFunc) gtk_container_buildable_init,
+ NULL,
+ NULL
};
container_type =
- g_type_register_static (GTK_TYPE_WIDGET, I_("GtkContainer"),
- &container_info, G_TYPE_FLAG_ABSTRACT);
+ g_type_register_static (GTK_TYPE_WIDGET, I_("GtkContainer"),
+ &container_info, G_TYPE_FLAG_ABSTRACT);
g_type_add_interface_static (container_type,
- GTK_TYPE_BUILDABLE,
- &buildable_info);
+ GTK_TYPE_BUILDABLE,
+ &buildable_info);
}
@@ -460,9 +460,9 @@ gtk_container_class_init (GtkContainerClass *class)
g_param_spec_uint ("border-width",
P_("Border width"),
P_("The width of the empty border outside the containers children"),
- 0,
- 65535,
- 0,
+ 0,
+ 65535,
+ 0,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_CHILD,
@@ -470,42 +470,42 @@ gtk_container_class_init (GtkContainerClass *class)
P_("Child"),
P_("Can be used to add a new child to the container"),
GTK_TYPE_WIDGET,
- GTK_PARAM_WRITABLE));
+ GTK_PARAM_WRITABLE));
container_signals[ADD] =
g_signal_new (I_("add"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkContainerClass, add),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkContainerClass, add),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
container_signals[REMOVE] =
g_signal_new (I_("remove"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkContainerClass, remove),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkContainerClass, remove),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
container_signals[CHECK_RESIZE] =
g_signal_new (I_("check-resize"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkContainerClass, check_resize),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkContainerClass, check_resize),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
container_signals[SET_FOCUS_CHILD] =
g_signal_new (I_("set-focus-child"),
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkContainerClass, set_focus_child),
- NULL, NULL,
- _gtk_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GtkContainerClass, set_focus_child),
+ NULL, NULL,
+ _gtk_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
g_type_class_add_private (class, sizeof (GtkContainerPrivate));
}
@@ -521,9 +521,9 @@ gtk_container_buildable_init (GtkBuildableIface *iface)
static void
gtk_container_buildable_add_child (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *type)
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type)
{
if (type)
{
@@ -536,15 +536,15 @@ gtk_container_buildable_add_child (GtkBuildable *buildable,
}
else
g_warning ("Cannot add an object of type %s to a container of type %s",
- g_type_name (G_OBJECT_TYPE (child)), g_type_name (G_OBJECT_TYPE (buildable)));
+ g_type_name (G_OBJECT_TYPE (child)), g_type_name (G_OBJECT_TYPE (buildable)));
}
static void
gtk_container_buildable_set_child_property (GtkContainer *container,
- GtkBuilder *builder,
- GtkWidget *child,
- gchar *name,
- const gchar *value)
+ GtkBuilder *builder,
+ GtkWidget *child,
+ gchar *name,
+ const gchar *value)
{
GParamSpec *pspec;
GValue gvalue = { 0, };
@@ -555,18 +555,18 @@ gtk_container_buildable_set_child_property (GtkContainer *container,
if (!pspec)
{
g_warning ("%s does not have a property called %s",
- g_type_name (G_OBJECT_TYPE (container)), name);
+ g_type_name (G_OBJECT_TYPE (container)), name);
return;
}
if (!gtk_builder_value_from_string (builder, pspec, value, &gvalue, &error))
{
g_warning ("Could not read property %s:%s with value %s of type %s: %s",
- g_type_name (G_OBJECT_TYPE (container)),
- name,
- value,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
- error->message);
+ g_type_name (G_OBJECT_TYPE (container)),
+ name,
+ value,
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+ error->message);
g_error_free (error);
return;
}
@@ -586,11 +586,11 @@ typedef struct {
static void
attributes_start_element (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **names,
- const gchar **values,
- gpointer user_data,
- GError **error)
+ const gchar *element_name,
+ const gchar **names,
+ const gchar **values,
+ gpointer user_data,
+ GError **error)
{
PackingPropertiesData *parser_data = (PackingPropertiesData*)user_data;
guint i;
@@ -598,22 +598,22 @@ attributes_start_element (GMarkupParseContext *context,
if (strcmp (element_name, "property") == 0)
{
for (i = 0; names[i]; i++)
- if (strcmp (names[i], "name") == 0)
- parser_data->child_prop_name = g_strdup (values[i]);
- else if (strcmp (names[i], "translatable") == 0)
- {
- if (!_gtk_builder_boolean_from_string (values[1],
- &parser_data->translatable,
- error))
- return;
- }
- else if (strcmp (names[i], "comments") == 0)
- ; /* for translators */
- else if (strcmp (names[i], "context") == 0)
- parser_data->context = g_strdup (values[1]);
- else
- g_warning ("Unsupported attribute for GtkContainer Child "
- "property: %s\n", names[i]);
+ if (strcmp (names[i], "name") == 0)
+ parser_data->child_prop_name = g_strdup (values[i]);
+ else if (strcmp (names[i], "translatable") == 0)
+ {
+ if (!_gtk_builder_boolean_from_string (values[1],
+ &parser_data->translatable,
+ error))
+ return;
+ }
+ else if (strcmp (names[i], "comments") == 0)
+ ; /* for translators */
+ else if (strcmp (names[i], "context") == 0)
+ parser_data->context = g_strdup (values[1]);
+ else
+ g_warning ("Unsupported attribute for GtkContainer Child "
+ "property: %s\n", names[i]);
}
else if (strcmp (element_name, "packing") == 0)
return;
@@ -623,10 +623,10 @@ attributes_start_element (GMarkupParseContext *context,
static void
attributes_text_element (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error)
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
{
PackingPropertiesData *parser_data = (PackingPropertiesData*)user_data;
gchar* value;
@@ -640,8 +640,8 @@ attributes_text_element (GMarkupParseContext *context,
domain = gtk_builder_get_translation_domain (parser_data->builder);
value = _gtk_builder_parser_translate (domain,
- parser_data->context,
- text);
+ parser_data->context,
+ text);
}
else
{
@@ -649,10 +649,10 @@ attributes_text_element (GMarkupParseContext *context,
}
gtk_container_buildable_set_child_property (parser_data->container,
- parser_data->builder,
- parser_data->child,
- parser_data->child_prop_name,
- value);
+ parser_data->builder,
+ parser_data->child,
+ parser_data->child_prop_name,
+ value);
g_free (parser_data->child_prop_name);
g_free (parser_data->context);
@@ -671,16 +671,16 @@ static const GMarkupParser attributes_parser =
static gboolean
gtk_container_buildable_custom_tag_start (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *tagname,
- GMarkupParser *parser,
- gpointer *data)
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data)
{
PackingPropertiesData *parser_data;
if (parent_buildable_iface->custom_tag_start (buildable, builder, child,
- tagname, parser, data))
+ tagname, parser, data))
return TRUE;
if (child && strcmp (tagname, "packing") == 0)
@@ -701,10 +701,10 @@ gtk_container_buildable_custom_tag_start (GtkBuildable *buildable,
static void
gtk_container_buildable_custom_tag_end (GtkBuildable *buildable,
- GtkBuilder *builder,
- GObject *child,
- const gchar *tagname,
- gpointer *data)
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer *data)
{
if (strcmp (tagname, "packing") == 0)
{
@@ -715,7 +715,7 @@ gtk_container_buildable_custom_tag_end (GtkBuildable *buildable,
if (parent_buildable_iface->custom_tag_end)
parent_buildable_iface->custom_tag_end (buildable, builder,
- child, tagname, data);
+ child, tagname, data);
}
@@ -751,9 +751,9 @@ gtk_container_child_type (GtkContainer *container)
/* --- GtkContainer child property mechanism --- */
static inline void
container_get_child_property (GtkContainer *container,
- GtkWidget *child,
- GParamSpec *pspec,
- GValue *value)
+ GtkWidget *child,
+ GParamSpec *pspec,
+ GValue *value)
{
GtkContainerClass *class = g_type_class_peek (pspec->owner_type);
@@ -762,10 +762,10 @@ container_get_child_property (GtkContainer *container,
static inline void
container_set_child_property (GtkContainer *container,
- GtkWidget *child,
- GParamSpec *pspec,
- const GValue *value,
- GObjectNotifyQueue *nqueue)
+ GtkWidget *child,
+ GParamSpec *pspec,
+ const GValue *value,
+ GObjectNotifyQueue *nqueue)
{
GValue tmp_value = { 0, };
GtkContainerClass *class = g_type_class_peek (pspec->owner_type);
@@ -774,18 +774,18 @@ container_set_child_property (GtkContainer *container,
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (!g_value_transform (value, &tmp_value))
g_warning ("unable to set child property `%s' of type `%s' from value of type `%s'",
- pspec->name,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
- G_VALUE_TYPE_NAME (value));
+ pspec->name,
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+ G_VALUE_TYPE_NAME (value));
else if (g_param_value_validate (pspec, &tmp_value) && !(pspec->flags & G_PARAM_LAX_VALIDATION))
{
gchar *contents = g_strdup_value_contents (value);
g_warning ("value \"%s\" of type `%s' is invalid for property `%s' of type `%s'",
- contents,
- G_VALUE_TYPE_NAME (value),
- pspec->name,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
+ contents,
+ G_VALUE_TYPE_NAME (value),
+ pspec->name,
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
g_free (contents);
}
else
@@ -808,9 +808,9 @@ container_set_child_property (GtkContainer *container,
**/
void
gtk_container_child_get_valist (GtkContainer *container,
- GtkWidget *child,
- const gchar *first_property_name,
- va_list var_args)
+ GtkWidget *child,
+ const gchar *first_property_name,
+ va_list var_args)
{
const gchar *name;
@@ -829,35 +829,35 @@ gtk_container_child_get_valist (GtkContainer *container,
gchar *error;
pspec = g_param_spec_pool_lookup (_gtk_widget_child_property_pool,
- name,
- G_OBJECT_TYPE (container),
- TRUE);
+ name,
+ G_OBJECT_TYPE (container),
+ TRUE);
if (!pspec)
- {
- g_warning ("%s: container class `%s' has no child property named `%s'",
- G_STRLOC,
- G_OBJECT_TYPE_NAME (container),
- name);
- break;
- }
+ {
+ g_warning ("%s: container class `%s' has no child property named `%s'",
+ G_STRLOC,
+ G_OBJECT_TYPE_NAME (container),
+ name);
+ break;
+ }
if (!(pspec->flags & G_PARAM_READABLE))
- {
- g_warning ("%s: child property `%s' of container class `%s' is not readable",
- G_STRLOC,
- pspec->name,
- G_OBJECT_TYPE_NAME (container));
- break;
- }
+ {
+ g_warning ("%s: child property `%s' of container class `%s' is not readable",
+ G_STRLOC,
+ pspec->name,
+ G_OBJECT_TYPE_NAME (container));
+ break;
+ }
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
container_get_child_property (container, child, pspec, &value);
G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- g_value_unset (&value);
- break;
- }
+ {
+ g_warning ("%s: %s", G_STRLOC, error);
+ g_free (error);
+ g_value_unset (&value);
+ break;
+ }
g_value_unset (&value);
name = va_arg (var_args, gchar*);
}
@@ -877,9 +877,9 @@ gtk_container_child_get_valist (GtkContainer *container,
**/
void
gtk_container_child_get_property (GtkContainer *container,
- GtkWidget *child,
- const gchar *property_name,
- GValue *value)
+ GtkWidget *child,
+ const gchar *property_name,
+ GValue *value)
{
GParamSpec *pspec;
@@ -892,17 +892,17 @@ gtk_container_child_get_property (GtkContainer *container,
g_object_ref (container);
g_object_ref (child);
pspec = g_param_spec_pool_lookup (_gtk_widget_child_property_pool, property_name,
- G_OBJECT_TYPE (container), TRUE);
+ G_OBJECT_TYPE (container), TRUE);
if (!pspec)
g_warning ("%s: container class `%s' has no child property named `%s'",
- G_STRLOC,
- G_OBJECT_TYPE_NAME (container),
- property_name);
+ G_STRLOC,
+ G_OBJECT_TYPE_NAME (container),
+ property_name);
else if (!(pspec->flags & G_PARAM_READABLE))
g_warning ("%s: child property `%s' of container class `%s' is not readable",
- G_STRLOC,
- pspec->name,
- G_OBJECT_TYPE_NAME (container));
+ G_STRLOC,
+ pspec->name,
+ G_OBJECT_TYPE_NAME (container));
else
{
GValue *prop_value, tmp_value = { 0, };
@@ -910,31 +910,31 @@ gtk_container_child_get_property (GtkContainer *container,
/* auto-conversion of the callers value type
*/
if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec))
- {
- g_value_reset (value);
- prop_value = value;
- }
+ {
+ g_value_reset (value);
+ prop_value = value;
+ }
else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec), G_VALUE_TYPE (value)))
- {
- g_warning ("can't retrieve child property `%s' of type `%s' as value of type `%s'",
- pspec->name,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
- G_VALUE_TYPE_NAME (value));
- g_object_unref (child);
- g_object_unref (container);
- return;
- }
+ {
+ g_warning ("can't retrieve child property `%s' of type `%s' as value of type `%s'",
+ pspec->name,
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+ G_VALUE_TYPE_NAME (value));
+ g_object_unref (child);
+ g_object_unref (container);
+ return;
+ }
else
- {
- g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
- prop_value = &tmp_value;
- }
+ {
+ g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+ prop_value = &tmp_value;
+ }
container_get_child_property (container, child, pspec, prop_value);
if (prop_value != value)
- {
- g_value_transform (prop_value, value);
- g_value_unset (&tmp_value);
- }
+ {
+ g_value_transform (prop_value, value);
+ g_value_unset (&tmp_value);
+ }
}
g_object_unref (child);
g_object_unref (container);
@@ -952,9 +952,9 @@ gtk_container_child_get_property (GtkContainer *container,
**/
void
gtk_container_child_set_valist (GtkContainer *container,
- GtkWidget *child,
- const gchar *first_property_name,
- va_list var_args)
+ GtkWidget *child,
+ const gchar *first_property_name,
+ va_list var_args)
{
GObjectNotifyQueue *nqueue;
const gchar *name;
@@ -973,37 +973,37 @@ gtk_container_child_set_valist (GtkContainer *container,
GValue value = { 0, };
gchar *error = NULL;
GParamSpec *pspec = g_param_spec_pool_lookup (_gtk_widget_child_property_pool,
- name,
- G_OBJECT_TYPE (container),
- TRUE);
+ name,
+ G_OBJECT_TYPE (container),
+ TRUE);
if (!pspec)
- {
- g_warning ("%s: container class `%s' has no child property named `%s'",
- G_STRLOC,
- G_OBJECT_TYPE_NAME (container),
- name);
- break;
- }
+ {
+ g_warning ("%s: container class `%s' has no child property named `%s'",
+ G_STRLOC,
+ G_OBJECT_TYPE_NAME (container),
+ name);
+ break;
+ }
if (!(pspec->flags & G_PARAM_WRITABLE))
- {
- g_warning ("%s: child property `%s' of container class `%s' is not writable",
- G_STRLOC,
- pspec->name,
- G_OBJECT_TYPE_NAME (container));
- break;
- }
+ {
+ g_warning ("%s: child property `%s' of container class `%s' is not writable",
+ G_STRLOC,
+ pspec->name,
+ G_OBJECT_TYPE_NAME (container));
+ break;
+ }
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
G_VALUE_COLLECT (&value, var_args, 0, &error);
if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
-
- /* we purposely leak the value here, it might not be
- * in a sane state if an error condition occoured
- */
- break;
- }
+ {
+ g_warning ("%s: %s", G_STRLOC, error);
+ g_free (error);
+
+ /* we purposely leak the value here, it might not be
+ * in a sane state if an error condition occoured
+ */
+ break;
+ }
container_set_child_property (container, child, pspec, &value, nqueue);
g_value_unset (&value);
name = va_arg (var_args, gchar*);
@@ -1025,9 +1025,9 @@ gtk_container_child_set_valist (GtkContainer *container,
**/
void
gtk_container_child_set_property (GtkContainer *container,
- GtkWidget *child,
- const gchar *property_name,
- const GValue *value)
+ GtkWidget *child,
+ const gchar *property_name,
+ const GValue *value)
{
GObjectNotifyQueue *nqueue;
GParamSpec *pspec;
@@ -1043,17 +1043,17 @@ gtk_container_child_set_property (GtkContainer *container,
nqueue = g_object_notify_queue_freeze (G_OBJECT (child), _gtk_widget_child_property_notify_context);
pspec = g_param_spec_pool_lookup (_gtk_widget_child_property_pool, property_name,
- G_OBJECT_TYPE (container), TRUE);
+ G_OBJECT_TYPE (container), TRUE);
if (!pspec)
g_warning ("%s: container class `%s' has no child property named `%s'",
- G_STRLOC,
- G_OBJECT_TYPE_NAME (container),
- property_name);
+ G_STRLOC,
+ G_OBJECT_TYPE_NAME (container),
+ property_name);
else if (!(pspec->flags & G_PARAM_WRITABLE))
g_warning ("%s: child property `%s' of container class `%s' is not writable",
- G_STRLOC,
- pspec->name,
- G_OBJECT_TYPE_NAME (container));
+ G_STRLOC,
+ pspec->name,
+ G_OBJECT_TYPE_NAME (container));
else
{
container_set_child_property (container, child, pspec, value, nqueue);
@@ -1076,9 +1076,9 @@ gtk_container_child_set_property (GtkContainer *container,
**/
void
gtk_container_add_with_properties (GtkContainer *container,
- GtkWidget *widget,
- const gchar *first_prop_name,
- ...)
+ GtkWidget *widget,
+ const gchar *first_prop_name,
+ ...)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -1115,9 +1115,9 @@ gtk_container_add_with_properties (GtkContainer *container,
**/
void
gtk_container_child_set (GtkContainer *container,
- GtkWidget *child,
- const gchar *first_prop_name,
- ...)
+ GtkWidget *child,
+ const gchar *first_prop_name,
+ ...)
{
va_list var_args;
@@ -1142,9 +1142,9 @@ gtk_container_child_set (GtkContainer *container,
**/
void
gtk_container_child_get (GtkContainer *container,
- GtkWidget *child,
- const gchar *first_prop_name,
- ...)
+ GtkWidget *child,
+ const gchar *first_prop_name,
+ ...)
{
va_list var_args;
@@ -1167,8 +1167,8 @@ gtk_container_child_get (GtkContainer *container,
**/
void
gtk_container_class_install_child_property (GtkContainerClass *cclass,
- guint property_id,
- GParamSpec *pspec)
+ guint property_id,
+ GParamSpec *pspec)
{
g_return_if_fail (GTK_IS_CONTAINER_CLASS (cclass));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
@@ -1184,8 +1184,8 @@ gtk_container_class_install_child_property (GtkContainerClass *cclass,
if (g_param_spec_pool_lookup (_gtk_widget_child_property_pool, pspec->name, G_OBJECT_CLASS_TYPE (cclass), FALSE))
{
g_warning (G_STRLOC ": class `%s' already contains a child property named `%s'",
- G_OBJECT_CLASS_NAME (cclass),
- pspec->name);
+ G_OBJECT_CLASS_NAME (cclass),
+ pspec->name);
return;
}
g_param_spec_ref (pspec);
@@ -1205,15 +1205,15 @@ gtk_container_class_install_child_property (GtkContainerClass *cclass,
*/
GParamSpec*
gtk_container_class_find_child_property (GObjectClass *cclass,
- const gchar *property_name)
+ const gchar *property_name)
{
g_return_val_if_fail (GTK_IS_CONTAINER_CLASS (cclass), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
return g_param_spec_pool_lookup (_gtk_widget_child_property_pool,
- property_name,
- G_OBJECT_CLASS_TYPE (cclass),
- TRUE);
+ property_name,
+ G_OBJECT_CLASS_TYPE (cclass),
+ TRUE);
}
/**
@@ -1228,7 +1228,7 @@ gtk_container_class_find_child_property (GObjectClass *cclass,
*/
GParamSpec**
gtk_container_class_list_child_properties (GObjectClass *cclass,
- guint *n_properties)
+ guint *n_properties)
{
GParamSpec **pspecs;
guint n;
@@ -1236,8 +1236,8 @@ gtk_container_class_list_child_properties (GObjectClass *cclass,
g_return_val_if_fail (GTK_IS_CONTAINER_CLASS (cclass), NULL);
pspecs = g_param_spec_pool_list (_gtk_widget_child_property_pool,
- G_OBJECT_CLASS_TYPE (cclass),
- &n);
+ G_OBJECT_CLASS_TYPE (cclass),
+ &n);
if (n_properties)
*n_properties = n;
@@ -1246,14 +1246,14 @@ gtk_container_class_list_child_properties (GObjectClass *cclass,
static void
gtk_container_add_unimplemented (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
g_warning ("GtkContainerClass::add not implemented for `%s'", g_type_name (G_TYPE_FROM_INSTANCE (container)));
}
static void
gtk_container_remove_unimplemented (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
g_warning ("GtkContainerClass::remove not implemented for `%s'", g_type_name (G_TYPE_FROM_INSTANCE (container)));
}
@@ -1303,9 +1303,9 @@ gtk_container_destroy (GtkWidget *widget)
static void
gtk_container_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GtkContainer *container = GTK_CONTAINER (object);
@@ -1328,9 +1328,9 @@ gtk_container_set_property (GObject *object,
static void
gtk_container_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GtkContainer *container = GTK_CONTAINER (object);
GtkContainerPrivate *priv = container->priv;
@@ -1368,7 +1368,7 @@ gtk_container_get_property (GObject *object,
**/
void
gtk_container_set_border_width (GtkContainer *container,
- guint border_width)
+ guint border_width)
{
GtkContainerPrivate *priv;
@@ -1382,7 +1382,7 @@ gtk_container_set_border_width (GtkContainer *container,
g_object_notify (G_OBJECT (container), "border-width");
if (gtk_widget_get_realized (GTK_WIDGET (container)))
- gtk_widget_queue_resize (GTK_WIDGET (container));
+ gtk_widget_queue_resize (GTK_WIDGET (container));
}
}
@@ -1419,7 +1419,7 @@ gtk_container_get_border_width (GtkContainer *container)
**/
void
gtk_container_add (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
GtkWidget *parent;
@@ -1459,7 +1459,7 @@ gtk_container_add (GtkContainer *container,
**/
void
gtk_container_remove (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -1491,7 +1491,7 @@ _gtk_container_dequeue_resize_handler (GtkContainer *container)
**/
void
gtk_container_set_resize_mode (GtkContainer *container,
- GtkResizeMode resize_mode)
+ GtkResizeMode resize_mode)
{
GtkContainerPrivate *priv;
@@ -1544,7 +1544,7 @@ gtk_container_get_resize_mode (GtkContainer *container)
**/
void
gtk_container_set_reallocate_redraws (GtkContainer *container,
- gboolean needs_redraws)
+ gboolean needs_redraws)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
@@ -1597,16 +1597,14 @@ gtk_container_idle_sizer (gpointer data)
static void
_gtk_container_queue_resize_internal (GtkContainer *container,
- gboolean invalidate_only)
+ gboolean invalidate_only)
{
- GtkContainerPrivate *priv;
GtkContainer *resize_container;
GtkWidget *parent;
GtkWidget *widget;
g_return_if_fail (GTK_IS_CONTAINER (container));
- priv = container->priv;
widget = GTK_WIDGET (container);
resize_container = gtk_container_get_resize_container (container);
@@ -1618,8 +1616,8 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
_gtk_widget_set_height_request_needed (widget, TRUE);
if ((resize_container && widget == GTK_WIDGET (resize_container)) ||
- !(parent = gtk_widget_get_parent (widget)))
- break;
+ !(parent = gtk_widget_get_parent (widget)))
+ break;
widget = parent;
}
@@ -1629,38 +1627,38 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
if (gtk_widget_get_visible (GTK_WIDGET (resize_container)) &&
(gtk_widget_is_toplevel (GTK_WIDGET (resize_container)) ||
gtk_widget_get_realized (GTK_WIDGET (resize_container))))
- {
- switch (resize_container->priv->resize_mode)
- {
- case GTK_RESIZE_QUEUE:
- if (!_gtk_widget_get_resize_pending (GTK_WIDGET (resize_container)))
- {
- _gtk_widget_set_resize_pending (GTK_WIDGET (resize_container), TRUE);
- if (container_resize_queue == NULL)
- gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
- gtk_container_idle_sizer,
- NULL, NULL);
- container_resize_queue = g_slist_prepend (container_resize_queue, resize_container);
- }
- break;
-
- case GTK_RESIZE_IMMEDIATE:
- gtk_container_check_resize (resize_container);
- break;
-
- case GTK_RESIZE_PARENT:
- g_assert_not_reached ();
- break;
- }
- }
+ {
+ switch (resize_container->priv->resize_mode)
+ {
+ case GTK_RESIZE_QUEUE:
+ if (!_gtk_widget_get_resize_pending (GTK_WIDGET (resize_container)))
+ {
+ _gtk_widget_set_resize_pending (GTK_WIDGET (resize_container), TRUE);
+ if (container_resize_queue == NULL)
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
+ gtk_container_idle_sizer,
+ NULL, NULL);
+ container_resize_queue = g_slist_prepend (container_resize_queue, resize_container);
+ }
+ break;
+
+ case GTK_RESIZE_IMMEDIATE:
+ gtk_container_check_resize (resize_container);
+ break;
+
+ case GTK_RESIZE_PARENT:
+ g_assert_not_reached ();
+ break;
+ }
+ }
else
- {
- /* we need to let hidden resize containers know that something
- * changed while they where hidden (currently only evaluated by
- * toplevels).
- */
- resize_container->priv->need_resize = TRUE;
- }
+ {
+ /* we need to let hidden resize containers know that something
+ * changed while they where hidden (currently only evaluated by
+ * toplevels).
+ */
+ resize_container->priv->need_resize = TRUE;
+ }
}
}
@@ -1722,7 +1720,7 @@ gtk_container_real_check_resize (GtkContainer *container)
gtk_widget_set_allocation (widget, &allocation);
}
else
- gtk_widget_queue_resize (widget);
+ gtk_widget_queue_resize (widget);
}
else
{
@@ -1800,8 +1798,8 @@ gtk_container_adjust_size_allocation (GtkWidget *widget,
if (!GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
{
parent_class->adjust_size_allocation (widget, orientation,
- minimum_size, natural_size, allocated_pos,
- allocated_size);
+ minimum_size, natural_size, allocated_pos,
+ allocated_size);
return;
}
@@ -1836,8 +1834,8 @@ gtk_container_adjust_size_allocation (GtkWidget *widget,
* and padding values.
*/
parent_class->adjust_size_allocation (widget, orientation,
- minimum_size, natural_size, allocated_pos,
- allocated_size);
+ minimum_size, natural_size, allocated_pos,
+ allocated_size);
}
/**
@@ -1878,8 +1876,8 @@ gtk_container_class_handle_border_width (GtkContainerClass *klass)
**/
void
gtk_container_forall (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkContainerClass *class;
@@ -1905,8 +1903,8 @@ gtk_container_forall (GtkContainer *container,
**/
void
gtk_container_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkContainerClass *class;
@@ -1935,7 +1933,7 @@ gtk_container_foreach (GtkContainer *container,
*/
void
gtk_container_set_focus_child (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
if (child)
@@ -1981,15 +1979,15 @@ gtk_container_get_children (GtkContainer *container)
GList *children = NULL;
gtk_container_foreach (container,
- gtk_container_children_callback,
- &children);
+ gtk_container_children_callback,
+ &children);
return g_list_reverse (children);
}
static void
gtk_container_child_position_callback (GtkWidget *widget,
- gpointer client_data)
+ gpointer client_data)
{
struct {
GtkWidget *child;
@@ -2004,7 +2002,7 @@ gtk_container_child_position_callback (GtkWidget *widget,
static gchar*
gtk_container_child_default_composite_name (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
struct {
GtkWidget *child;
@@ -2018,19 +2016,19 @@ gtk_container_child_default_composite_name (GtkContainer *container,
data.i = 0;
data.index = 0;
gtk_container_forall (container,
- gtk_container_child_position_callback,
- &data);
+ gtk_container_child_position_callback,
+ &data);
name = g_strdup_printf ("%s-%u",
- g_type_name (G_TYPE_FROM_INSTANCE (child)),
- data.index);
+ g_type_name (G_TYPE_FROM_INSTANCE (child)),
+ data.index);
return name;
}
gchar*
_gtk_container_child_composite_name (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
gboolean composite_child;
@@ -2045,19 +2043,19 @@ _gtk_container_child_composite_name (GtkContainer *container,
gchar *name;
if (!quark_composite_name)
- quark_composite_name = g_quark_from_static_string ("gtk-composite-name");
+ quark_composite_name = g_quark_from_static_string ("gtk-composite-name");
name = g_object_get_qdata (G_OBJECT (child), quark_composite_name);
if (!name)
- {
- GtkContainerClass *class;
+ {
+ GtkContainerClass *class;
- class = GTK_CONTAINER_GET_CLASS (container);
- if (class->composite_name)
- name = class->composite_name (container, child);
- }
+ class = GTK_CONTAINER_GET_CLASS (container);
+ if (class->composite_name)
+ name = class->composite_name (container, child);
+ }
else
- name = g_strdup (name);
+ name = g_strdup (name);
return name;
}
@@ -2072,7 +2070,7 @@ typedef struct {
static void
gtk_container_compute_expand_callback (GtkWidget *widget,
- gpointer client_data)
+ gpointer client_data)
{
ComputeExpandData *data = client_data;
@@ -2114,7 +2112,7 @@ gtk_container_compute_expand (GtkWidget *widget,
static void
gtk_container_real_set_focus_child (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkContainerPrivate *priv;
@@ -2126,10 +2124,10 @@ gtk_container_real_set_focus_child (GtkContainer *container,
if (child != priv->focus_child)
{
if (priv->focus_child)
- g_object_unref (priv->focus_child);
+ g_object_unref (priv->focus_child);
priv->focus_child = child;
if (priv->focus_child)
- g_object_ref (priv->focus_child);
+ g_object_ref (priv->focus_child);
}
@@ -2146,16 +2144,16 @@ gtk_container_real_set_focus_child (GtkContainer *container,
hadj = g_object_get_qdata (G_OBJECT (container), hadjustment_key_id);
vadj = g_object_get_qdata (G_OBJECT (container), vadjustment_key_id);
if (hadj || vadj)
- {
+ {
- focus_child = priv->focus_child;
- while (GTK_IS_CONTAINER (focus_child) && gtk_container_get_focus_child (GTK_CONTAINER (focus_child)))
- {
- focus_child = gtk_container_get_focus_child (GTK_CONTAINER (focus_child));
- }
+ focus_child = priv->focus_child;
+ while (GTK_IS_CONTAINER (focus_child) && gtk_container_get_focus_child (GTK_CONTAINER (focus_child)))
+ {
+ focus_child = gtk_container_get_focus_child (GTK_CONTAINER (focus_child));
+ }
- gtk_widget_translate_coordinates (focus_child, priv->focus_child,
- 0, 0, &x, &y);
+ gtk_widget_translate_coordinates (focus_child, priv->focus_child,
+ 0, 0, &x, &y);
gtk_widget_get_allocation (priv->focus_child, &allocation);
x += allocation.x;
@@ -2163,12 +2161,12 @@ gtk_container_real_set_focus_child (GtkContainer *container,
gtk_widget_get_allocation (focus_child, &allocation);
- if (vadj)
- gtk_adjustment_clamp_page (vadj, y, y + allocation.height);
+ if (vadj)
+ gtk_adjustment_clamp_page (vadj, y, y + allocation.height);
- if (hadj)
- gtk_adjustment_clamp_page (hadj, x, x + allocation.width);
- }
+ if (hadj)
+ gtk_adjustment_clamp_page (hadj, x, x + allocation.width);
+ }
}
}
@@ -2186,8 +2184,8 @@ gtk_container_get_all_children (GtkContainer *container)
GList *children = NULL;
gtk_container_forall (container,
- gtk_container_children_callback,
- &children);
+ gtk_container_children_callback,
+ &children);
return children;
}
@@ -2240,10 +2238,10 @@ gtk_container_focus (GtkWidget *widget,
if (gtk_widget_get_can_focus (widget))
{
if (!gtk_widget_has_focus (widget))
- {
- gtk_widget_grab_focus (widget);
- return_val = TRUE;
- }
+ {
+ gtk_widget_grab_focus (widget);
+ return_val = TRUE;
+ }
}
else
{
@@ -2251,21 +2249,21 @@ gtk_container_focus (GtkWidget *widget,
* chain to override.
*/
if (priv->has_focus_chain)
- children = g_list_copy (get_focus_chain (container));
+ children = g_list_copy (get_focus_chain (container));
else
- children = gtk_container_get_all_children (container);
+ children = gtk_container_get_all_children (container);
if (priv->has_focus_chain &&
- (direction == GTK_DIR_TAB_FORWARD ||
- direction == GTK_DIR_TAB_BACKWARD))
- {
- sorted_children = g_list_copy (children);
-
- if (direction == GTK_DIR_TAB_BACKWARD)
- sorted_children = g_list_reverse (sorted_children);
- }
+ (direction == GTK_DIR_TAB_FORWARD ||
+ direction == GTK_DIR_TAB_BACKWARD))
+ {
+ sorted_children = g_list_copy (children);
+
+ if (direction == GTK_DIR_TAB_BACKWARD)
+ sorted_children = g_list_reverse (sorted_children);
+ }
else
- sorted_children = _gtk_container_focus_sort (container, children, direction, NULL);
+ sorted_children = _gtk_container_focus_sort (container, children, direction, NULL);
return_val = gtk_container_focus_move (container, sorted_children, direction);
@@ -2278,8 +2276,8 @@ gtk_container_focus (GtkWidget *widget,
static gint
tab_compare (gconstpointer a,
- gconstpointer b,
- gpointer data)
+ gconstpointer b,
+ gpointer data)
{
GtkAllocation child1_allocation, child2_allocation;
const GtkWidget *child1 = a;
@@ -2299,9 +2297,9 @@ tab_compare (gconstpointer a,
gint x2 = child2_allocation.x + child2_allocation.width / 2;
if (text_direction == GTK_TEXT_DIR_RTL)
- return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
+ return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
else
- return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
+ return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
}
else
return (y1 < y2) ? -1 : 1;
@@ -2309,9 +2307,9 @@ tab_compare (gconstpointer a,
static GList *
gtk_container_focus_sort_tab (GtkContainer *container,
- GList *children,
- GtkDirectionType direction,
- GtkWidget *old_focus)
+ GList *children,
+ GtkDirectionType direction,
+ GtkWidget *old_focus)
{
GtkTextDirection text_direction = gtk_widget_get_direction (GTK_WIDGET (container));
children = g_list_sort_with_data (children, tab_compare, GINT_TO_POINTER (text_direction));
@@ -2330,13 +2328,13 @@ gtk_container_focus_sort_tab (GtkContainer *container,
*/
static gboolean
get_allocation_coords (GtkContainer *container,
- GtkWidget *widget,
- GdkRectangle *allocation)
+ GtkWidget *widget,
+ GdkRectangle *allocation)
{
gtk_widget_get_allocation (widget, allocation);
return gtk_widget_translate_coordinates (widget, GTK_WIDGET (container),
- 0, 0, &allocation->x, &allocation->y);
+ 0, 0, &allocation->x, &allocation->y);
}
/* Look for a child in @children that is intermediate between
@@ -2345,7 +2343,7 @@ get_allocation_coords (GtkContainer *container,
*/
static GtkWidget *
find_old_focus (GtkContainer *container,
- GList *children)
+ GList *children)
{
GList *tmp_list = children;
while (tmp_list)
@@ -2354,16 +2352,16 @@ find_old_focus (GtkContainer *container,
GtkWidget *widget = child;
while (widget && widget != (GtkWidget *)container)
- {
- GtkWidget *parent;
+ {
+ GtkWidget *parent;
parent = gtk_widget_get_parent (widget);
- if (parent && (gtk_container_get_focus_child (GTK_CONTAINER (parent)) != widget))
- goto next;
+ if (parent && (gtk_container_get_focus_child (GTK_CONTAINER (parent)) != widget))
+ goto next;
- widget = parent;
- }
+ widget = parent;
+ }
return child;
@@ -2376,7 +2374,7 @@ find_old_focus (GtkContainer *container,
static gboolean
old_focus_coords (GtkContainer *container,
- GdkRectangle *old_focus_rect)
+ GdkRectangle *old_focus_rect)
{
GtkWidget *widget = GTK_WIDGET (container);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
@@ -2404,8 +2402,8 @@ struct _CompareInfo
static gint
up_down_compare (gconstpointer a,
- gconstpointer b,
- gpointer data)
+ gconstpointer b,
+ gpointer data)
{
GdkRectangle allocation1;
GdkRectangle allocation2;
@@ -2424,9 +2422,9 @@ up_down_compare (gconstpointer a,
gint x2 = abs (allocation2.x + allocation2.width / 2 - compare->x);
if (compare->reverse)
- return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
+ return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
else
- return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
+ return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
}
else
return (y1 < y2) ? -1 : 1;
@@ -2434,9 +2432,9 @@ up_down_compare (gconstpointer a,
static GList *
gtk_container_focus_sort_up_down (GtkContainer *container,
- GList *children,
- GtkDirectionType direction,
- GtkWidget *old_focus)
+ GList *children,
+ GtkDirectionType direction,
+ GtkWidget *old_focus)
{
CompareInfo compare;
GList *tmp_list;
@@ -2460,38 +2458,38 @@ gtk_container_focus_sort_up_down (GtkContainer *container,
compare_x2 = old_allocation.x + old_allocation.width;
if (direction == GTK_DIR_UP)
- compare_y = old_allocation.y;
+ compare_y = old_allocation.y;
else
- compare_y = old_allocation.y + old_allocation.height;
+ compare_y = old_allocation.y + old_allocation.height;
tmp_list = children;
while (tmp_list)
- {
- GtkWidget *child = tmp_list->data;
- GList *next = tmp_list->next;
- gint child_x1, child_x2;
- GdkRectangle child_allocation;
-
- if (child != old_focus)
- {
- if (get_allocation_coords (container, child, &child_allocation))
- {
- child_x1 = child_allocation.x;
- child_x2 = child_allocation.x + child_allocation.width;
-
- if ((child_x2 <= compare_x1 || child_x1 >= compare_x2) /* No horizontal overlap */ ||
- (direction == GTK_DIR_DOWN && child_allocation.y + child_allocation.height < compare_y) || /* Not below */
- (direction == GTK_DIR_UP && child_allocation.y > compare_y)) /* Not above */
- {
- children = g_list_delete_link (children, tmp_list);
- }
- }
- else
- children = g_list_delete_link (children, tmp_list);
- }
-
- tmp_list = next;
- }
+ {
+ GtkWidget *child = tmp_list->data;
+ GList *next = tmp_list->next;
+ gint child_x1, child_x2;
+ GdkRectangle child_allocation;
+
+ if (child != old_focus)
+ {
+ if (get_allocation_coords (container, child, &child_allocation))
+ {
+ child_x1 = child_allocation.x;
+ child_x2 = child_allocation.x + child_allocation.width;
+
+ if ((child_x2 <= compare_x1 || child_x1 >= compare_x2) /* No horizontal overlap */ ||
+ (direction == GTK_DIR_DOWN && child_allocation.y + child_allocation.height < compare_y) || /* Not below */
+ (direction == GTK_DIR_UP && child_allocation.y > compare_y)) /* Not above */
+ {
+ children = g_list_delete_link (children, tmp_list);
+ }
+ }
+ else
+ children = g_list_delete_link (children, tmp_list);
+ }
+
+ tmp_list = next;
+ }
compare.x = (compare_x1 + compare_x2) / 2;
compare.y = old_allocation.y + old_allocation.height / 2;
@@ -2507,21 +2505,21 @@ gtk_container_focus_sort_up_down (GtkContainer *container,
gtk_widget_get_allocation (widget, &allocation);
if (old_focus_coords (container, &old_focus_rect))
- {
- compare.x = old_focus_rect.x + old_focus_rect.width / 2;
- }
+ {
+ compare.x = old_focus_rect.x + old_focus_rect.width / 2;
+ }
else
- {
- if (!gtk_widget_get_has_window (widget))
- compare.x = allocation.x + allocation.width / 2;
- else
- compare.x = allocation.width / 2;
- }
+ {
+ if (!gtk_widget_get_has_window (widget))
+ compare.x = allocation.x + allocation.width / 2;
+ else
+ compare.x = allocation.width / 2;
+ }
if (!gtk_widget_get_has_window (widget))
- compare.y = (direction == GTK_DIR_DOWN) ? allocation.y : allocation.y + allocation.height;
+ compare.y = (direction == GTK_DIR_DOWN) ? allocation.y : allocation.y + allocation.height;
else
- compare.y = (direction == GTK_DIR_DOWN) ? 0 : + allocation.height;
+ compare.y = (direction == GTK_DIR_DOWN) ? 0 : + allocation.height;
}
children = g_list_sort_with_data (children, up_down_compare, &compare);
@@ -2534,8 +2532,8 @@ gtk_container_focus_sort_up_down (GtkContainer *container,
static gint
left_right_compare (gconstpointer a,
- gconstpointer b,
- gpointer data)
+ gconstpointer b,
+ gpointer data)
{
GdkRectangle allocation1;
GdkRectangle allocation2;
@@ -2554,9 +2552,9 @@ left_right_compare (gconstpointer a,
gint y2 = abs (allocation2.y + allocation2.height / 2 - compare->y);
if (compare->reverse)
- return (y1 < y2) ? 1 : ((y1 == y2) ? 0 : -1);
+ return (y1 < y2) ? 1 : ((y1 == y2) ? 0 : -1);
else
- return (y1 < y2) ? -1 : ((y1 == y2) ? 0 : 1);
+ return (y1 < y2) ? -1 : ((y1 == y2) ? 0 : 1);
}
else
return (x1 < x2) ? -1 : 1;
@@ -2564,9 +2562,9 @@ left_right_compare (gconstpointer a,
static GList *
gtk_container_focus_sort_left_right (GtkContainer *container,
- GList *children,
- GtkDirectionType direction,
- GtkWidget *old_focus)
+ GList *children,
+ GtkDirectionType direction,
+ GtkWidget *old_focus)
{
CompareInfo compare;
GList *tmp_list;
@@ -2590,38 +2588,38 @@ gtk_container_focus_sort_left_right (GtkContainer *container,
compare_y2 = old_allocation.y + old_allocation.height;
if (direction == GTK_DIR_LEFT)
- compare_x = old_allocation.x;
+ compare_x = old_allocation.x;
else
- compare_x = old_allocation.x + old_allocation.width;
+ compare_x = old_allocation.x + old_allocation.width;
tmp_list = children;
while (tmp_list)
- {
- GtkWidget *child = tmp_list->data;
- GList *next = tmp_list->next;
- gint child_y1, child_y2;
- GdkRectangle child_allocation;
-
- if (child != old_focus)
- {
- if (get_allocation_coords (container, child, &child_allocation))
- {
- child_y1 = child_allocation.y;
- child_y2 = child_allocation.y + child_allocation.height;
-
- if ((child_y2 <= compare_y1 || child_y1 >= compare_y2) /* No vertical overlap */ ||
- (direction == GTK_DIR_RIGHT && child_allocation.x + child_allocation.width < compare_x) || /* Not to left */
- (direction == GTK_DIR_LEFT && child_allocation.x > compare_x)) /* Not to right */
- {
- children = g_list_delete_link (children, tmp_list);
- }
- }
- else
- children = g_list_delete_link (children, tmp_list);
- }
-
- tmp_list = next;
- }
+ {
+ GtkWidget *child = tmp_list->data;
+ GList *next = tmp_list->next;
+ gint child_y1, child_y2;
+ GdkRectangle child_allocation;
+
+ if (child != old_focus)
+ {
+ if (get_allocation_coords (container, child, &child_allocation))
+ {
+ child_y1 = child_allocation.y;
+ child_y2 = child_allocation.y + child_allocation.height;
+
+ if ((child_y2 <= compare_y1 || child_y1 >= compare_y2) /* No vertical overlap */ ||
+ (direction == GTK_DIR_RIGHT && child_allocation.x + child_allocation.width < compare_x) || /* Not to left */
+ (direction == GTK_DIR_LEFT && child_allocation.x > compare_x)) /* Not to right */
+ {
+ children = g_list_delete_link (children, tmp_list);
+ }
+ }
+ else
+ children = g_list_delete_link (children, tmp_list);
+ }
+
+ tmp_list = next;
+ }
compare.y = (compare_y1 + compare_y2) / 2;
compare.x = old_allocation.x + old_allocation.width / 2;
@@ -2637,21 +2635,21 @@ gtk_container_focus_sort_left_right (GtkContainer *container,
gtk_widget_get_allocation (widget, &allocation);
if (old_focus_coords (container, &old_focus_rect))
- {
- compare.y = old_focus_rect.y + old_focus_rect.height / 2;
- }
+ {
+ compare.y = old_focus_rect.y + old_focus_rect.height / 2;
+ }
else
- {
- if (!gtk_widget_get_has_window (widget))
- compare.y = allocation.y + allocation.height / 2;
- else
- compare.y = allocation.height / 2;
- }
+ {
+ if (!gtk_widget_get_has_window (widget))
+ compare.y = allocation.y + allocation.height / 2;
+ else
+ compare.y = allocation.height / 2;
+ }
if (!gtk_widget_get_has_window (widget))
- compare.x = (direction == GTK_DIR_RIGHT) ? allocation.x : allocation.x + allocation.width;
+ compare.x = (direction == GTK_DIR_RIGHT) ? allocation.x : allocation.x + allocation.width;
else
- compare.x = (direction == GTK_DIR_RIGHT) ? 0 : allocation.width;
+ compare.x = (direction == GTK_DIR_RIGHT) ? 0 : allocation.width;
}
children = g_list_sort_with_data (children, left_right_compare, &compare);
@@ -2683,16 +2681,16 @@ gtk_container_focus_sort_left_right (GtkContainer *container,
**/
GList *
_gtk_container_focus_sort (GtkContainer *container,
- GList *children,
- GtkDirectionType direction,
- GtkWidget *old_focus)
+ GList *children,
+ GtkDirectionType direction,
+ GtkWidget *old_focus)
{
GList *visible_children = NULL;
while (children)
{
if (gtk_widget_get_realized (children->data))
- visible_children = g_list_prepend (visible_children, children->data);
+ visible_children = g_list_prepend (visible_children, children->data);
children = children->next;
}
@@ -2716,8 +2714,8 @@ _gtk_container_focus_sort (GtkContainer *container,
static gboolean
gtk_container_focus_move (GtkContainer *container,
- GList *children,
- GtkDirectionType direction)
+ GList *children,
+ GtkDirectionType direction)
{
GtkContainerPrivate *priv = container->priv;
GtkWidget *focus_child;
@@ -2731,7 +2729,7 @@ gtk_container_focus_move (GtkContainer *container,
children = children->next;
if (!child)
- continue;
+ continue;
if (focus_child)
{
@@ -2739,8 +2737,8 @@ gtk_container_focus_move (GtkContainer *container,
{
focus_child = NULL;
- if (gtk_widget_child_focus (child, direction))
- return TRUE;
+ if (gtk_widget_child_focus (child, direction))
+ return TRUE;
}
}
else if (gtk_widget_is_drawable (child) &&
@@ -2757,7 +2755,7 @@ gtk_container_focus_move (GtkContainer *container,
static void
gtk_container_children_callback (GtkWidget *widget,
- gpointer client_data)
+ gpointer client_data)
{
GList **children;
@@ -2870,7 +2868,7 @@ gtk_container_set_focus_chain (GtkContainer *container,
**/
gboolean
gtk_container_get_focus_chain (GtkContainer *container,
- GList **focus_chain)
+ GList **focus_chain)
{
GtkContainerPrivate *priv;
@@ -2881,9 +2879,9 @@ gtk_container_get_focus_chain (GtkContainer *container,
if (focus_chain)
{
if (priv->has_focus_chain)
- *focus_chain = g_list_copy (get_focus_chain (container));
+ *focus_chain = g_list_copy (get_focus_chain (container));
else
- *focus_chain = NULL;
+ *focus_chain = NULL;
}
return priv->has_focus_chain;
@@ -2949,7 +2947,7 @@ gtk_container_unset_focus_chain (GtkContainer *container)
*/
void
gtk_container_set_focus_vadjustment (GtkContainer *container,
- GtkAdjustment *adjustment)
+ GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
if (adjustment)
@@ -2959,9 +2957,9 @@ gtk_container_set_focus_vadjustment (GtkContainer *container,
g_object_ref (adjustment);
g_object_set_qdata_full (G_OBJECT (container),
- vadjustment_key_id,
- adjustment,
- g_object_unref);
+ vadjustment_key_id,
+ adjustment,
+ g_object_unref);
}
/**
@@ -3004,7 +3002,7 @@ gtk_container_get_focus_vadjustment (GtkContainer *container)
*/
void
gtk_container_set_focus_hadjustment (GtkContainer *container,
- GtkAdjustment *adjustment)
+ GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
if (adjustment)
@@ -3014,9 +3012,9 @@ gtk_container_set_focus_hadjustment (GtkContainer *container,
g_object_ref (adjustment);
g_object_set_qdata_full (G_OBJECT (container),
- hadjustment_key_id,
- adjustment,
- g_object_unref);
+ hadjustment_key_id,
+ adjustment,
+ g_object_unref);
}
/**
@@ -3048,14 +3046,14 @@ gtk_container_show_all (GtkWidget *widget)
g_return_if_fail (GTK_IS_CONTAINER (widget));
gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_show_all,
- NULL);
+ (GtkCallback) gtk_widget_show_all,
+ NULL);
gtk_widget_show (widget);
}
static void
gtk_container_draw_child (GtkWidget *child,
- gpointer client_data)
+ gpointer client_data)
{
struct {
GtkWidget *container;
@@ -3063,8 +3061,8 @@ gtk_container_draw_child (GtkWidget *child,
} *data = client_data;
gtk_container_propagate_draw (GTK_CONTAINER (data->container),
- child,
- data->cr);
+ child,
+ data->cr);
}
static gint
@@ -3081,14 +3079,14 @@ gtk_container_draw (GtkWidget *widget,
gtk_container_forall (GTK_CONTAINER (widget),
gtk_container_draw_child,
- &data);
+ &data);
return FALSE;
}
static void
gtk_container_map_child (GtkWidget *child,
- gpointer client_data)
+ gpointer client_data)
{
if (gtk_widget_get_visible (child) &&
gtk_widget_get_child_visible (child) &&
@@ -3102,8 +3100,8 @@ gtk_container_map (GtkWidget *widget)
gtk_widget_set_mapped (widget, TRUE);
gtk_container_forall (GTK_CONTAINER (widget),
- gtk_container_map_child,
- NULL);
+ gtk_container_map_child,
+ NULL);
if (gtk_widget_get_has_window (widget))
gdk_window_show (gtk_widget_get_window (widget));
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 95dd068..e701835 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1323,14 +1323,12 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
GtkWidgetPath *path)
{
GtkCssProvider *css_provider;
- GtkCssProviderPrivate *priv;
GtkStyleProperties *props;
GArray *priority_info;
guint i;
css_provider = GTK_CSS_PROVIDER (provider);
props = gtk_style_properties_new ();
- priv = css_provider->priv;
css_provider_dump_symbolic_colors (css_provider, props);
priority_info = css_provider_get_selectors (css_provider, path);
diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c
index a7444b1..9f59210 100644
--- a/gtk/gtkcustompaperunixdialog.c
+++ b/gtk/gtkcustompaperunixdialog.c
@@ -245,10 +245,8 @@ static void
gtk_custom_paper_unix_dialog_class_init (GtkCustomPaperUnixDialogClass *class)
{
GObjectClass *object_class;
- GtkWidgetClass *widget_class;
object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
object_class->finalize = gtk_custom_paper_unix_dialog_finalize;
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index b21146c..43c1394 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3933,7 +3933,6 @@ gtk_entry_motion_notify (GtkWidget *widget,
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = NULL;
- GdkDragContext *context;
gint tmp_pos;
gint i;
@@ -3956,11 +3955,11 @@ gtk_entry_motion_notify (GtkWidget *widget,
{
icon_info->in_drag = TRUE;
icon_info->pressed = FALSE;
- context = gtk_drag_begin (widget,
- icon_info->target_list,
- icon_info->actions,
- 1,
- (GdkEvent*)event);
+ gtk_drag_begin (widget,
+ icon_info->target_list,
+ icon_info->actions,
+ 1,
+ (GdkEvent*)event);
}
return TRUE;
@@ -3970,7 +3969,7 @@ gtk_entry_motion_notify (GtkWidget *widget,
if (priv->mouse_cursor_obscured)
{
GdkCursor *cursor;
-
+
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM);
gdk_window_set_cursor (priv->text_area, cursor);
g_object_unref (cursor);
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 8463533..43da440 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -1723,21 +1723,19 @@ model_add_special (GtkFileChooserButton *button)
static void
model_add_volumes (GtkFileChooserButton *button,
- GSList *volumes)
+ GSList *volumes)
{
GtkListStore *store;
gint pos;
gboolean local_only;
- GtkFileSystem *file_system;
GSList *l;
-
+
if (!volumes)
return;
store = GTK_LIST_STORE (button->priv->model);
pos = model_get_type_position (button, ROW_TYPE_VOLUME);
local_only = gtk_file_chooser_get_local_only (GTK_FILE_CHOOSER (button->priv->dialog));
- file_system = button->priv->fs;
for (l = volumes; l; l = l->next)
{
@@ -1749,13 +1747,13 @@ model_add_volumes (GtkFileChooserButton *button,
volume = l->data;
if (local_only)
- {
- if (_gtk_file_system_volume_is_mounted (volume))
- {
- GFile *base_file;
+ {
+ if (_gtk_file_system_volume_is_mounted (volume))
+ {
+ GFile *base_file;
- base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file != NULL)
+ base_file = _gtk_file_system_volume_get_root (volume);
+ if (base_file != NULL)
{
if (!g_file_is_native (base_file))
{
@@ -1765,26 +1763,26 @@ model_add_volumes (GtkFileChooserButton *button,
else
g_object_unref (base_file);
}
- }
- }
+ }
+ }
pixbuf = _gtk_file_system_volume_render_icon (volume,
- GTK_WIDGET (button),
- button->priv->icon_size,
- NULL);
+ GTK_WIDGET (button),
+ button->priv->icon_size,
+ NULL);
display_name = _gtk_file_system_volume_get_display_name (volume);
gtk_list_store_insert (store, &iter, pos);
gtk_list_store_set (store, &iter,
- ICON_COLUMN, pixbuf,
- DISPLAY_NAME_COLUMN, display_name,
- TYPE_COLUMN, ROW_TYPE_VOLUME,
- DATA_COLUMN, _gtk_file_system_volume_ref (volume),
- IS_FOLDER_COLUMN, TRUE,
- -1);
+ ICON_COLUMN, pixbuf,
+ DISPLAY_NAME_COLUMN, display_name,
+ TYPE_COLUMN, ROW_TYPE_VOLUME,
+ DATA_COLUMN, _gtk_file_system_volume_ref (volume),
+ IS_FOLDER_COLUMN, TRUE,
+ -1);
if (pixbuf)
- g_object_unref (pixbuf);
+ g_object_unref (pixbuf);
g_free (display_name);
button->priv->n_volumes++;
@@ -2278,13 +2276,11 @@ static void
update_label_and_image (GtkFileChooserButton *button)
{
GtkFileChooserButtonPrivate *priv = button->priv;
- GdkPixbuf *pixbuf;
gchar *label_text;
GSList *files;
files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (priv->dialog));
label_text = NULL;
- pixbuf = NULL;
if (priv->update_button_cancellable)
{
@@ -2301,51 +2297,53 @@ update_label_and_image (GtkFileChooserButton *button)
volume = _gtk_file_system_get_volume_for_file (priv->fs, file);
if (volume)
- {
- GFile *base_file;
-
- base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file && g_file_equal (base_file, file))
- {
- label_text = _gtk_file_system_volume_get_display_name (volume);
- pixbuf = _gtk_file_system_volume_render_icon (volume,
- GTK_WIDGET (button),
- priv->icon_size,
- NULL);
- }
-
- if (base_file)
- g_object_unref (base_file);
-
- _gtk_file_system_volume_unref (volume);
-
- if (label_text)
- goto out;
- }
+ {
+ GFile *base_file;
+
+ base_file = _gtk_file_system_volume_get_root (volume);
+ if (base_file && g_file_equal (base_file, file))
+ {
+ GdkPixbuf *pixbuf;
+
+ label_text = _gtk_file_system_volume_get_display_name (volume);
+ pixbuf = _gtk_file_system_volume_render_icon (volume,
+ GTK_WIDGET (button),
+ priv->icon_size,
+ NULL);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
+ if (pixbuf)
+ g_object_unref (pixbuf);
+ }
+
+ if (base_file)
+ g_object_unref (base_file);
+
+ _gtk_file_system_volume_unref (volume);
+
+ if (label_text)
+ goto out;
+ }
if (g_file_is_native (file))
- {
- priv->update_button_cancellable =
- _gtk_file_system_get_info (priv->fs, file,
- "standard::icon,standard::display-name",
- update_label_get_info_cb,
- g_object_ref (button));
- }
+ {
+ priv->update_button_cancellable =
+ _gtk_file_system_get_info (priv->fs, file,
+ "standard::icon,standard::display-name",
+ update_label_get_info_cb,
+ g_object_ref (button));
+ }
else
- {
- GdkPixbuf *pixbuf;
-
- label_text = _gtk_file_system_get_bookmark_label (button->priv->fs, file);
-
- pixbuf = gtk_icon_theme_load_icon (get_icon_theme (GTK_WIDGET (priv->image)),
- "text-x-generic",
- priv->icon_size, 0, NULL);
-
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
-
- if (pixbuf)
- g_object_unref (pixbuf);
- }
+ {
+ GdkPixbuf *pixbuf;
+
+ label_text = _gtk_file_system_get_bookmark_label (button->priv->fs, file);
+ pixbuf = gtk_icon_theme_load_icon (get_icon_theme (GTK_WIDGET (priv->image)),
+ "text-x-generic",
+ priv->icon_size, 0, NULL);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
+ if (pixbuf)
+ g_object_unref (pixbuf);
+ }
}
out:
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 8ffd758..2c9fdf0 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -2155,7 +2155,7 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
g_object_unref (combo_selected);
}
-
+
impl->changing_folder = old_changing_folders;
profile_end ("end", NULL);
@@ -2166,12 +2166,9 @@ static void
shortcuts_add_current_folder (GtkFileChooserDefault *impl)
{
int pos;
- gboolean success;
g_assert (!impl->shortcuts_current_folder_active);
- success = TRUE;
-
g_assert (impl->current_folder != NULL);
pos = shortcut_find_position (impl, impl->current_folder);
@@ -2181,26 +2178,24 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
GFile *base_file;
/* Separator */
-
shortcuts_insert_separator (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
/* Item */
-
pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER);
volume = _gtk_file_system_get_volume_for_file (impl->file_system, impl->current_folder);
if (volume)
- base_file = _gtk_file_system_volume_get_root (volume);
+ base_file = _gtk_file_system_volume_get_root (volume);
else
- base_file = NULL;
+ base_file = NULL;
if (base_file && g_file_equal (base_file, impl->current_folder))
- shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
+ shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
else
- shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_FILE, NULL, impl->current_folder, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
+ shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_FILE, NULL, impl->current_folder, NULL, FALSE, SHORTCUTS_CURRENT_FOLDER);
if (base_file)
- g_object_unref (base_file);
+ g_object_unref (base_file);
}
else if (impl->save_folder_combo != NULL)
{
@@ -3987,23 +3982,21 @@ out:
}
static void
-file_list_drag_data_received_cb (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time_,
- gpointer data)
+file_list_drag_data_received_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time_,
+ gpointer data)
{
GtkFileChooserDefault *impl;
- GtkFileChooser *chooser;
gchar **uris;
char *uri;
GFile *file;
impl = GTK_FILE_CHOOSER_DEFAULT (data);
- chooser = GTK_FILE_CHOOSER (data);
/* Allow only drags from other widgets; see bug #533891. */
if (gtk_drag_get_source_widget (context) == widget)
@@ -4027,13 +4020,13 @@ file_list_drag_data_received_cb (GtkWidget *widget,
data->file = file;
if (impl->file_list_drag_data_received_cancellable)
- g_cancellable_cancel (impl->file_list_drag_data_received_cancellable);
+ g_cancellable_cancel (impl->file_list_drag_data_received_cancellable);
impl->file_list_drag_data_received_cancellable =
- _gtk_file_system_get_info (impl->file_system, file,
- "standard::type",
- file_list_drag_data_received_get_info_cb,
- data);
+ _gtk_file_system_get_info (impl->file_system, file,
+ "standard::type",
+ file_list_drag_data_received_get_info_cb,
+ data);
}
g_signal_stop_emission_by_name (widget, "drag-data-received");
@@ -4213,7 +4206,6 @@ list_button_press_event_cb (GtkWidget *widget,
GtkFileChooserDefault *impl)
{
static gboolean in_press = FALSE;
- gboolean handled;
if (in_press)
return FALSE;
@@ -4222,7 +4214,7 @@ list_button_press_event_cb (GtkWidget *widget,
return FALSE;
in_press = TRUE;
- handled = gtk_widget_event (impl->browse_files_tree_view, (GdkEvent *) event);
+ gtk_widget_event (impl->browse_files_tree_view, (GdkEvent *) event);
in_press = FALSE;
file_list_popup_menu (impl, event);
@@ -5747,12 +5739,8 @@ gtk_file_chooser_default_screen_changed (GtkWidget *widget,
static void
gtk_file_chooser_default_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+ GtkAllocation *allocation)
{
- GtkFileChooserDefault *impl;
-
- impl = GTK_FILE_CHOOSER_DEFAULT (widget);
-
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->size_allocate (widget, allocation);
}
@@ -5762,6 +5750,7 @@ set_sort_column (GtkFileChooserDefault *impl)
GtkTreeSortable *sortable;
sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
+
/* can happen when we're still populating the model */
if (sortable == NULL)
return;
@@ -6721,7 +6710,6 @@ update_chooser_entry (GtkFileChooserDefault *impl)
{
GtkTreeSelection *selection;
struct update_chooser_entry_selected_foreach_closure closure;
- const char *file_part;
/* no need to update the file chooser's entry if there's no entry */
if (impl->operation_mode == OPERATION_MODE_SEARCH ||
@@ -6730,10 +6718,10 @@ update_chooser_entry (GtkFileChooserDefault *impl)
return;
if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
+ || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+ || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
return;
g_assert (impl->location_entry != NULL);
@@ -6742,8 +6730,6 @@ update_chooser_entry (GtkFileChooserDefault *impl)
closure.num_selected = 0;
gtk_tree_selection_selected_foreach (selection, update_chooser_entry_selected_foreach, &closure);
- file_part = NULL;
-
if (closure.num_selected == 0)
{
goto maybe_clear_entry;
@@ -6757,7 +6743,7 @@ update_chooser_entry (GtkFileChooserDefault *impl)
info = _gtk_file_system_model_get_info (impl->browse_files_model, &closure.first_selected_iter);
- /* If the cursor moved to the row of the newly created folder,
+ /* If the cursor moved to the row of the newly created folder,
* retrieving info will return NULL.
*/
if (!info)
@@ -6769,13 +6755,13 @@ update_chooser_entry (GtkFileChooserDefault *impl)
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
- {
- /* We don't want the name to change when clicking on a folder... */
- change_entry = (! _gtk_file_info_consider_as_directory (info));
- }
+ impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ {
+ /* Don't change the name when clicking on a folder... */
+ change_entry = (! _gtk_file_info_consider_as_directory (info));
+ }
else
- change_entry = TRUE; /* ... unless we are in SELECT_FOLDER mode */
+ change_entry = TRUE; /* ... unless we are in SELECT_FOLDER mode */
if (change_entry)
{
@@ -6791,10 +6777,9 @@ update_chooser_entry (GtkFileChooserDefault *impl)
else
{
g_assert (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER));
+ impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER));
/* Multiple selection, so just clear the entry. */
-
g_free (impl->browse_files_last_selected_name);
impl->browse_files_last_selected_name = NULL;
@@ -6814,26 +6799,26 @@ update_chooser_entry (GtkFileChooserDefault *impl)
entry_text = gtk_entry_get_text (GTK_ENTRY (impl->location_entry));
len = strlen (entry_text);
if (len != 0)
- {
- /* The file chooser entry may have appended a "/" to its text. So
- * take it out, and compare the result to the old selection.
- */
- if (entry_text[len - 1] == G_DIR_SEPARATOR)
- {
- char *tmp;
+ {
+ /* The file chooser entry may have appended a "/" to its text.
+ * So take it out, and compare the result to the old selection.
+ */
+ if (entry_text[len - 1] == G_DIR_SEPARATOR)
+ {
+ gchar *tmp;
- tmp = g_strndup (entry_text, len - 1);
- clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, tmp) == 0);
- g_free (tmp);
- }
- else
- clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, entry_text) == 0);
- }
+ tmp = g_strndup (entry_text, len - 1);
+ clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, tmp) == 0);
+ g_free (tmp);
+ }
+ else
+ clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, entry_text) == 0);
+ }
else
- clear_entry = FALSE;
+ clear_entry = FALSE;
if (clear_entry)
- _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
+ _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
}
}
@@ -7850,10 +7835,9 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
/* Guesses a size based upon font sizes */
static void
find_good_size_from_style (GtkWidget *widget,
- gint *width,
- gint *height)
+ gint *width,
+ gint *height)
{
- GtkFileChooserDefault *impl;
GtkStyleContext *context;
GtkStateFlags state;
int font_size;
@@ -7863,14 +7847,12 @@ find_good_size_from_style (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
- impl = GTK_FILE_CHOOSER_DEFAULT (widget);
-
screen = gtk_widget_get_screen (widget);
if (screen)
{
resolution = gdk_screen_get_resolution (screen);
if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */
- resolution = 96.0;
+ resolution = 96.0;
}
else
resolution = 96.0; /* wheeee */
@@ -9146,13 +9128,9 @@ static void
recent_clear_model (GtkFileChooserDefault *impl,
gboolean remove_from_treeview)
{
- GtkTreeModel *model;
-
if (!impl->recent_model)
return;
- model = GTK_TREE_MODEL (impl->recent_model);
-
if (remove_from_treeview)
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
@@ -10303,16 +10281,14 @@ shortcuts_pane_model_filter_row_draggable (GtkTreeDragSource *drag_source,
return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks);
}
-/* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */
+/* GtkTreeDragSource::drag_data_get implementation for the shortcuts
+ * filter model
+ */
static gboolean
shortcuts_pane_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
- GtkTreePath *path,
- GtkSelectionData *selection_data)
+ GtkTreePath *path,
+ GtkSelectionData *selection_data)
{
- ShortcutsPaneModelFilter *model;
-
- model = SHORTCUTS_PANE_MODEL_FILTER (drag_source);
-
/* FIXME */
return FALSE;
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 6df60c7..4ac71ed 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -667,11 +667,13 @@ typedef enum {
COMPLETE_BUT_NOT_UNIQUE /* completion inserted, it is a complete name but not unique */
} CommonPrefixResult;
-/* Finds a common prefix based on the contents of the entry and mandatorily appends it */
+/* Finds a common prefix based on the contents of the entry
+ * and mandatorily appends it
+ */
static CommonPrefixResult
append_common_prefix (GtkFileChooserEntry *chooser_entry,
- gboolean highlight,
- gboolean show_errors)
+ gboolean highlight,
+ gboolean show_errors)
{
gchar *common_prefix;
GFile *unique_file;
@@ -689,16 +691,16 @@ append_common_prefix (GtkFileChooserEntry *chooser_entry,
error = NULL;
if (!find_common_prefix (chooser_entry, &common_prefix, &unique_file, &is_complete_not_unique, &prefix_expands_the_file_part, &error))
{
- /* If the user types an incomplete hostname ("http://foo" without a slash
- * after that), it's not an error. We just don't want to pop up a
- * meaningless completion window in that state.
+ /* If the user types an incomplete hostname ("http://foo" without
+ * a slash after that), it's not an error. We just don't want to
+ * pop up a meaningless completion window in that state.
*/
if (!g_error_matches (error, GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME)
- && show_errors)
- {
- beep (chooser_entry);
- pop_up_completion_feedback (chooser_entry, _("Invalid path"));
- }
+ && show_errors)
+ {
+ beep (chooser_entry);
+ pop_up_completion_feedback (chooser_entry, _("Invalid path"));
+ }
g_error_free (error);
@@ -710,85 +712,84 @@ append_common_prefix (GtkFileChooserEntry *chooser_entry,
if (unique_file)
{
if (!char_after_cursor_is_directory_separator (chooser_entry))
- {
- gboolean appended;
-
- common_prefix = maybe_append_separator_to_file (chooser_entry,
- unique_file,
- common_prefix,
- &appended);
- if (appended)
- prefix_expands_the_file_part = TRUE;
- }
+ {
+ gboolean appended;
+
+ common_prefix = maybe_append_separator_to_file (chooser_entry,
+ unique_file,
+ common_prefix,
+ &appended);
+ if (appended)
+ prefix_expands_the_file_part = TRUE;
+ }
g_object_unref (unique_file);
if (prefix_expands_the_file_part)
- result = COMPLETED_UNIQUE;
+ result = COMPLETED_UNIQUE;
else
- result = NOTHING_INSERTED_UNIQUE;
+ result = NOTHING_INSERTED_UNIQUE;
have_result = TRUE;
}
else
{
if (is_complete_not_unique)
- {
- result = COMPLETE_BUT_NOT_UNIQUE;
- have_result = TRUE;
- }
+ {
+ result = COMPLETE_BUT_NOT_UNIQUE;
+ have_result = TRUE;
+ }
}
if (common_prefix)
{
gint cursor_pos;
- gint common_prefix_len;
gint pos;
cursor_pos = gtk_editable_get_position (GTK_EDITABLE (chooser_entry));
- common_prefix_len = g_utf8_strlen (common_prefix, -1);
pos = chooser_entry->file_part_pos;
if (prefix_expands_the_file_part)
- {
- chooser_entry->in_change = TRUE;
- gtk_editable_delete_text (GTK_EDITABLE (chooser_entry),
- pos, cursor_pos);
- gtk_editable_insert_text (GTK_EDITABLE (chooser_entry),
- common_prefix, -1,
- &pos);
- chooser_entry->in_change = FALSE;
-
- if (highlight)
- {
- gtk_editable_select_region (GTK_EDITABLE (chooser_entry),
- cursor_pos,
- pos); /* equivalent to cursor_pos + common_prefix_len); */
- chooser_entry->has_completion = TRUE;
- }
- else
- gtk_editable_set_position (GTK_EDITABLE (chooser_entry), pos);
- }
+ {
+ chooser_entry->in_change = TRUE;
+ gtk_editable_delete_text (GTK_EDITABLE (chooser_entry),
+ pos, cursor_pos);
+ gtk_editable_insert_text (GTK_EDITABLE (chooser_entry),
+ common_prefix, -1,
+ &pos);
+ chooser_entry->in_change = FALSE;
+
+ if (highlight)
+ {
+ /* equivalent to cursor_pos + common_prefix_len); */
+ gtk_editable_select_region (GTK_EDITABLE (chooser_entry),
+ cursor_pos,
+ pos);
+ chooser_entry->has_completion = TRUE;
+ }
+ else
+ gtk_editable_set_position (GTK_EDITABLE (chooser_entry), pos);
+ }
else if (!have_result)
- {
- result = NOTHING_INSERTED_COMPLETE;
- have_result = TRUE;
- }
+ {
+ result = NOTHING_INSERTED_COMPLETE;
+ have_result = TRUE;
+ }
g_free (common_prefix);
if (have_result)
- return result;
+ return result;
else
- return COMPLETED;
+ return COMPLETED;
}
else
{
if (have_result)
- return result;
+ return result;
else
- return NO_MATCH;
+ return NO_MATCH;
}
}
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index 5353fb9..0d66568 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -1150,17 +1150,18 @@ gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
return font_desc;
}
-/* This sets the font in the preview entry to the selected font, and tries to
- make sure that the preview entry is a reasonable size, i.e. so that the
- text can be seen with a bit of space to spare. But it tries to avoid
- resizing the entry every time the font changes.
- This also used to shrink the preview if the font size was decreased, but
- that made it awkward if the user wanted to resize the window themself. */
+/* This sets the font in the preview entry to the selected font,
+ * and tries to make sure that the preview entry is a reasonable
+ * size, i.e. so that the text can be seen with a bit of space to
+ * spare. But it tries to avoid resizing the entry every time the
+ * font changes. This also used to shrink the preview if the font
+ * size was decreased, but that made it awkward if the user wanted
+ * to resize the window themself.
+ */
static void
gtk_font_selection_update_preview (GtkFontSelection *fontsel)
{
GtkFontSelectionPrivate *priv = fontsel->priv;
- GtkStyleContext *context;
gint new_height;
GtkRequisition old_requisition, new_requisition;
GtkWidget *preview_entry = priv->preview_entry;
@@ -1168,18 +1169,17 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
- context = gtk_widget_get_style_context (preview_entry);
gtk_widget_override_font (preview_entry,
gtk_font_selection_get_font_description (fontsel));
gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
-
+
/* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
gtk_widget_set_size_request (preview_entry, -1, new_height);
-
+
/* This sets the preview text, if it hasn't been set already. */
text = gtk_entry_get_text (GTK_ENTRY (preview_entry));
if (strlen (text) == 0)
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index a57d81b..5b8326b 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -414,7 +414,6 @@ gtk_handle_box_realize (GtkWidget *widget)
GtkHandleBoxPrivate *priv = hb->priv;
GtkAllocation allocation;
GtkRequisition requisition;
- GtkStateFlags state;
GtkStyleContext *context;
GtkWidget *child;
GdkWindow *window;
@@ -433,7 +432,7 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK);
+ | GDK_EXPOSURE_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
@@ -446,12 +445,12 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = (gtk_widget_get_events (widget) |
- GDK_EXPOSURE_MASK |
- GDK_BUTTON1_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK);
+ attributes.event_mask = (gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK
+ | GDK_BUTTON1_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
priv->bin_window = gdk_window_new (window,
@@ -461,7 +460,7 @@ gtk_handle_box_realize (GtkWidget *widget)
child = gtk_bin_get_child (GTK_BIN (hb));
if (child)
gtk_widget_set_parent_window (child, priv->bin_window);
-
+
gtk_widget_get_preferred_size (widget, &requisition, NULL);
attributes.x = 0;
@@ -471,23 +470,21 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes.window_type = GDK_WINDOW_TOPLEVEL;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
- attributes.event_mask = (gtk_widget_get_events (widget) |
- GDK_KEY_PRESS_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_FOCUS_CHANGE_MASK |
- GDK_STRUCTURE_MASK);
+ attributes.event_mask = (gtk_widget_get_events (widget)
+ | GDK_KEY_PRESS_MASK
+ | GDK_ENTER_NOTIFY_MASK
+ | GDK_LEAVE_NOTIFY_MASK
+ | GDK_FOCUS_CHANGE_MASK
+ | GDK_STRUCTURE_MASK);
attributes.type_hint = GDK_WINDOW_TYPE_HINT_TOOLBAR;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_TYPE_HINT;
priv->float_window = gdk_window_new (gtk_widget_get_root_window (widget),
- &attributes, attributes_mask);
+ &attributes, attributes_mask);
gdk_window_set_user_data (priv->float_window, widget);
gdk_window_set_decorations (priv->float_window, 0);
gdk_window_set_type_hint (priv->float_window, GDK_WINDOW_TYPE_HINT_TOOLBAR);
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
gtk_style_context_set_background (context, window);
gtk_style_context_set_background (context, priv->bin_window);
gtk_style_context_set_background (context, priv->float_window);
@@ -780,7 +777,6 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb,
GtkWidget *widget = GTK_WIDGET (hb);
GtkStateFlags state;
GtkStyleContext *context;
- GdkWindow *window;
guint x;
guint y;
guint width;
@@ -810,7 +806,6 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb,
}
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
state = gtk_widget_get_state_flags (widget);
gtk_style_context_save (context);
@@ -964,8 +959,8 @@ gtk_handle_box_get_child_detached (GtkHandleBox *handle_box)
}
static void
-gtk_handle_box_paint (GtkWidget *widget,
- cairo_t *cr)
+gtk_handle_box_paint (GtkWidget *widget,
+ cairo_t *cr)
{
GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
GtkHandleBoxPrivate *priv = hb->priv;
@@ -976,7 +971,6 @@ gtk_handle_box_paint (GtkWidget *widget,
gint width, height;
GdkRectangle rect;
gint handle_position;
- GtkOrientation handle_orientation;
handle_position = effective_handle_position (hb);
@@ -996,33 +990,29 @@ gtk_handle_box_paint (GtkWidget *widget,
{
case GTK_POS_LEFT:
rect.x = 0;
- rect.y = 0;
+ rect.y = 0;
rect.width = DRAG_HANDLE_SIZE;
rect.height = height;
- handle_orientation = GTK_ORIENTATION_VERTICAL;
break;
case GTK_POS_RIGHT:
- rect.x = width - DRAG_HANDLE_SIZE;
+ rect.x = width - DRAG_HANDLE_SIZE;
rect.y = 0;
rect.width = DRAG_HANDLE_SIZE;
rect.height = height;
- handle_orientation = GTK_ORIENTATION_VERTICAL;
break;
case GTK_POS_TOP:
rect.x = 0;
- rect.y = 0;
+ rect.y = 0;
rect.width = width;
rect.height = DRAG_HANDLE_SIZE;
- handle_orientation = GTK_ORIENTATION_HORIZONTAL;
break;
case GTK_POS_BOTTOM:
rect.x = 0;
rect.y = height - DRAG_HANDLE_SIZE;
rect.width = width;
rect.height = DRAG_HANDLE_SIZE;
- handle_orientation = GTK_ORIENTATION_HORIZONTAL;
break;
- default:
+ default:
g_assert_not_reached ();
break;
}
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index 427a7d5..7c67fa5 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -795,8 +795,7 @@ gtk_hsv_motion (GtkWidget *widget,
{
GtkHSV *hsv = GTK_HSV (widget);
GtkHSVPrivate *priv = hsv->priv;
- GdkModifierType mods;
- double x, y;
+ gdouble x, y;
if (priv->mode == DRAG_NONE)
return FALSE;
@@ -804,7 +803,6 @@ gtk_hsv_motion (GtkWidget *widget,
gdk_event_request_motions (event);
x = event->x;
y = event->y;
- mods = event->state;
if (priv->mode == DRAG_H)
{
diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c
index a890a46..ddeae73 100644
--- a/gtk/gtkiconfactory.c
+++ b/gtk/gtkiconfactory.c
@@ -2733,12 +2733,12 @@ typedef struct {
} IconSourceParserData;
static void
-icon_source_start_element (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **names,
- const gchar **values,
- gpointer user_data,
- GError **error)
+icon_source_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **names,
+ const gchar **values,
+ gpointer user_data,
+ GError **error)
{
gint i;
gchar *stock_id = NULL;
@@ -2757,63 +2757,63 @@ icon_source_start_element (GMarkupParseContext *context,
if (!parser_data->in_source)
{
if (strcmp (element_name, "sources") != 0)
- {
- error_msg = g_strdup_printf ("Unexpected element %s, expected <sources>", element_name);
- error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
- goto error;
- }
+ {
+ error_msg = g_strdup_printf ("Unexpected element %s, expected <sources>", element_name);
+ error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
+ goto error;
+ }
parser_data->in_source = TRUE;
return;
}
else
{
if (strcmp (element_name, "source") != 0)
- {
- error_msg = g_strdup_printf ("Unexpected element %s, expected <source>", element_name);
- error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
- goto error;
- }
+ {
+ error_msg = g_strdup_printf ("Unexpected element %s, expected <source>", element_name);
+ error_domain = GTK_BUILDER_ERROR_INVALID_TAG;
+ goto error;
+ }
}
for (i = 0; names[i]; i++)
{
if (strcmp (names[i], "stock-id") == 0)
- stock_id = g_strdup (values[i]);
+ stock_id = g_strdup (values[i]);
else if (strcmp (names[i], "filename") == 0)
- filename = g_strdup (values[i]);
+ filename = g_strdup (values[i]);
else if (strcmp (names[i], "icon-name") == 0)
- icon_name = g_strdup (values[i]);
+ icon_name = g_strdup (values[i]);
else if (strcmp (names[i], "size") == 0)
- {
+ {
if (!_gtk_builder_enum_from_string (GTK_TYPE_ICON_SIZE,
values[i],
&size,
error))
- return;
- }
+ return;
+ }
else if (strcmp (names[i], "direction") == 0)
- {
+ {
if (!_gtk_builder_enum_from_string (GTK_TYPE_TEXT_DIRECTION,
values[i],
&direction,
error))
- return;
- }
+ return;
+ }
else if (strcmp (names[i], "state") == 0)
- {
+ {
if (!_gtk_builder_enum_from_string (GTK_TYPE_STATE_TYPE,
values[i],
&state,
error))
- return;
- }
+ return;
+ }
else
- {
- error_msg = g_strdup_printf ("'%s' is not a valid attribute of <%s>",
- names[i], "source");
- error_domain = GTK_BUILDER_ERROR_INVALID_ATTRIBUTE;
- goto error;
- }
+ {
+ error_msg = g_strdup_printf ("'%s' is not a valid attribute of <%s>",
+ names[i], "source");
+ error_domain = GTK_BUILDER_ERROR_INVALID_ATTRIBUTE;
+ goto error;
+ }
}
if (!stock_id)
@@ -2839,20 +2839,11 @@ icon_source_start_element (GMarkupParseContext *context,
gchar *tmp;
gint line_number, char_number;
- g_markup_parse_context_get_position (context,
- &line_number,
- &char_number);
+ g_markup_parse_context_get_position (context, &line_number, &char_number);
tmp = g_strdup_printf ("%s:%d:%d %s", "input",
- line_number, char_number, error_msg);
-#if 0
- g_set_error_literal (error,
- GTK_BUILDER_ERROR,
- error_domain,
- tmp);
-#else
- g_warning ("%s", tmp);
-#endif
+ line_number, char_number, error_msg);
+ g_set_error_literal (error, GTK_BUILDER_ERROR, error_domain, tmp);
g_free (tmp);
g_free (stock_id);
g_free (filename);
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 161de84..2e2f3e9 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -2404,7 +2404,7 @@ static void
gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view)
{
gtk_icon_view_unselect_all (icon_view);
-
+
if (icon_view->priv->cursor_item != NULL)
gtk_icon_view_select_item (icon_view, icon_view->priv->cursor_item);
}
@@ -2413,19 +2413,19 @@ static gboolean
gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view)
{
GtkTreePath *path;
- gboolean activated;
GtkCellAreaContext *context;
-
+
if (!icon_view->priv->cursor_item)
return FALSE;
context = g_ptr_array_index (icon_view->priv->row_contexts, icon_view->priv->cursor_item->row);
gtk_icon_view_set_cell_data (icon_view, icon_view->priv->cursor_item);
- activated = gtk_cell_area_activate (icon_view->priv->cell_area, context,
- GTK_WIDGET (icon_view),
- (GdkRectangle *)icon_view->priv->cursor_item,
- 0 /* XXX flags */, FALSE);
+ gtk_cell_area_activate (icon_view->priv->cell_area, context,
+ GTK_WIDGET (icon_view),
+ (GdkRectangle *)icon_view->priv->cursor_item,
+ 0 /* XXX flags */,
+ FALSE);
path = gtk_tree_path_new_from_indices (icon_view->priv->cursor_item->index, -1);
gtk_icon_view_item_activated (icon_view, path);
@@ -2911,14 +2911,13 @@ gtk_icon_view_item_invalidate_size (GtkIconViewItem *item)
static void
gtk_icon_view_paint_item (GtkIconView *icon_view,
- cairo_t *cr,
- GtkIconViewItem *item,
- gint x,
- gint y,
- gboolean draw_focus)
+ cairo_t *cr,
+ GtkIconViewItem *item,
+ gint x,
+ gint y,
+ gboolean draw_focus)
{
GdkRectangle cell_area;
- GtkStateType state;
GtkCellRendererState flags;
GtkWidget *widget = GTK_WIDGET (icon_view);
GtkIconViewPrivate *priv = icon_view->priv;
@@ -2927,23 +2926,9 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
if (priv->model == NULL)
return;
-
+
style = gtk_widget_get_style (widget);
gtk_icon_view_set_cell_data (icon_view, item);
-
- if (item->selected)
- {
- flags = GTK_CELL_RENDERER_SELECTED;
- if (gtk_widget_has_focus (widget))
- state = GTK_STATE_SELECTED;
- else
- state = GTK_STATE_ACTIVE;
- }
- else
- {
- flags = 0;
- state = GTK_STATE_NORMAL;
- }
if (item->selected)
{
@@ -2953,10 +2938,10 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
GTK_SHADOW_NONE,
GTK_WIDGET (icon_view),
"icon_view_item",
- x - icon_view->priv->item_padding,
- y - icon_view->priv->item_padding,
- item->cell_area.width + icon_view->priv->item_padding * 2,
- item->cell_area.height + icon_view->priv->item_padding * 2);
+ x - icon_view->priv->item_padding,
+ y - icon_view->priv->item_padding,
+ item->cell_area.width + icon_view->priv->item_padding * 2,
+ item->cell_area.height + icon_view->priv->item_padding * 2);
}
cell_area.x = x;
@@ -2964,13 +2949,17 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
cell_area.width = item->cell_area.width;
cell_area.height = item->cell_area.height;
+ flags = 0;
+ if (item->selected)
+ flags |= GTK_CELL_RENDERER_SELECTED;
+
if (gtk_widget_has_focus (widget) && item == icon_view->priv->cursor_item)
flags |= GTK_CELL_RENDERER_FOCUSED;
context = g_ptr_array_index (priv->row_contexts, item->row);
gtk_cell_area_render (priv->cell_area, context,
- widget, cr, &cell_area, &cell_area, flags,
- draw_focus);
+ widget, cr, &cell_area, &cell_area, flags,
+ draw_focus);
}
static void
@@ -3267,29 +3256,24 @@ verify_items (GtkIconView *icon_view)
static void
gtk_icon_view_row_changed (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
{
GtkIconView *icon_view = GTK_ICON_VIEW (data);
- GtkIconViewItem *item;
- gint index;
/* ignore changes in branches */
if (gtk_tree_path_get_depth (path) > 1)
return;
gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
-
- index = gtk_tree_path_get_indices(path)[0];
- item = g_list_nth_data (icon_view->priv->items, index);
/* Here we can use a "grow-only" strategy for optimization
- * and only invalidate a single item and queue a relayout
- * instead of invalidating the whole thing.
+ * and only invalidate a single item and queue a relayout
+ * instead of invalidating the whole thing.
*
* For now GtkIconView still cant deal with huge models
- * so just invalidate the whole thing when the model
+ * so just invalidate the whole thing when the model
* changes.
*/
gtk_icon_view_invalidate_sizes (icon_view);
@@ -4069,45 +4053,48 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
}
-static void
-gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
- GtkIconViewItem *item)
+static void
+gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
+ GtkIconViewItem *item)
{
- GtkAllocation allocation;
+ GtkIconViewPrivate *priv = icon_view->priv;
GtkWidget *widget = GTK_WIDGET (icon_view);
- gint x, y, width, height;
- GdkRectangle item_area =
- {
- item->cell_area.x - icon_view->priv->item_padding,
- item->cell_area.y - icon_view->priv->item_padding,
- item->cell_area.width + icon_view->priv->item_padding * 2,
- item->cell_area.height + icon_view->priv->item_padding * 2
- };
-
- width = gdk_window_get_width (icon_view->priv->bin_window);
- height = gdk_window_get_height (icon_view->priv->bin_window);
- gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
+ GtkAdjustment *hadj, *vadj;
+ GtkAllocation allocation;
+ gint x, y;
+ GdkRectangle item_area;
+
+ item_area.x = item->cell_area.x - priv->item_padding;
+ item_area.y = item->cell_area.y - priv->item_padding;
+ item_area.width = item->cell_area.width + priv->item_padding * 2;
+ item_area.height = item->cell_area.height + priv->item_padding * 2;
+ gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
gtk_widget_get_allocation (widget, &allocation);
+ hadj = icon_view->priv->hadjustment;
+ vadj = icon_view->priv->vadjustment;
+
if (y + item_area.y < 0)
- gtk_adjustment_set_value (icon_view->priv->vadjustment,
- gtk_adjustment_get_value (icon_view->priv->vadjustment) + y + item_area.y);
+ gtk_adjustment_set_value (vadj,
+ gtk_adjustment_get_value (vadj)
+ + y + item_area.y);
else if (y + item_area.y + item_area.height > allocation.height)
- gtk_adjustment_set_value (icon_view->priv->vadjustment,
- gtk_adjustment_get_value (icon_view->priv->vadjustment) + y + item_area.y +
- item_area.height - allocation.height);
+ gtk_adjustment_set_value (vadj,
+ gtk_adjustment_get_value (vadj)
+ + y + item_area.y + item_area.height - allocation.height);
if (x + item_area.x < 0)
- gtk_adjustment_set_value (icon_view->priv->hadjustment,
- gtk_adjustment_get_value (icon_view->priv->hadjustment) + x + item_area.x);
+ gtk_adjustment_set_value (hadj,
+ gtk_adjustment_get_value (hadj)
+ + x + item_area.x);
else if (x + item_area.x + item_area.width > allocation.width)
- gtk_adjustment_set_value (icon_view->priv->hadjustment,
- gtk_adjustment_get_value (icon_view->priv->hadjustment) + x + item_area.x +
- item_area.width - allocation.width);
+ gtk_adjustment_set_value (hadj,
+ gtk_adjustment_get_value (hadj)
+ + x + item_area.x + item_area.width - allocation.width);
- gtk_adjustment_changed (icon_view->priv->hadjustment);
- gtk_adjustment_changed (icon_view->priv->vadjustment);
+ gtk_adjustment_changed (hadj);
+ gtk_adjustment_changed (vadj);
}
/* GtkCellLayout implementation */
@@ -8560,13 +8547,11 @@ gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model,
GtkWidget *widget;
GtkIconView *icon_view;
GtkIconViewItem *item;
- GtkIconViewAccessible *a11y_view;
GtkIconViewItemAccessible *a11y_item;
const gchar *name;
gchar *text;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
- a11y_view = GTK_ICON_VIEW_ACCESSIBLE (atk_obj);
index = gtk_tree_path_get_indices(path)[0];
a11y_item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (
gtk_icon_view_accessible_find_child (atk_obj, index));
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index e82095e..c0a8f37 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -187,11 +187,7 @@ gtk_info_bar_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GtkInfoBar *info_bar;
- GtkInfoBarPrivate *priv;
-
- info_bar = GTK_INFO_BAR (object);
- priv = info_bar->priv;
+ GtkInfoBar *info_bar = GTK_INFO_BAR (object);
switch (prop_id)
{
@@ -210,11 +206,7 @@ gtk_info_bar_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkInfoBar *info_bar;
- GtkInfoBarPrivate *priv;
-
- info_bar = GTK_INFO_BAR (object);
- priv = info_bar->priv;
+ GtkInfoBar *info_bar = GTK_INFO_BAR (object);
switch (prop_id)
{
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 272e6de..12b0d6a 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -2481,7 +2481,7 @@ gtk_label_set_markup_internal (GtkLabel *label,
* g_markup_printf_escaped()<!-- -->:
* |[
* char *markup;
- *
+ *
* markup = g_markup_printf_escaped ("<span style=\"italic\">%s</span>", str);
* gtk_label_set_markup (GTK_LABEL (label), markup);
* g_free (markup);
@@ -2491,18 +2491,14 @@ void
gtk_label_set_markup (GtkLabel *label,
const gchar *str)
{
- GtkLabelPrivate *priv;
-
g_return_if_fail (GTK_IS_LABEL (label));
- priv = label->priv;
-
g_object_freeze_notify (G_OBJECT (label));
gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
gtk_label_set_use_markup_internal (label, TRUE);
gtk_label_set_use_underline_internal (label, FALSE);
-
+
gtk_label_recalculate (label);
g_object_thaw_notify (G_OBJECT (label));
@@ -2511,32 +2507,30 @@ gtk_label_set_markup (GtkLabel *label,
/**
* gtk_label_set_markup_with_mnemonic:
* @label: a #GtkLabel
- * @str: a markup string (see <link linkend="PangoMarkupFormat">Pango markup format</link>)
- *
- * Parses @str which is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>,
+ * @str: a markup string (see
+ * <link linkend="PangoMarkupFormat">Pango markup format</link>)
+ *
+ * Parses @str which is marked up with the
+ * <link linkend="PangoMarkupFormat">Pango text markup language</link>,
* setting the label's text and attribute list based on the parse results.
* If characters in @str are preceded by an underscore, they are underlined
* indicating that they represent a keyboard accelerator called a mnemonic.
*
- * The mnemonic key can be used to activate another widget, chosen
+ * The mnemonic key can be used to activate another widget, chosen
* automatically, or explicitly using gtk_label_set_mnemonic_widget().
- **/
+ */
void
gtk_label_set_markup_with_mnemonic (GtkLabel *label,
- const gchar *str)
+ const gchar *str)
{
- GtkLabelPrivate *priv;
-
g_return_if_fail (GTK_IS_LABEL (label));
- priv = label->priv;
-
g_object_freeze_notify (G_OBJECT (label));
gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
gtk_label_set_use_markup_internal (label, TRUE);
gtk_label_set_use_underline_internal (label, TRUE);
-
+
gtk_label_recalculate (label);
g_object_thaw_notify (G_OBJECT (label));
@@ -4083,7 +4077,6 @@ gtk_label_draw (GtkWidget *widget,
GtkAllocation allocation;
GtkStyleContext *context;
GtkStateFlags state;
- GdkWindow *window;
gint x, y;
gtk_label_ensure_layout (label, FALSE);
@@ -4095,7 +4088,6 @@ gtk_label_draw (GtkWidget *widget,
get_layout_location (label, &x, &y);
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
gtk_widget_get_allocation (widget, &allocation);
cairo_translate (cr, -allocation.x, -allocation.y);
@@ -4112,7 +4104,6 @@ gtk_label_draw (GtkWidget *widget,
{
gint range[2];
cairo_region_t *clip;
- GtkStateType state;
range[0] = info->selection_anchor;
range[1] = info->selection_end;
@@ -4129,10 +4120,7 @@ gtk_label_draw (GtkWidget *widget,
range,
1);
- /* FIXME should use gtk_paint, but it can't use a clip
- * region
- */
-
+ /* FIXME should use gtk_paint, but it can't use a clip region */
cairo_save (cr);
gdk_cairo_region (cr, clip);
@@ -4140,8 +4128,8 @@ gtk_label_draw (GtkWidget *widget,
state = GTK_STATE_FLAG_SELECTED;
- if (gtk_widget_has_focus (widget))
- state |= GTK_STATE_FLAG_FOCUSED;
+ if (gtk_widget_has_focus (widget))
+ state |= GTK_STATE_FLAG_FOCUSED;
gtk_style_context_get (context, state,
"background-color", &bg_color,
@@ -4173,7 +4161,7 @@ gtk_label_draw (GtkWidget *widget,
GdkColor *visited_link_color;
if (info->selectable && gtk_widget_has_focus (widget))
- gtk_label_draw_cursor (label, cr, x, y);
+ gtk_label_draw_cursor (label, cr, x, y);
focus_link = gtk_label_get_focus_link (label);
active_link = info->active_link;
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index 290ce48..2c576bb 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -1801,15 +1801,15 @@ gtk_list_store_compare_func (GSequenceIter *a,
g_assert (VALID_ITER (&iter_a, list_store));
g_assert (VALID_ITER (&iter_b, list_store));
-
+
retval = (* func) (GTK_TREE_MODEL (list_store), &iter_a, &iter_b, data);
if (priv->order == GTK_SORT_DESCENDING)
{
if (retval > 0)
- retval = -1;
+ retval = -1;
else if (retval < 0)
- retval = 1;
+ retval = 1;
}
return retval;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 44266da..c792b4e 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1373,11 +1373,8 @@ static void
gtk_menu_tearoff_bg_copy (GtkMenu *menu)
{
GtkMenuPrivate *priv = menu->priv;
- GtkWidget *widget;
gint width, height;
- widget = GTK_WIDGET (menu);
-
if (priv->torn_off)
{
GdkWindow *window;
@@ -3039,16 +3036,12 @@ gtk_menu_draw (GtkWidget *widget,
GdkRectangle border;
GdkRectangle upper;
GdkRectangle lower;
- GdkWindow *window;
gint arrow_space;
- GtkStateFlags state;
GtkBorder menu_border;
menu = GTK_MENU (widget);
priv = menu->priv;
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
- state = gtk_widget_get_state_flags (widget);
get_arrows_visible_area (menu, &border, &upper, &lower, &arrow_space);
get_menu_border (widget, &menu_border);
@@ -3084,9 +3077,9 @@ gtk_menu_draw (GtkWidget *widget,
upper.width, upper.height);
gtk_render_arrow (context, cr, 0,
- upper.x + (upper.width - arrow_size) / 2,
- upper.y + menu_border.top + (arrow_space - arrow_size) / 2,
- arrow_size);
+ upper.x + (upper.width - arrow_size) / 2,
+ upper.y + menu_border.top + (arrow_space - arrow_size) / 2,
+ arrow_size);
gtk_style_context_restore (context);
}
@@ -4568,7 +4561,6 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
gint submenu_top = 0;
gint submenu_bottom = 0;
gint width = 0;
- gint height = 0;
GtkWidget *event_widget;
GtkMenuPopdownData *popdown_data;
GdkWindow *window;
@@ -4585,7 +4577,6 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
submenu_bottom = submenu_top + gdk_window_get_height (window);
width = gdk_window_get_width (gtk_widget_get_window (event_widget));
- height = gdk_window_get_height (gtk_widget_get_window (event_widget));
if (event->x >= 0 && event->x < width)
{
@@ -5155,7 +5146,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
GtkMenuPrivate *priv = menu->priv;
GtkWidget *widget = GTK_WIDGET (menu_shell);
gint child_offset, child_height;
- gint width, height;
+ gint height;
gint y;
gint arrow_height;
gboolean last_child = 0;
@@ -5164,7 +5155,6 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
* If not we need to scroll the menu so that it becomes fully
* visible.
*/
-
if (compute_child_offset (menu, menu_item,
&child_offset, &child_height, &last_child))
{
@@ -5175,7 +5165,6 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
GtkBorder padding;
y = priv->scroll_offset;
- width = gdk_window_get_width (gtk_widget_get_window (widget));
height = gdk_window_get_height (gtk_widget_get_window (widget));
gtk_widget_style_get (widget,
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index a111db5..855fe0e 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1569,13 +1569,11 @@ gtk_menu_item_draw (GtkWidget *widget,
GtkStyleContext *context;
GtkBorder padding;
GtkWidget *child, *parent;
- GdkWindow *window;
gint x, y, w, h, width, height;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
state = gtk_widget_get_state_flags (widget);
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
diff --git a/gtk/gtkmountoperation-x11.c b/gtk/gtkmountoperation-x11.c
index af0c291..d757139 100644
--- a/gtk/gtkmountoperation-x11.c
+++ b/gtk/gtkmountoperation-x11.c
@@ -183,9 +183,6 @@ find_largest_sizes (gulong *data,
while (nitems > 0)
{
int w, h;
- gboolean replace;
-
- replace = FALSE;
if (nitems < 3)
return FALSE; /* no space for w, h */
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 9f671d5..e50dc6f 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1472,7 +1472,6 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
{
GtkNotebookPrivate *priv = notebook->priv;
GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
- GtkNotebookPage *page;
GList *last, *child;
gint page_num;
@@ -1510,8 +1509,6 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
if (!child || child->data == priv->cur_page)
return FALSE;
- page = child->data;
-
if (effective_direction == GTK_DIR_RIGHT)
page_num = reorder_tab (notebook, child->next, priv->focus_tab);
else
@@ -2281,13 +2278,10 @@ gtk_notebook_size_allocate (GtkWidget *widget,
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
- GtkStyleContext *context;
gint tab_pos = get_effective_tab_pos (notebook);
gboolean is_rtl;
gint focus_width;
- context = gtk_widget_get_style_context (widget);
-
gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
gtk_widget_set_allocation (widget, allocation);
@@ -3206,12 +3200,10 @@ check_threshold (GtkNotebook *notebook,
gint current_y)
{
GtkNotebookPrivate *priv = notebook->priv;
- GtkWidget *widget;
gint dnd_threshold;
GdkRectangle rectangle = { 0, }; /* shut up gcc */
GtkSettings *settings;
- widget = GTK_WIDGET (notebook);
settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
g_object_get (G_OBJECT (settings), "gtk-dnd-drag-threshold", &dnd_threshold, NULL);
@@ -3520,10 +3512,8 @@ gtk_notebook_drag_failed (GtkWidget *widget,
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebook *dest_notebook = NULL;
- GdkDisplay *display;
gint x, y;
- display = gtk_widget_get_display (widget);
gdk_device_get_position (gdk_drag_context_get_device (context),
NULL, &x, &y);
@@ -5403,26 +5393,23 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
}
static void
-gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
- gboolean show_arrows,
- gint min,
- gint max,
- gint tab_space,
- GList **last_child,
- gint *n,
- gint *remaining_space)
+gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
+ gboolean show_arrows,
+ gint min,
+ gint max,
+ gint tab_space,
+ GList **last_child,
+ gint *n,
+ gint *remaining_space)
{
GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *widget;
- GtkContainer *container;
GList *children;
GtkNotebookPage *page;
- gint tab_pos, tab_overlap;
+ gint tab_overlap;
widget = GTK_WIDGET (notebook);
- container = GTK_CONTAINER (notebook);
gtk_widget_style_get (widget, "tab-overlap", &tab_overlap, NULL);
- tab_pos = get_effective_tab_pos (notebook);
if (show_arrows) /* first_tab <- focus_tab */
{
@@ -5471,7 +5458,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
priv->first_tab = priv->focus_tab;
else
priv->first_tab = gtk_notebook_search_page (notebook, priv->focus_tab,
- STEP_NEXT, TRUE);
+ STEP_NEXT, TRUE);
}
else
/* calculate shown tabs counting backwards from the focus tab */
@@ -5480,7 +5467,8 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
priv->focus_tab,
STEP_PREV,
TRUE),
- &(priv->first_tab), remaining_space,
+ &(priv->first_tab),
+ remaining_space,
STEP_PREV);
if (*remaining_space < 0)
@@ -5498,16 +5486,18 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
{
if (!priv->first_tab)
priv->first_tab = gtk_notebook_search_page (notebook,
- NULL,
- STEP_NEXT,
- TRUE);
+ NULL,
+ STEP_NEXT,
+ TRUE);
children = NULL;
gtk_notebook_calc_tabs (notebook,
gtk_notebook_search_page (notebook,
priv->focus_tab,
STEP_NEXT,
TRUE),
- &children, remaining_space, STEP_NEXT);
+ &children,
+ remaining_space,
+ STEP_NEXT);
if (*remaining_space <= 0)
*last_child = children;
@@ -5521,15 +5511,17 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
priv->first_tab,
STEP_PREV,
TRUE),
- &children, remaining_space, STEP_PREV);
+ &children,
+ remaining_space,
+ STEP_PREV);
if (*remaining_space == 0)
priv->first_tab = children;
else
priv->first_tab = gtk_notebook_search_page(notebook,
- children,
- STEP_NEXT,
- TRUE);
+ children,
+ STEP_NEXT,
+ TRUE);
}
}
@@ -5587,7 +5579,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
*remaining_space = max - min - tab_overlap - tab_space;
children = priv->children;
priv->first_tab = gtk_notebook_search_page (notebook, NULL,
- STEP_NEXT, TRUE);
+ STEP_NEXT, TRUE);
while (children)
{
page = children->data;
@@ -6372,13 +6364,11 @@ gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
GList *new_child)
{
GtkNotebookPrivate *priv = notebook->priv;
- GList *old_child;
GtkNotebookPage *page;
if (priv->focus_tab == new_child)
return;
- old_child = priv->focus_tab;
priv->focus_tab = new_child;
if (priv->scrollable)
diff --git a/gtk/gtkoffscreenwindow.c b/gtk/gtkoffscreenwindow.c
index 306c318..a787e6b 100644
--- a/gtk/gtkoffscreenwindow.c
+++ b/gtk/gtkoffscreenwindow.c
@@ -163,14 +163,11 @@ gtk_offscreen_window_realize (GtkWidget *widget)
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
- gint border_width;
bin = GTK_BIN (widget);
gtk_widget_set_realized (widget, TRUE);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
gtk_widget_get_allocation (widget, &allocation);
attributes.x = allocation.x;
diff --git a/gtk/gtkpapersize.c b/gtk/gtkpapersize.c
index 8fbcddb..23017ea 100644
--- a/gtk/gtkpapersize.c
+++ b/gtk/gtkpapersize.c
@@ -820,19 +820,21 @@ gtk_paper_size_get_default_right_margin (GtkPaperSize *size,
* @key_file.
*
* Returns: a new #GtkPaperSize object with the restored
- * paper size, or %NULL if an error occurred.
+ * paper size, or %NULL if an error occurred
*
* Since: 2.12
*/
GtkPaperSize *
-gtk_paper_size_new_from_key_file (GKeyFile *key_file,
- const gchar *group_name,
- GError **error)
+gtk_paper_size_new_from_key_file (GKeyFile *key_file,
+ const gchar *group_name,
+ GError **error)
{
GtkPaperSize *paper_size = NULL;
- char *name = NULL, *ppd_name = NULL, *display_name = NULL, *freeme = NULL;
+ gchar *name = NULL;
+ gchar *ppd_name = NULL;
+ gchar *display_name = NULL;
+ gchar *freeme = NULL;
gdouble width, height;
- gboolean retval = TRUE;
GError *err = NULL;
g_return_val_if_fail (key_file != NULL, NULL);
@@ -845,7 +847,6 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
- retval = FALSE;
goto out;
}
@@ -854,7 +855,6 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
if (err != NULL) \
{\
g_propagate_error (error, err);\
- retval = FALSE;\
goto out;\
}
@@ -887,9 +887,9 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
- retval = FALSE;
goto out;
}
+
g_assert (paper_size != NULL);
out:
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 88b89cb..24c038d 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -1468,24 +1468,23 @@ find_button_type (GtkPathBar *path_bar,
}
static void
-button_drag_data_get_cb (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time_,
- gpointer data)
+button_drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time_,
+ gpointer data)
{
ButtonData *button_data;
- GtkPathBar *path_bar;
char *uris[2];
button_data = data;
- path_bar = GTK_PATH_BAR (gtk_widget_get_parent (widget)); /* the button's parent *is* the path bar */
uris[0] = g_file_get_uri (button_data->file);
uris[1] = NULL;
gtk_selection_data_set_uris (selection_data, uris);
+
g_free (uris[0]);
}
@@ -1746,19 +1745,16 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
}
gboolean
-_gtk_path_bar_set_file (GtkPathBar *path_bar,
- GFile *file,
- const gboolean keep_trail,
- GError **error)
+_gtk_path_bar_set_file (GtkPathBar *path_bar,
+ GFile *file,
+ const gboolean keep_trail,
+ GError **error)
{
struct SetFileInfo *info;
- gboolean result;
g_return_val_if_fail (GTK_IS_PATH_BAR (path_bar), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
- result = TRUE;
-
/* Check whether the new path is already present in the pathbar as buttons.
* This could be a parent directory or a previous selected subdirectory.
*/
@@ -1777,10 +1773,10 @@ _gtk_path_bar_set_file (GtkPathBar *path_bar,
path_bar->get_info_cancellable =
_gtk_file_system_get_info (path_bar->file_system,
- info->file,
- "standard::display-name,standard::is-hidden,standard::is-backup",
- gtk_path_bar_get_info_callback,
- info);
+ info->file,
+ "standard::display-name,standard::is-hidden,standard::is-backup",
+ gtk_path_bar_get_info_callback,
+ info);
return TRUE;
}
diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c
index d37278c..26e5a56 100644
--- a/gtk/gtkprintcontext.c
+++ b/gtk/gtkprintcontext.c
@@ -213,21 +213,17 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
void
_gtk_print_context_translate_into_margin (GtkPrintContext *context)
{
- GtkPrintOperationPrivate *priv;
gdouble left, top;
g_return_if_fail (GTK_IS_PRINT_CONTEXT (context));
- priv = context->op->priv;
-
/* We do it this way to also handle GTK_UNIT_PIXELS */
-
left = gtk_page_setup_get_left_margin (context->page_setup, GTK_UNIT_INCH);
top = gtk_page_setup_get_top_margin (context->page_setup, GTK_UNIT_INCH);
cairo_translate (context->cr,
- left * context->surface_dpi_x / context->pixels_per_unit_x,
- top * context->surface_dpi_y / context->pixels_per_unit_y);
+ left * context->surface_dpi_x / context->pixels_per_unit_x,
+ top * context->surface_dpi_y / context->pixels_per_unit_y);
}
void
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 476f37b..59a77c5 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -894,7 +894,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
GtkToggleButton *toggle_button;
GtkStyleContext *context;
GtkStateFlags state = 0;
- GdkWindow *window;
gint x, y;
gint indicator_size, indicator_spacing;
gint focus_width;
@@ -915,8 +914,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
"focus-padding", &focus_pad,
NULL);
- window = gtk_widget_get_window (widget);
-
_gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
gtk_widget_get_allocation (widget, &allocation);
@@ -926,14 +923,15 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
child = gtk_bin_get_child (GTK_BIN (check_button));
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
- x += focus_width + focus_pad;
+ x += focus_width + focus_pad;
if (gtk_toggle_button_get_inconsistent (toggle_button))
state |= GTK_STATE_FLAG_INCONSISTENT;
else if (gtk_toggle_button_get_active (toggle_button))
state |= GTK_STATE_FLAG_ACTIVE;
- if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button))
+ if (button->priv->activate_timeout ||
+ (button->priv->button_down && button->priv->in_button))
state |= GTK_STATE_FLAG_SELECTED;
if (button->priv->in_button)
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index e5bbaa9..3981dcf 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1858,7 +1858,6 @@ draw_stepper (GtkRange *range,
GtkStateFlags state = 0;
GtkStyleContext *context;
GtkWidget *widget = GTK_WIDGET (range);
- GdkWindow *window;
gfloat arrow_scaling;
GdkRectangle *rect;
gint arrow_x;
@@ -1910,7 +1909,6 @@ draw_stepper (GtkRange *range,
state |= GTK_STATE_FLAG_PRELIGHT;
}
- window = gtk_widget_get_window (widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
@@ -1937,8 +1935,8 @@ draw_stepper (GtkRange *range,
gtk_range_get_props (GTK_RANGE (widget),
NULL, NULL, NULL, NULL, NULL, NULL,
- &arrow_displacement_x, &arrow_displacement_y);
-
+ &arrow_displacement_x, &arrow_displacement_y);
+
arrow_x += arrow_displacement_x;
arrow_y += arrow_displacement_y;
}
@@ -1969,14 +1967,13 @@ draw_stepper (GtkRange *range,
}
static gboolean
-gtk_range_draw (GtkWidget *widget,
- cairo_t *cr)
+gtk_range_draw (GtkWidget *widget,
+ cairo_t *cr)
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
gboolean sensitive;
GtkStateFlags state = 0;
- GdkWindow *window;
gint focus_line_width = 0;
gint focus_padding = 0;
gboolean touchscreen;
@@ -1998,8 +1995,6 @@ gtk_range_draw (GtkWidget *widget,
"focus-padding", &focus_padding,
NULL);
- window = gtk_widget_get_window (widget);
-
/* we're now exposing, so there's no need to force early repaints */
if (priv->repaint_id)
g_source_remove (priv->repaint_id);
@@ -2085,22 +2080,22 @@ gtk_range_draw (GtkWidget *widget,
y += offset;
height -= shorter;
}
- }
+ }
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
if (draw_trough)
{
- gint trough_change_pos_x = width;
- gint trough_change_pos_y = height;
+ gint trough_change_pos_x = width;
+ gint trough_change_pos_y = height;
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- trough_change_pos_x = (priv->slider.x +
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ trough_change_pos_x = (priv->slider.x +
priv->slider.width / 2 -
x);
- else
- trough_change_pos_y = (priv->slider.y +
+ else
+ trough_change_pos_y = (priv->slider.y +
priv->slider.height / 2 -
y);
@@ -2111,10 +2106,10 @@ gtk_range_draw (GtkWidget *widget,
trough_change_pos_x,
trough_change_pos_y);
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- trough_change_pos_y = 0;
- else
- trough_change_pos_x = 0;
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ trough_change_pos_y = 0;
+ else
+ trough_change_pos_x = 0;
gtk_render_background (context, cr,
x + trough_change_pos_x, y + trough_change_pos_y,
@@ -2137,13 +2132,12 @@ gtk_range_draw (GtkWidget *widget,
if (priv->show_fill_level &&
gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) != 0)
- {
+ {
gdouble fill_level = priv->fill_level;
- gint fill_x = x;
- gint fill_y = y;
- gint fill_width = width;
- gint fill_height = height;
- gchar *fill_detail;
+ gint fill_x = x;
+ gint fill_y = y;
+ gint fill_width = width;
+ gint fill_height = height;
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
@@ -2152,10 +2146,10 @@ gtk_range_draw (GtkWidget *widget,
gtk_adjustment_get_upper (priv->adjustment) -
gtk_adjustment_get_page_size (priv->adjustment));
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- fill_x = priv->trough.x;
- fill_width = (priv->slider.width +
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ fill_x = priv->trough.x;
+ fill_width = (priv->slider.width +
(fill_level - gtk_adjustment_get_lower (priv->adjustment)) /
(gtk_adjustment_get_upper (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) -
@@ -2165,11 +2159,11 @@ gtk_range_draw (GtkWidget *widget,
if (should_invert (range))
fill_x += priv->trough.width - fill_width;
- }
- else
- {
- fill_y = priv->trough.y;
- fill_height = (priv->slider.height +
+ }
+ else
+ {
+ fill_y = priv->trough.y;
+ fill_height = (priv->slider.height +
(fill_level - gtk_adjustment_get_lower (priv->adjustment)) /
(gtk_adjustment_get_upper (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) -
@@ -2179,19 +2173,21 @@ gtk_range_draw (GtkWidget *widget,
if (should_invert (range))
fill_y += priv->trough.height - fill_height;
- }
+ }
- if (fill_level < gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment))
- fill_detail = "trough-fill-level-full";
- else
- fill_detail = "trough-fill-level";
+#if 0
+ if (fill_level < gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment))
+ fill_detail = "trough-fill-level-full";
+ else
+ fill_detail = "trough-fill-level";
+#endif
gtk_render_activity (context, cr,
fill_x, fill_y,
fill_width, fill_height);
gtk_style_context_restore (context);
- }
+ }
gtk_style_context_restore (context);
@@ -2266,7 +2262,7 @@ gtk_range_draw (GtkWidget *widget,
priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
priv->grab_location == MOUSE_STEPPER_D,
!touchscreen && priv->mouse_location == MOUSE_STEPPER_D);
-
+
return FALSE;
}
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 4c4f70a..655e160 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -1189,59 +1189,58 @@ gtk_recent_manager_lookup_item (GtkRecentManager *manager,
* Return value: %TRUE on success.
*
* Since: 2.10
- */
+ */
gboolean
gtk_recent_manager_move_item (GtkRecentManager *recent_manager,
- const gchar *uri,
- const gchar *new_uri,
- GError **error)
+ const gchar *uri,
+ const gchar *new_uri,
+ GError **error)
{
GtkRecentManagerPrivate *priv;
GError *move_error;
- gboolean res;
-
+
g_return_val_if_fail (GTK_IS_RECENT_MANAGER (recent_manager), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
+
priv = recent_manager->priv;
if (!priv->recent_items)
{
g_set_error (error, GTK_RECENT_MANAGER_ERROR,
- GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
- _("Unable to find an item with URI '%s'"),
- uri);
+ GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+ _("Unable to find an item with URI '%s'"),
+ uri);
return FALSE;
}
if (!g_bookmark_file_has_item (priv->recent_items, uri))
{
g_set_error (error, GTK_RECENT_MANAGER_ERROR,
- GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
- _("Unable to find an item with URI '%s'"),
- uri);
+ GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+ _("Unable to find an item with URI '%s'"),
+ uri);
return FALSE;
}
-
+
move_error = NULL;
- res = g_bookmark_file_move_item (priv->recent_items,
- uri, new_uri,
- &move_error);
- if (move_error)
+ if (!g_bookmark_file_move_item (priv->recent_items,
+ uri,
+ new_uri,
+ &move_error))
{
g_error_free (move_error);
g_set_error (error, GTK_RECENT_MANAGER_ERROR,
- GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
- _("Unable to find an item with URI '%s'"),
- uri);
+ GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
+ _("Unable to find an item with URI '%s'"),
+ uri);
return FALSE;
}
-
+
priv->is_dirty = TRUE;
gtk_recent_manager_changed (recent_manager);
-
+
return TRUE;
}
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index a69ae84..f27bd65 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1036,7 +1036,6 @@ gtk_scale_draw (GtkWidget *widget,
GtkRange *range = GTK_RANGE (scale);
GtkStateFlags state = 0;
GtkStyleContext *context;
- gint n_marks;
gint *marks;
gint focus_padding;
gint slider_width;
@@ -1046,8 +1045,8 @@ gtk_scale_draw (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
gtk_widget_style_get (widget,
"focus-padding", &focus_padding,
- "slider-width", &slider_width,
- "value-spacing", &value_spacing,
+ "slider-width", &slider_width,
+ "value-spacing", &value_spacing,
NULL);
/* We need to chain up _first_ so the various geometry members of
@@ -1071,7 +1070,7 @@ gtk_scale_draw (GtkWidget *widget,
gint min_pos, max_pos;
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (range));
- n_marks = _gtk_range_get_stop_positions (range, &marks);
+ _gtk_range_get_stop_positions (range, &marks);
layout = gtk_widget_create_pango_layout (widget, NULL);
gtk_range_get_range_rect (range, &range_rect);
@@ -1189,7 +1188,7 @@ gtk_scale_draw (GtkWidget *widget,
gtk_style_context_restore (context);
}
- }
+ }
g_object_unref (layout);
g_free (marks);
@@ -1197,13 +1196,11 @@ gtk_scale_draw (GtkWidget *widget,
if (priv->draw_value)
{
- GtkOrientation orientation;
GtkAllocation allocation;
PangoLayout *layout;
gint x, y;
- orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (range));
layout = gtk_scale_get_layout (scale);
gtk_scale_get_layout_offsets (scale, &x, &y);
gtk_widget_get_allocation (widget, &allocation);
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index a688705..7a62baf 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -902,7 +902,6 @@ gtk_scale_popup (GtkWidget *widget,
gint x, y, m, dx, dy, sx, sy, startoff;
gint min_slider_size;
gdouble v;
- GdkDisplay *display;
GdkScreen *screen;
gboolean is_moved;
GdkDevice *device, *keyboard, *pointer;
@@ -912,7 +911,6 @@ gtk_scale_popup (GtkWidget *widget,
priv = button->priv;
adjustment = priv->adjustment;
- display = gtk_widget_get_display (widget);
screen = gtk_widget_get_screen (widget);
gtk_widget_get_allocation (widget, &allocation);
@@ -1145,9 +1143,8 @@ gtk_scale_button_key_release (GtkWidget *widget,
* either the dock, or the scale itself */
static void
gtk_scale_button_grab_notify (GtkScaleButton *button,
- gboolean was_grabbed)
+ gboolean was_grabbed)
{
- GdkDisplay *display;
GtkScaleButtonPrivate *priv;
GtkWidget *toplevel, *grab_widget;
GtkWindowGroup *group;
@@ -1171,7 +1168,6 @@ gtk_scale_button_grab_notify (GtkScaleButton *button,
gtk_widget_is_ancestor (grab_widget, priv->dock))
return;
- display = gtk_widget_get_display (priv->dock);
gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
gtk_device_grab_remove (priv->dock, priv->grab_pointer);
@@ -1299,22 +1295,18 @@ cb_dock_grab_broken_event (GtkWidget *widget,
return FALSE;
}
-/*
- * Scale callbacks.
- */
+/* Scale callbacks */
static void
gtk_scale_button_release_grab (GtkScaleButton *button,
- GdkEventButton *event)
+ GdkEventButton *event)
{
GdkEventButton *e;
- GdkDisplay *display;
GtkScaleButtonPrivate *priv;
priv = button->priv;
/* ungrab focus */
- display = gtk_widget_get_display (GTK_WIDGET (button));
gdk_device_ungrab (priv->grab_keyboard, event->time);
gdk_device_ungrab (priv->grab_pointer, event->time);
gtk_device_grab_remove (priv->dock, priv->grab_pointer);
@@ -1355,13 +1347,11 @@ gtk_scale_button_popdown (GtkWidget *widget)
{
GtkScaleButton *button;
GtkScaleButtonPrivate *priv;
- GdkDisplay *display;
button = GTK_SCALE_BUTTON (widget);
priv = button->priv;
/* ungrab focus */
- display = gtk_widget_get_display (widget);
gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
gtk_device_grab_remove (priv->dock, priv->grab_pointer);
@@ -1530,7 +1520,6 @@ static void
gtk_scale_button_update_icon (GtkScaleButton *button)
{
GtkScaleButtonPrivate *priv;
- GtkRange *range;
GtkAdjustment *adjustment;
gdouble value;
const gchar *name;
@@ -1541,8 +1530,8 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
if (!priv->icon_list || priv->icon_list[0] == '\0')
{
gtk_image_set_from_stock (GTK_IMAGE (priv->image),
- GTK_STOCK_MISSING_IMAGE,
- priv->size);
+ GTK_STOCK_MISSING_IMAGE,
+ priv->size);
return;
}
@@ -1552,12 +1541,11 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
if (num_icons == 1)
{
gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
- priv->icon_list[0],
- priv->size);
+ priv->icon_list[0],
+ priv->size);
return;
}
- range = GTK_RANGE (priv->scale);
adjustment = priv->adjustment;
value = gtk_scale_button_get_value (button);
@@ -1565,15 +1553,16 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
if (num_icons == 2)
{
gdouble limit;
+
limit = (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) / 2 + gtk_adjustment_get_lower (adjustment);
if (value < limit)
- name = priv->icon_list[0];
+ name = priv->icon_list[0];
else
- name = priv->icon_list[1];
+ name = priv->icon_list[1];
gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
- name,
- priv->size);
+ name,
+ priv->size);
return;
}
@@ -1598,8 +1587,8 @@ gtk_scale_button_update_icon (GtkScaleButton *button)
}
gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
- name,
- priv->size);
+ name,
+ priv->size);
}
static void
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index c8f4539..86fa7ab 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1956,7 +1956,7 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
static void
gtk_scrolled_window_add (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkScrolledWindowPrivate *priv;
GtkScrolledWindow *scrolled_window;
@@ -1974,8 +1974,8 @@ gtk_scrolled_window_add (GtkContainer *container,
_gtk_bin_set_child (bin, child);
gtk_widget_set_parent (child, GTK_WIDGET (bin));
- hadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->priv->hscrollbar));
- vadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->priv->vscrollbar));
+ hadj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
+ vadj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
if (GTK_IS_SCROLLABLE (child))
g_object_set (child, "hadjustment", hadj, "vadjustment", vadj, NULL);
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index b48535f..fda6953 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -210,15 +210,14 @@ gtk_separator_get_preferred_height (GtkWidget *widget,
}
static gboolean
-gtk_separator_draw (GtkWidget *widget,
- cairo_t *cr)
+gtk_separator_draw (GtkWidget *widget,
+ cairo_t *cr)
{
GtkSeparator *separator = GTK_SEPARATOR (widget);
GtkSeparatorPrivate *private = separator->priv;
GtkStateFlags state;
GtkStyleContext *context;
GtkBorder padding;
- GdkWindow *window;
gboolean wide_separators;
gint separator_width;
gint separator_height;
@@ -231,7 +230,6 @@ gtk_separator_draw (GtkWidget *widget,
"separator-height", &separator_height,
NULL);
- window = gtk_widget_get_window (widget);
state = gtk_widget_get_state_flags (widget);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
@@ -276,7 +274,7 @@ gtk_separator_draw (GtkWidget *widget,
* Return value: a new #GtkSeparator.
*
* Since: 3.0
- **/
+ */
GtkWidget *
gtk_separator_new (GtkOrientation orientation)
{
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 779eee0..f4a3427 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -202,11 +202,9 @@ static gboolean
gtk_spinner_draw (GtkWidget *widget,
cairo_t *cr)
{
- GtkSpinnerPrivate *priv;
GtkStyleContext *context;
GtkStateFlags state;
- priv = GTK_SPINNER (widget)->priv;
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index 334c9a4..6483f32 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -125,10 +125,8 @@ G_DEFINE_TYPE_WITH_CODE (GtkStatusbar, gtk_statusbar, GTK_TYPE_HBOX,
static void
gtk_statusbar_class_init (GtkStatusbarClass *class)
{
- GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
- gobject_class = (GObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
widget_class->realize = gtk_statusbar_realize;
@@ -139,12 +137,12 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
class->text_pushed = gtk_statusbar_update;
class->text_popped = gtk_statusbar_update;
- /**
+ /**
* GtkStatusbar::text-pushed:
- * @statusbar: the object which received the signal.
- * @context_id: the context id of the relevant message/statusbar.
- * @text: the message that was pushed.
- *
+ * @statusbar: the object which received the signal
+ * @context_id: the context id of the relevant message/statusbar
+ * @text: the message that was pushed
+ *
* Is emitted whenever a new message gets pushed onto a statusbar's stack.
*/
statusbar_signals[SIGNAL_TEXT_PUSHED] =
@@ -160,9 +158,9 @@ gtk_statusbar_class_init (GtkStatusbarClass *class)
/**
* GtkStatusbar::text-popped:
- * @statusbar: the object which received the signal.
- * @context_id: the context id of the relevant message/statusbar.
- * @text: the message that was just popped.
+ * @statusbar: the object which received the signal
+ * @context_id: the context id of the relevant message/statusbar
+ * @text: the message that was just popped
*
* Is emitted whenever a new message is popped off a statusbar's stack.
*/
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 896a98a..c61964f 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -941,11 +941,9 @@ gtk_style_context_impl_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GtkStyleContextPrivate *priv;
GtkStyleContext *style_context;
style_context = GTK_STYLE_CONTEXT (object);
- priv = style_context->priv;
switch (prop_id)
{
@@ -969,8 +967,8 @@ gtk_style_context_impl_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkStyleContextPrivate *priv;
GtkStyleContext *style_context;
+ GtkStyleContextPrivate *priv;
style_context = GTK_STYLE_CONTEXT (object);
priv = style_context->priv;
@@ -2970,7 +2968,7 @@ gtk_style_context_cancel_animations (GtkStyleContext *context,
{
GtkStyleContextPrivate *priv;
AnimationInfo *info;
- GSList *l, *node;
+ GSList *l;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -2980,7 +2978,6 @@ gtk_style_context_cancel_animations (GtkStyleContext *context,
while (l)
{
info = l->data;
- node = l;
l = l->next;
if (!region_id ||
diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c
index 23e2cfb..f7fa89c 100644
--- a/gtk/gtktearoffmenuitem.c
+++ b/gtk/gtktearoffmenuitem.c
@@ -21,7 +21,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -41,16 +41,16 @@ struct _GtkTearoffMenuItemPrivate
};
static void gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
+ gint *minimum,
+ gint *natural);
static void gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
+ gint *minimum,
+ gint *natural);
static gboolean gtk_tearoff_menu_item_draw (GtkWidget *widget,
- cairo_t *cr);
+ cairo_t *cr);
static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item);
static void gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
- GtkWidget *previous);
+ GtkWidget *previous);
G_DEFINE_TYPE (GtkTearoffMenuItem, gtk_tearoff_menu_item, GTK_TYPE_MENU_ITEM)
@@ -94,8 +94,8 @@ gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item)
static void
gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
+ gint *minimum,
+ gint *natural)
{
GtkStyleContext *context;
guint border_width;
@@ -113,8 +113,8 @@ gtk_tearoff_menu_item_get_preferred_width (GtkWidget *widget,
static void
gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
+ gint *minimum,
+ gint *natural)
{
GtkStyleContext *context;
GtkBorder padding;
@@ -156,12 +156,10 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
guint border_width;
GtkTextDirection direction;
GtkWidget *parent;
- GdkWindow *window;
gdouble angle;
menu_item = GTK_MENU_ITEM (widget);
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
direction = gtk_widget_get_direction (widget);
state = gtk_widget_get_state_flags (widget);
@@ -189,14 +187,16 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
if (menu_item->priv->toggle_size > ARROW_SIZE)
{
- if (direction == GTK_TEXT_DIR_LTR) {
- arrow_x = x + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
- angle = (3 * G_PI) / 2;
- }
- else {
- arrow_x = x + width - menu_item->priv->toggle_size + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
- angle = G_PI / 2;
- }
+ if (direction == GTK_TEXT_DIR_LTR)
+ {
+ arrow_x = x + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
+ angle = (3 * G_PI) / 2;
+ }
+ else
+ {
+ arrow_x = x + width - menu_item->priv->toggle_size + (menu_item->priv->toggle_size - ARROW_SIZE)/2;
+ angle = G_PI / 2;
+ }
x += menu_item->priv->toggle_size + BORDER_SPACING;
}
else
@@ -223,14 +223,16 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
{
gint x1, x2;
- if (direction == GTK_TEXT_DIR_LTR) {
- x1 = x;
- x2 = MIN (x + TEAR_LENGTH, right_max);
- }
- else {
- x1 = right_max - x;
- x2 = MAX (right_max - x - TEAR_LENGTH, 0);
- }
+ if (direction == GTK_TEXT_DIR_LTR)
+ {
+ x1 = x;
+ x2 = MIN (x + TEAR_LENGTH, right_max);
+ }
+ else
+ {
+ x1 = right_max - x;
+ x2 = MAX (right_max - x - TEAR_LENGTH, 0);
+ }
gtk_render_line (context, cr,
x1, y + (height - padding.bottom) / 2,
@@ -255,14 +257,14 @@ gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item)
gtk_widget_queue_resize (GTK_WIDGET (menu_item));
gtk_menu_set_tearoff_state (GTK_MENU (parent),
- !menu->priv->torn_off);
+ !menu->priv->torn_off);
}
}
static void
tearoff_state_changed (GtkMenu *menu,
- GParamSpec *pspec,
- gpointer data)
+ GParamSpec *pspec,
+ gpointer data)
{
GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (data);
GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
@@ -272,7 +274,7 @@ tearoff_state_changed (GtkMenu *menu,
static void
gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
- GtkWidget *previous)
+ GtkWidget *previous)
{
GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (widget);
GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
@@ -283,15 +285,15 @@ gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
menu = GTK_IS_MENU (parent) ? GTK_MENU (parent) : NULL;
if (previous)
- g_signal_handlers_disconnect_by_func (previous,
- tearoff_state_changed,
- tearoff_menu_item);
-
+ g_signal_handlers_disconnect_by_func (previous,
+ tearoff_state_changed,
+ tearoff_menu_item);
+
if (menu)
{
priv->torn_off = gtk_menu_get_tearoff_state (menu);
- g_signal_connect (menu, "notify::tearoff-state",
- G_CALLBACK (tearoff_state_changed),
- tearoff_menu_item);
- }
+ g_signal_connect (menu, "notify::tearoff-state",
+ G_CALLBACK (tearoff_state_changed),
+ tearoff_menu_item);
+ }
}
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index bb6efb9..1db600e 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1184,10 +1184,8 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
gint exterior_size, interior_size, pad, thickness, border_width;
GtkBorderStyle border_style;
GtkBorder *border;
- gdouble radius;
flags = gtk_theming_engine_get_state (engine);
- radius = MIN (width, height) / 2 - 0.5;
cairo_save (cr);
@@ -1215,10 +1213,10 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
cairo_new_sub_path (cr);
cairo_arc (cr,
- x + exterior_size / 2.,
- y + exterior_size / 2.,
- (exterior_size - 1) / 2.,
- 0, 2 * G_PI);
+ x + exterior_size / 2.,
+ y + exterior_size / 2.,
+ (exterior_size - 1) / 2.,
+ 0, 2 * G_PI);
gdk_cairo_set_source_rgba (cr, bg_color);
cairo_fill_preserve (cr);
@@ -1252,10 +1250,10 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
line_thickness = MAX (1, (3 + interior_size * 2) / 7);
cairo_rectangle (cr,
- x + pad,
- y + pad + (interior_size - line_thickness) / 2.,
- interior_size,
- line_thickness);
+ x + pad,
+ y + pad + (interior_size - line_thickness) / 2.,
+ interior_size,
+ line_thickness);
cairo_fill (cr);
}
if (flags & GTK_STATE_FLAG_ACTIVE)
@@ -1264,17 +1262,17 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
interior_size = MAX (1, exterior_size - 2 * pad);
if (interior_size < 5)
- {
- interior_size = 7;
- pad = MAX (0, (exterior_size - interior_size) / 2);
- }
+ {
+ interior_size = 7;
+ pad = MAX (0, (exterior_size - interior_size) / 2);
+ }
cairo_new_sub_path (cr);
cairo_arc (cr,
- x + pad + interior_size / 2.,
- y + pad + interior_size / 2.,
- interior_size / 2.,
- 0, 2 * G_PI);
+ x + pad + interior_size / 2.,
+ y + pad + interior_size / 2.,
+ interior_size / 2.,
+ 0, 2 * G_PI);
cairo_fill (cr);
}
@@ -2261,7 +2259,6 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
const PangoMatrix *matrix;
GdkRGBA *fg_color;
GtkStateFlags flags;
- GdkScreen *screen;
gdouble progress;
gboolean running;
@@ -2272,7 +2269,6 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
"color", &fg_color,
NULL);
- screen = gtk_theming_engine_get_screen (engine);
matrix = pango_context_get_matrix (pango_layout_get_context (layout));
running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
@@ -2309,7 +2305,6 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
if (matrix)
{
cairo_matrix_t cairo_matrix;
- PangoMatrix tmp_matrix;
PangoRectangle rect;
cairo_matrix_init (&cairo_matrix,
@@ -2321,7 +2316,6 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
pango_matrix_transform_rectangle (matrix, &rect);
pango_extents_to_pixels (&rect, NULL);
- tmp_matrix = *matrix;
cairo_matrix.x0 += x - rect.x;
cairo_matrix.y0 += y - rect.y;
@@ -2612,7 +2606,6 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_GRIP))
{
GtkJunctionSides sides;
- gint skip = -1;
cairo_save (cr);
@@ -2641,8 +2634,6 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
height = width;
else if (height < width)
width = height;
-
- skip = 2;
}
else if (sides == GTK_JUNCTION_CORNER_BOTTOMLEFT)
{
@@ -2654,8 +2645,6 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
}
else if (height < width)
width = height;
-
- skip = 1;
}
else if (sides == GTK_JUNCTION_RIGHT)
{
@@ -2675,8 +2664,6 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
x += (width - height);
width = height;
}
-
- skip = 3;
}
else if (sides == GTK_JUNCTION_CORNER_BOTTOMRIGHT)
{
@@ -2691,8 +2678,6 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
x += (width - height);
width = height;
}
-
- skip = 0;
}
else if (sides == GTK_JUNCTION_TOP)
{
@@ -2748,7 +2733,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, x, yi, x + width, yi);
cairo_stroke (cr);
- yi+= 2;
+ yi += 2;
}
}
else if (sides == GTK_JUNCTION_CORNER_TOPLEFT)
@@ -2886,11 +2871,11 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
else
{
for (yy = y; yy < y + height; yy += 3)
- for (xx = x; xx < x + width; xx += 6)
- {
- render_dot (cr, &lighter, &darker, xx, yy, 2);
- render_dot (cr, &lighter, &darker, xx + 3, yy + 1, 2);
- }
+ for (xx = x; xx < x + width; xx += 6)
+ {
+ render_dot (cr, &lighter, &darker, xx, yy, 2);
+ render_dot (cr, &lighter, &darker, xx + 3, yy + 1, 2);
+ }
}
cairo_restore (cr);
diff --git a/gtk/gtktimeline.c b/gtk/gtktimeline.c
index 4053da9..18d3f95 100644
--- a/gtk/gtktimeline.c
+++ b/gtk/gtktimeline.c
@@ -186,10 +186,8 @@ gtk_timeline_set_property (GObject *object,
GParamSpec *pspec)
{
GtkTimeline *timeline;
- GtkTimelinePriv *priv;
timeline = GTK_TIMELINE (object);
- priv = timeline->priv;
switch (prop_id)
{
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index e222e08..5421cf9 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -1487,7 +1487,6 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
GtkRequisition arrow_requisition;
gboolean overflowing;
gboolean size_changed;
- gdouble elapsed;
GtkAllocation item_area;
GtkShadowType shadow_type;
@@ -1497,14 +1496,14 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
gtk_widget_get_allocation (widget, &widget_allocation);
size_changed = FALSE;
- if (widget_allocation.x != allocation->x ||
- widget_allocation.y != allocation->y ||
- widget_allocation.width != allocation->width ||
+ if (widget_allocation.x != allocation->x ||
+ widget_allocation.y != allocation->y ||
+ widget_allocation.width != allocation->width ||
widget_allocation.height != allocation->height)
{
size_changed = TRUE;
}
-
+
if (size_changed)
gtk_toolbar_stop_sliding (toolbar);
@@ -1513,14 +1512,12 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (toolbar));
if (gtk_widget_get_realized (widget))
- {
- gdk_window_move_resize (priv->event_window,
- allocation->x + border_width,
- allocation->y + border_width,
- allocation->width - border_width * 2,
- allocation->height - border_width * 2);
- }
-
+ gdk_window_move_resize (priv->event_window,
+ allocation->x + border_width,
+ allocation->y + border_width,
+ allocation->width - border_width * 2,
+ allocation->height - border_width * 2);
+
border_width += get_internal_padding (toolbar);
gtk_widget_get_preferred_size (priv->arrow_button,
@@ -1533,163 +1530,163 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
available_size = size = allocation->width - 2 * border_width;
short_size = allocation->height - 2 * border_width;
arrow_size = arrow_requisition.width;
-
+
if (shadow_type != GTK_SHADOW_NONE)
- {
+ {
available_size -= padding.left + padding.right;
short_size -= padding.top + padding.bottom;
- }
+ }
}
else
{
available_size = size = allocation->height - 2 * border_width;
short_size = allocation->width - 2 * border_width;
arrow_size = arrow_requisition.height;
-
+
if (shadow_type != GTK_SHADOW_NONE)
- {
+ {
available_size -= padding.top + padding.bottom;
short_size -= padding.left + padding.right;
- }
+ }
}
-
+
n_items = g_list_length (priv->content);
allocations = g_new0 (GtkAllocation, n_items);
new_states = g_new0 (ItemState, n_items);
-
+
needed_size = 0;
need_arrow = FALSE;
for (list = priv->content; list != NULL; list = list->next)
{
ToolbarContent *content = list->data;
-
- if (toolbar_content_visible (content, toolbar))
- {
- needed_size += get_item_size (toolbar, content);
- /* Do we need an arrow?
- *
- * Assume we don't, and see if any non-separator item with a
- * proxy menu item is then going to overflow.
- */
- if (needed_size > available_size &&
- !need_arrow &&
- priv->show_arrow &&
- toolbar_content_has_proxy_menu_item (content) &&
- !toolbar_content_is_separator (content))
- {
- need_arrow = TRUE;
- }
- }
+ if (toolbar_content_visible (content, toolbar))
+ {
+ needed_size += get_item_size (toolbar, content);
+
+ /* Do we need an arrow?
+ *
+ * Assume we don't, and see if any non-separator item
+ * with a proxy menu item is then going to overflow.
+ */
+ if (needed_size > available_size &&
+ !need_arrow &&
+ priv->show_arrow &&
+ toolbar_content_has_proxy_menu_item (content) &&
+ !toolbar_content_is_separator (content))
+ {
+ need_arrow = TRUE;
+ }
+ }
}
-
+
if (need_arrow)
size = available_size - arrow_size;
else
size = available_size;
-
+
/* calculate widths and states of items */
overflowing = FALSE;
for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
{
ToolbarContent *content = list->data;
gint item_size;
-
+
if (!toolbar_content_visible (content, toolbar))
- {
- new_states[i] = HIDDEN;
- continue;
- }
-
+ {
+ new_states[i] = HIDDEN;
+ continue;
+ }
+
item_size = get_item_size (toolbar, content);
if (item_size <= size && !overflowing)
- {
- size -= item_size;
- allocations[i].width = item_size;
- new_states[i] = NORMAL;
- }
+ {
+ size -= item_size;
+ allocations[i].width = item_size;
+ new_states[i] = NORMAL;
+ }
else
- {
- overflowing = TRUE;
- new_states[i] = OVERFLOWN;
- allocations[i].width = item_size;
- }
+ {
+ overflowing = TRUE;
+ new_states[i] = OVERFLOWN;
+ allocations[i].width = item_size;
+ }
}
-
- /* calculate width of arrow */
+
+ /* calculate width of arrow */
if (need_arrow)
{
arrow_allocation.width = arrow_size;
arrow_allocation.height = MAX (short_size, 1);
}
-
+
/* expand expandable items */
-
- /* We don't expand when there is an overflow menu, because that leads to
- * weird jumps when items get moved to the overflow menu and the expanding
+
+ /* We don't expand when there is an overflow menu,
+ * because that leads to weird jumps when items get
+ * moved to the overflow menu and the expanding
* items suddenly get a lot of extra space
*/
if (!overflowing)
{
gint max_child_expand;
n_expand_items = 0;
-
+
for (i = 0, list = priv->content; list != NULL; list = list->next, ++i)
- {
- ToolbarContent *content = list->data;
-
- if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
- n_expand_items++;
- }
-
+ {
+ ToolbarContent *content = list->data;
+
+ if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
+ n_expand_items++;
+ }
+
max_child_expand = get_max_child_expand (toolbar);
for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
- {
- ToolbarContent *content = list->data;
-
- if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
- {
- gint extra = size / n_expand_items;
- if (size % n_expand_items != 0)
- extra++;
+ {
+ ToolbarContent *content = list->data;
+
+ if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
+ {
+ gint extra = size / n_expand_items;
+ if (size % n_expand_items != 0)
+ extra++;
if (extra > max_child_expand)
extra = max_child_expand;
- allocations[i].width += extra;
- size -= extra;
- n_expand_items--;
- }
- }
-
+ allocations[i].width += extra;
+ size -= extra;
+ n_expand_items--;
+ }
+ }
+
g_assert (n_expand_items == 0);
}
-
+
/* position items */
pos = border_width;
for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
{
- /* both NORMAL and OVERFLOWN items get a position. This ensures
- * that sliding will work for OVERFLOWN items too
+ /* Both NORMAL and OVERFLOWN items get a position.
+ * This ensures that sliding will work for OVERFLOWN items too.
*/
- if (new_states[i] == NORMAL ||
- new_states[i] == OVERFLOWN)
- {
- allocations[i].x = pos;
- allocations[i].y = border_width;
- allocations[i].height = short_size;
-
- pos += allocations[i].width;
- }
+ if (new_states[i] == NORMAL || new_states[i] == OVERFLOWN)
+ {
+ allocations[i].x = pos;
+ allocations[i].y = border_width;
+ allocations[i].height = short_size;
+
+ pos += allocations[i].width;
+ }
}
-
+
/* position arrow */
if (need_arrow)
{
arrow_allocation.x = available_size - border_width - arrow_allocation.width;
arrow_allocation.y = border_width;
}
-
+
item_area.x = border_width;
item_area.y = border_width;
item_area.width = available_size - (need_arrow? arrow_size : 0);
@@ -1699,47 +1696,47 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
for (i = 0; i < n_items; ++i)
- fixup_allocation_for_vertical (&(allocations[i]));
-
+ fixup_allocation_for_vertical (&(allocations[i]));
+
if (need_arrow)
- fixup_allocation_for_vertical (&arrow_allocation);
+ fixup_allocation_for_vertical (&arrow_allocation);
fixup_allocation_for_vertical (&item_area);
}
else if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
{
for (i = 0; i < n_items; ++i)
- fixup_allocation_for_rtl (available_size, &(allocations[i]));
-
+ fixup_allocation_for_rtl (available_size, &(allocations[i]));
+
if (need_arrow)
- fixup_allocation_for_rtl (available_size, &arrow_allocation);
+ fixup_allocation_for_rtl (available_size, &arrow_allocation);
fixup_allocation_for_rtl (available_size, &item_area);
}
-
+
/* translate the items by allocation->(x,y) */
for (i = 0; i < n_items; ++i)
{
allocations[i].x += allocation->x;
allocations[i].y += allocation->y;
-
+
if (shadow_type != GTK_SHADOW_NONE)
- {
+ {
allocations[i].x += padding.left;
allocations[i].y += padding.top;
- }
+ }
}
-
+
if (need_arrow)
{
arrow_allocation.x += allocation->x;
arrow_allocation.y += allocation->y;
-
+
if (shadow_type != GTK_SHADOW_NONE)
- {
+ {
arrow_allocation.x += padding.left;
arrow_allocation.y += padding.top;
- }
+ }
}
item_area.x += allocation->x;
@@ -1754,89 +1751,87 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
for (list = priv->content, i = 0; list != NULL; list = list->next, i++)
{
ToolbarContent *content = list->data;
-
+
if (toolbar_content_get_state (content) == NORMAL &&
- new_states[i] != NORMAL)
- {
- /* an item disappeared and we didn't change size, so begin sliding */
- if (!size_changed)
- gtk_toolbar_begin_sliding (toolbar);
- }
+ new_states[i] != NORMAL)
+ {
+ /* an item disappeared and we didn't change size, so begin sliding */
+ if (!size_changed)
+ gtk_toolbar_begin_sliding (toolbar);
+ }
}
-
+
/* finally allocate the items */
if (priv->is_sliding)
{
for (list = priv->content, i = 0; list != NULL; list = list->next, i++)
- {
- ToolbarContent *content = list->data;
-
- toolbar_content_set_goal_allocation (content, &(allocations[i]));
- }
+ {
+ ToolbarContent *content = list->data;
+
+ toolbar_content_set_goal_allocation (content, &(allocations[i]));
+ }
}
- elapsed = g_timer_elapsed (priv->timer, NULL);
for (list = priv->content, i = 0; list != NULL; list = list->next, ++i)
{
ToolbarContent *content = list->data;
- if (new_states[i] == OVERFLOWN ||
- new_states[i] == NORMAL)
- {
- GtkAllocation alloc;
- GtkAllocation start_allocation = { 0, };
- GtkAllocation goal_allocation;
-
- if (priv->is_sliding)
- {
- toolbar_content_get_start_allocation (content, &start_allocation);
- toolbar_content_get_goal_allocation (content, &goal_allocation);
-
- compute_intermediate_allocation (toolbar,
- &start_allocation,
- &goal_allocation,
- &alloc);
-
- priv->need_sync = TRUE;
- }
- else
- {
- alloc = allocations[i];
- }
-
- if (alloc.width <= 0 || alloc.height <= 0)
- {
- toolbar_content_set_child_visible (content, toolbar, FALSE);
- }
- else
- {
- if (!rect_within (&alloc, &item_area))
- {
- toolbar_content_set_child_visible (content, toolbar, FALSE);
- toolbar_content_size_allocate (content, &alloc);
- }
- else
- {
- toolbar_content_set_child_visible (content, toolbar, TRUE);
- toolbar_content_size_allocate (content, &alloc);
- }
- }
- }
+ if (new_states[i] == OVERFLOWN || new_states[i] == NORMAL)
+ {
+ GtkAllocation alloc;
+ GtkAllocation start_allocation = { 0, };
+ GtkAllocation goal_allocation;
+
+ if (priv->is_sliding)
+ {
+ toolbar_content_get_start_allocation (content, &start_allocation);
+ toolbar_content_get_goal_allocation (content, &goal_allocation);
+
+ compute_intermediate_allocation (toolbar,
+ &start_allocation,
+ &goal_allocation,
+ &alloc);
+
+ priv->need_sync = TRUE;
+ }
+ else
+ {
+ alloc = allocations[i];
+ }
+
+ if (alloc.width <= 0 || alloc.height <= 0)
+ {
+ toolbar_content_set_child_visible (content, toolbar, FALSE);
+ }
+ else
+ {
+ if (!rect_within (&alloc, &item_area))
+ {
+ toolbar_content_set_child_visible (content, toolbar, FALSE);
+ toolbar_content_size_allocate (content, &alloc);
+ }
+ else
+ {
+ toolbar_content_set_child_visible (content, toolbar, TRUE);
+ toolbar_content_size_allocate (content, &alloc);
+ }
+ }
+ }
else
- {
- toolbar_content_set_child_visible (content, toolbar, FALSE);
- }
-
+ {
+ toolbar_content_set_child_visible (content, toolbar, FALSE);
+ }
+
toolbar_content_set_state (content, new_states[i]);
}
-
+
if (priv->menu && priv->need_rebuild)
rebuild_menu (toolbar);
-
+
if (need_arrow)
{
gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button),
- &arrow_allocation);
+ &arrow_allocation);
gtk_widget_show (GTK_WIDGET (priv->arrow_button));
}
else
@@ -1844,7 +1839,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
gtk_widget_hide (GTK_WIDGET (priv->arrow_button));
if (priv->menu && gtk_widget_get_visible (GTK_WIDGET (priv->menu)))
- gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
}
g_free (allocations);
@@ -3673,18 +3668,16 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget,
GtkOrientation orientation;
GtkStyleContext *context;
GtkStateFlags state;
- GdkWindow *window;
GtkBorder padding;
- int width, height;
- const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
- const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
+ gint width, height;
+ const gdouble start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
+ const gdouble end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
g_return_if_fail (GTK_IS_WIDGET (widget));
- orientation = toolbar? priv->orientation : GTK_ORIENTATION_HORIZONTAL;
+ orientation = toolbar ? priv->orientation : GTK_ORIENTATION_HORIZONTAL;
context = gtk_widget_get_style_context (widget);
- window = gtk_widget_get_window (widget);
state = gtk_widget_get_state_flags (widget);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index e10e351..70833e6 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -642,14 +642,12 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget,
GtkAllocation item_area;
GtkOrientation orientation;
- GtkToolbarStyle style;
gint min_rows;
guint border_width;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
- style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
/* figure out the size of homogeneous items */
gtk_tool_item_group_get_item_size (group, &item_size, TRUE, &min_rows);
@@ -665,7 +663,9 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget,
item_area.width = 0;
item_area.height = 0;
- /* figure out the required columns (n_columns) and rows (n_rows) to place all items */
+ /* figure out the required columns (n_columns) and rows (n_rows)
+ * to place all items
+ */
if (!priv->collapsed || !priv->animation || priv->animation_timeout)
{
guint n_columns;
@@ -740,7 +740,9 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget,
row_min_width = g_new0 (guint, n_rows);
- /* calculate minimal and maximal required cols and minimal required rows */
+ /* calculate minimal and maximal required cols and minimal
+ * required rows
+ */
for (it = priv->children; it != NULL; it = it->next)
{
GtkToolItemGroupChild *child = it->data;
@@ -791,7 +793,9 @@ gtk_tool_item_group_real_size_query (GtkWidget *widget,
min_col = MAX (min_col, row_min_width[i]);
}
- /* simple linear search for minimal required columns for the given maximal number of rows (n_rows) */
+ /* simple linear search for minimal required columns
+ * for the given maximal number of rows (n_rows)
+ */
for (n_columns = min_col; n_columns < max_col; n_columns ++)
{
new_row = TRUE;
@@ -885,7 +889,6 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
GtkAllocation item_area;
GtkOrientation orientation;
- GtkToolbarStyle style;
GList *it;
@@ -899,7 +902,6 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
direction = gtk_widget_get_direction (widget);
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
- style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
/* chain up */
GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation);
@@ -2245,13 +2247,11 @@ gtk_tool_item_group_get_drop_item (GtkToolItemGroup *group,
gint y)
{
GtkAllocation allocation;
- GtkOrientation orientation;
GList *it;
g_return_val_if_fail (GTK_IS_TOOL_ITEM_GROUP (group), NULL);
gtk_widget_get_allocation (GTK_WIDGET (group), &allocation);
- orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
g_return_val_if_fail (x >= 0 && x < allocation.width, NULL);
g_return_val_if_fail (y >= 0 && y < allocation.height, NULL);
@@ -2288,15 +2288,10 @@ _gtk_tool_item_group_item_size_request (GtkToolItemGroup *group,
GList *it;
gint rows = 0;
gboolean new_row = TRUE;
- GtkOrientation orientation;
- GtkToolbarStyle style;
g_return_if_fail (GTK_IS_TOOL_ITEM_GROUP (group));
g_return_if_fail (NULL != item_size);
- orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
- style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
-
item_size->width = item_size->height = 0;
for (it = group->priv->children; it != NULL; it = it->next)
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index f44fb2d..6e7fad8 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -1160,18 +1160,17 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
GdkWindow *window;
GtkWidget *tooltip_widget;
- GtkWidget *pointer_widget;
GtkTooltip *tooltip;
gboolean has_tooltip;
gboolean return_value = FALSE;
tooltip = g_object_get_data (G_OBJECT (display),
- "gdk-display-current-tooltip");
+ "gdk-display-current-tooltip");
if (tooltip->keyboard_mode_enabled)
{
x = y = -1;
- pointer_widget = tooltip_widget = tooltip->keyboard_widget;
+ tooltip_widget = tooltip->keyboard_widget;
}
else
{
@@ -1180,7 +1179,7 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
window = tooltip->last_window;
if (!GDK_IS_WINDOW (window))
- return;
+ return;
gdk_window_get_pointer (window, &x, &y, NULL);
@@ -1188,9 +1187,7 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
tooltip->last_x = tx;
tooltip->last_y = ty;
- pointer_widget = tooltip_widget = _gtk_widget_find_at_coords (window,
- x, y,
- &x, &y);
+ tooltip_widget = _gtk_widget_find_at_coords (window, x, y, &x, &y);
}
if (!tooltip_widget)
@@ -1205,9 +1202,9 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
if (!tooltip->current_window)
{
if (gtk_widget_get_tooltip_window (tooltip_widget))
- tooltip->current_window = gtk_widget_get_tooltip_window (tooltip_widget);
+ tooltip->current_window = gtk_widget_get_tooltip_window (tooltip_widget);
else
- tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window);
+ tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window);
}
screen = gtk_widget_get_screen (tooltip_widget);
@@ -1216,13 +1213,13 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
if (screen != gtk_widget_get_screen (tooltip->window))
{
g_signal_handlers_disconnect_by_func (display,
- gtk_tooltip_display_closed,
- tooltip);
+ gtk_tooltip_display_closed,
+ tooltip);
gtk_window_set_screen (GTK_WINDOW (tooltip->window), screen);
g_signal_connect (display, "closed",
- G_CALLBACK (gtk_tooltip_display_closed), tooltip);
+ G_CALLBACK (gtk_tooltip_display_closed), tooltip);
}
gtk_tooltip_position (tooltip, display, tooltip_widget);
diff --git a/gtk/gtktreemodelfilter.c b/gtk/gtktreemodelfilter.c
index 37886ba..9ec03f2 100644
--- a/gtk/gtktreemodelfilter.c
+++ b/gtk/gtktreemodelfilter.c
@@ -1298,8 +1298,8 @@ gtk_tree_model_filter_row_changed (GtkTreeModel *c_model,
gtk_tree_model_get_iter (c_model, &real_c_iter, c_path);
/* is this node above the virtual root? */
- if (filter->priv->virtual_root
- && (gtk_tree_path_get_depth (filter->priv->virtual_root)
+ if (filter->priv->virtual_root &&
+ (gtk_tree_path_get_depth (filter->priv->virtual_root)
>= gtk_tree_path_get_depth (c_path)))
goto done;
@@ -1367,8 +1367,6 @@ gtk_tree_model_filter_row_changed (GtkTreeModel *c_model,
/* make sure the new item has been pulled in */
if (!filter->priv->root)
{
- FilterLevel *root;
-
gtk_tree_model_filter_build_level (filter, NULL, -1, TRUE);
/* We will only proceed below if the item is found. If the item
@@ -1376,8 +1374,6 @@ gtk_tree_model_filter_row_changed (GtkTreeModel *c_model,
* for it.
*/
signals_emitted = TRUE;
-
- root = FILTER_LEVEL (filter->priv->root);
}
gtk_tree_model_filter_increment_stamp (filter);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 0183c83..9490419 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2429,7 +2429,6 @@ gtk_tree_view_size_request (GtkWidget *widget,
gboolean may_validate)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
- GList *tmp_list;
if (may_validate)
{
@@ -2444,8 +2443,6 @@ gtk_tree_view_size_request (GtkWidget *widget,
requisition->width = tree_view->priv->width;
requisition->height = tree_view->priv->height + gtk_tree_view_get_effective_header_height (tree_view);
-
- tmp_list = tree_view->priv->children;
}
static void
@@ -15542,7 +15539,6 @@ gtk_tree_view_start_editing (GtkTreeView *tree_view,
GtkTreeIter iter;
GdkRectangle cell_area;
GtkTreeViewColumn *focus_column;
- gchar *path_string;
guint flags = 0; /* can be 0, as the flags are primarily for rendering */
gint retval = FALSE;
GtkRBTree *cursor_tree;
@@ -15558,20 +15554,19 @@ gtk_tree_view_start_editing (GtkTreeView *tree_view,
cursor_node == NULL)
return FALSE;
- path_string = gtk_tree_path_to_string (cursor_path);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, cursor_path);
validate_row (tree_view, cursor_tree, cursor_node, &iter, cursor_path);
gtk_tree_view_column_cell_set_cell_data (focus_column,
- tree_view->priv->model,
- &iter,
- GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
- cursor_node->children?TRUE:FALSE);
+ tree_view->priv->model,
+ &iter,
+ GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
+ cursor_node->children ? TRUE : FALSE);
gtk_tree_view_get_cell_area (tree_view,
- cursor_path,
- focus_column,
- &cell_area);
+ cursor_path,
+ focus_column,
+ &cell_area);
if (gtk_cell_area_activate (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (focus_column)),
_gtk_tree_view_column_get_context (focus_column),
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 7558b76..11338a2 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7844,19 +7844,21 @@ gtk_widget_has_rc_style (GtkWidget *widget)
/**
* gtk_widget_set_style:
* @widget: a #GtkWidget
- * @style: (allow-none): a #GtkStyle, or %NULL to remove the effect of a previous
- * gtk_widget_set_style() and go back to the default style
+ * @style: (allow-none): a #GtkStyle, or %NULL to remove the effect
+ * of a previous call to gtk_widget_set_style() and go back to
+ * the default style
*
- * Sets the #GtkStyle for a widget (@widget->style). You probably don't
- * want to use this function; it interacts badly with themes, because
- * themes work by replacing the #GtkStyle. Instead, use
- * gtk_widget_modify_style().
+ * Sets the #GtkStyle for a widget (@widget->style).
+ *
+ * You probably don't want to use this function; it interacts
+ * badly with themes, because themes work by replacing the #GtkStyle.
+ * Instead, use gtk_widget_modify_style().
*
* Deprecated:3.0: Use #GtkStyleContext instead
- **/
+ */
void
gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style)
+ GtkStyle *style)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
}
@@ -7865,13 +7867,14 @@ gtk_widget_set_style (GtkWidget *widget,
* gtk_widget_ensure_style:
* @widget: a #GtkWidget
*
- * Ensures that @widget has a style (@widget->style). Not a very useful
- * function; most of the time, if you want the style, the widget is
- * realized, and realized widgets are guaranteed to have a style
- * already.
+ * Ensures that @widget has a style (@widget->style).
+ *
+ * Not a very useful function; most of the time, if you
+ * want the style, the widget is realized, and realized
+ * widgets are guaranteed to have a style already.
*
* Deprecated:3.0: Use #GtkStyleContext instead
- **/
+ */
void
gtk_widget_ensure_style (GtkWidget *widget)
{
@@ -7908,7 +7911,7 @@ gtk_widget_ensure_style (GtkWidget *widget)
* Return value: (transfer none): the widget's #GtkStyle
*
* Deprecated:3.0: Use #GtkStyleContext instead
- **/
+ */
GtkStyle*
gtk_widget_get_style (GtkWidget *widget)
{
@@ -7922,13 +7925,14 @@ gtk_widget_get_style (GtkWidget *widget)
* @widget: a #GtkWidget
* @style: the #GtkRcStyle holding the style modifications
*
- * Modifies style values on the widget. Modifications made using this
- * technique take precedence over style values set via an RC file,
- * however, they will be overriden if a style is explicitely set on
- * the widget using gtk_widget_set_style(). The #GtkRcStyle structure
- * is designed so each field can either be set or unset, so it is
- * possible, using this function, to modify some style values and
- * leave the others unchanged.
+ * Modifies style values on the widget.
+ *
+ * Modifications made using this technique take precedence over
+ * style values set via an RC file, however, they will be overridden
+ * if a style is explicitely set on the widget using gtk_widget_set_style().
+ * The #GtkRcStyle structure is designed so each field can either be
+ * set or unset, so it is possible, using this function, to modify some
+ * style values and leave the others unchanged.
*
* Note that modifications made with this function are not cumulative
* with previous calls to gtk_widget_modify_style() or with such
@@ -7941,18 +7945,18 @@ gtk_widget_get_style (GtkWidget *widget)
* effect with the initial modifications.
*
* Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- **/
+ */
void
gtk_widget_modify_style (GtkWidget *widget,
- GtkRcStyle *style)
+ GtkRcStyle *style)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_IS_RC_STYLE (style));
g_object_set_qdata_full (G_OBJECT (widget),
- quark_rc_style,
- gtk_rc_style_copy (style),
- (GDestroyNotify) g_object_unref);
+ quark_rc_style,
+ gtk_rc_style_copy (style),
+ (GDestroyNotify) g_object_unref);
}
/**
@@ -7978,7 +7982,7 @@ gtk_widget_modify_style (GtkWidget *widget,
* g_object_ref().
*
* Deprecated:3.0: Use #GtkStyleContext with a custom #GtkStyleProvider instead
- **/
+ */
GtkRcStyle *
gtk_widget_get_modifier_style (GtkWidget *widget)
{
@@ -7992,9 +7996,9 @@ gtk_widget_get_modifier_style (GtkWidget *widget)
{
rc_style = gtk_rc_style_new ();
g_object_set_qdata_full (G_OBJECT (widget),
- quark_rc_style,
- rc_style,
- (GDestroyNotify) g_object_unref);
+ quark_rc_style,
+ rc_style,
+ (GDestroyNotify) g_object_unref);
}
return rc_style;
@@ -8002,31 +8006,31 @@ gtk_widget_get_modifier_style (GtkWidget *widget)
static void
gtk_widget_modify_color_component (GtkWidget *widget,
- GtkRcFlags component,
- GtkStateType state,
- const GdkColor *color)
+ GtkRcFlags component,
+ GtkStateType state,
+ const GdkColor *color)
{
GtkRcStyle *rc_style = gtk_widget_get_modifier_style (widget);
if (color)
{
switch (component)
- {
- case GTK_RC_FG:
- rc_style->fg[state] = *color;
- break;
- case GTK_RC_BG:
- rc_style->bg[state] = *color;
- break;
- case GTK_RC_TEXT:
- rc_style->text[state] = *color;
- break;
- case GTK_RC_BASE:
- rc_style->base[state] = *color;
- break;
- default:
- g_assert_not_reached();
- }
+ {
+ case GTK_RC_FG:
+ rc_style->fg[state] = *color;
+ break;
+ case GTK_RC_BG:
+ rc_style->bg[state] = *color;
+ break;
+ case GTK_RC_TEXT:
+ rc_style->text[state] = *color;
+ break;
+ case GTK_RC_BASE:
+ rc_style->base[state] = *color;
+ break;
+ default:
+ g_assert_not_reached();
+ }
rc_style->color_flags[state] |= component;
}
@@ -8081,39 +8085,35 @@ _gtk_widget_get_modifier_properties (GtkWidget *widget)
* @widget: a #GtkWidget
* @state: the state for which to set the color
* @color: the color to assign, or %NULL to undo the effect
- * of previous calls to gtk_widget_override_color()
+ * of previous calls to gtk_widget_override_color()
*
- * Sets the color to use for a widget. All other style values are left
- * untouched.
+ * Sets the color to use for a widget.
*
- * <note>
- * <para>
- * This API is mostly meant as a quick way for applications to change a
- * widget appearance. If you are developing a widgets library and intend
- * this change to be themeable, it is better done by setting meaningful
- * CSS classes and regions in your widget/container implementation through
- * gtk_style_context_add_class() and gtk_style_context_add_region().
- * </para>
- * <para>
- * This way, your widget library can install a #GtkCssProvider with the
- * %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a
- * default styling for those widgets that need so, and this theming may
- * fully overridden by the user's theme.
- * </para>
- * </note>
+ * All other style values are left untouched.
*
- * <note>
- * <para>
- * Note that for complex widgets this may bring in
- * undesired results (such as uniform background color everywhere),
- * in these cases it is better to fully style such widgets through a
+ * <note><para>
+ * This API is mostly meant as a quick way for applications to
+ * change a widget appearance. If you are developing a widgets
+ * library and intend this change to be themeable, it is better
+ * done by setting meaningful CSS classes and regions in your
+ * widget/container implementation through gtk_style_context_add_class()
+ * and gtk_style_context_add_region().
+ * </para><para>
+ * This way, your widget library can install a #GtkCssProvider
+ * with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order
+ * to provide a default styling for those widgets that need so, and
+ * this theming may fully overridden by the user's theme.
+ * </para></note>
+ * <note><para>
+ * Note that for complex widgets this may bring in undesired
+ * results (such as uniform background color everywhere), in
+ * these cases it is better to fully style such widgets through a
* #GtkCssProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
* priority.
- * </para>
- * </note>
+ * </para></note>
*
* Since: 3.0
- **/
+ */
void
gtk_widget_override_color (GtkWidget *widget,
GtkStateFlags state,
@@ -8132,13 +8132,15 @@ gtk_widget_override_color (GtkWidget *widget,
* @widget: a #GtkWidget
* @state: the state for which to set the background color
* @color: the color to assign, or %NULL to undo the effect
- * of previous calls to gtk_widget_override_background_color()
+ * of previous calls to gtk_widget_override_background_color()
+ *
+ * Sets the background color to use for a widget.
*
- * Sets the background color to use for a widget. All other style values
- * are left untouched. See gtk_widget_override_color().
+ * All other style values are left untouched.
+ * See gtk_widget_override_color().
*
* Since: 3.0
- **/
+ */
void
gtk_widget_override_background_color (GtkWidget *widget,
GtkStateFlags state,
@@ -8156,14 +8158,13 @@ gtk_widget_override_background_color (GtkWidget *widget,
* gtk_widget_override_font:
* @widget: a #GtkWidget
* @font_desc: the font descriptiong to use, or %NULL to undo
- * the effect of previous calls to
- * gtk_widget_override_font().
+ * the effect of previous calls to gtk_widget_override_font()
*
* Sets the font to use for a widget. All other style values are
* left untouched. See gtk_widget_override_color().
*
* Since: 3.0
- **/
+ */
void
gtk_widget_override_font (GtkWidget *widget,
const PangoFontDescription *font_desc)
@@ -8180,16 +8181,18 @@ gtk_widget_override_font (GtkWidget *widget,
* gtk_widget_override_symbolic_color:
* @widget: a #GtkWidget
* @name: the name of the symbolic color to modify
- * @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * gtk_widget_override_symbolic_color().
+ * @color: (allow-none): the color to assign (does not need
+ * to be allocated), or %NULL to undo the effect of previous
+ * calls to gtk_widget_override_symbolic_color()
*
- * Sets a symbolic color for a widget, All other style values are left
- * untouched. See gtk_widget_override_color() for overriding the foreground
+ * Sets a symbolic color for a widget.
+ *
+ * All other style values are left untouched.
+ * See gtk_widget_override_color() for overriding the foreground
* or background color.
*
* Since: 3.0
- **/
+ */
void
gtk_widget_override_symbolic_color (GtkWidget *widget,
const gchar *name,
@@ -8247,19 +8250,20 @@ gtk_widget_override_cursor (GtkWidget *widget,
* @widget: a #GtkWidget
* @state: the state for which to set the foreground color
* @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_fg().
+ * or %NULL to undo the effect of previous calls to
+ * of gtk_widget_modify_fg().
*
* Sets the foreground color for a widget in a particular state.
- * All other style values are left untouched. See also
- * gtk_widget_modify_style().
+ *
+ * All other style values are left untouched.
+ * See also gtk_widget_modify_style().
*
* Deprecated:3.0: Use gtk_widget_override_color() instead
- **/
+ */
void
gtk_widget_modify_fg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
+ GtkStateType state,
+ const GdkColor *color)
{
GtkStateFlags flags;
GdkRGBA rgba;
@@ -8293,38 +8297,43 @@ gtk_widget_modify_fg (GtkWidget *widget,
rgba.blue = color->blue / 65535.;
rgba.alpha = 1;
- gtk_widget_override_color (widget, state, &rgba);
+ gtk_widget_override_color (widget, flags, &rgba);
}
else
- gtk_widget_override_color (widget, state, NULL);
+ gtk_widget_override_color (widget, flags, NULL);
}
/**
* gtk_widget_modify_bg:
* @widget: a #GtkWidget
* @state: the state for which to set the background color
- * @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_bg().
+ * @color: (allow-none): the color to assign (does not need
+ * to be allocated), or %NULL to undo the effect of previous
+ * calls to of gtk_widget_modify_bg().
*
* Sets the background color for a widget in a particular state.
- * All other style values are left untouched. See also
- * gtk_widget_modify_style().
*
- * Note that "no window" widgets (which have the %GTK_NO_WINDOW flag set)
- * draw on their parent container's window and thus may not draw any
- * background themselves. This is the case for e.g. #GtkLabel. To modify
- * the background of such widgets, you have to set the background color
- * on their parent; if you want to set the background of a rectangular
- * area around a label, try placing the label in a #GtkEventBox widget
- * and setting the background color on that.
+ * All other style values are left untouched.
+ * See also gtk_widget_modify_style().
+ *
+ * <note><para>
+ * Note that "no window" widgets (which have the %GTK_NO_WINDOW
+ * flag set) draw on their parent container's window and thus may
+ * not draw any background themselves. This is the case for e.g.
+ * #GtkLabel.
+ * </para><para>
+ * To modify the background of such widgets, you have to set the
+ * background color on their parent; if you want to set the background
+ * of a rectangular area around a label, try placing the label in
+ * a #GtkEventBox widget and setting the background color on that.
+ * </para></note>
*
* Deprecated:3.0: Use gtk_widget_override_background_color() instead
- **/
+ */
void
gtk_widget_modify_bg (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
+ GtkStateType state,
+ const GdkColor *color)
{
GtkStateFlags flags;
GdkRGBA rgba;
@@ -8358,32 +8367,34 @@ gtk_widget_modify_bg (GtkWidget *widget,
rgba.blue = color->blue / 65535.;
rgba.alpha = 1;
- gtk_widget_override_background_color (widget, state, &rgba);
+ gtk_widget_override_background_color (widget, flags, &rgba);
}
else
- gtk_widget_override_background_color (widget, state, NULL);
+ gtk_widget_override_background_color (widget, flags, NULL);
}
/**
* gtk_widget_modify_text:
* @widget: a #GtkWidget
* @state: the state for which to set the text color
- * @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_text().
+ * @color: (allow-none): the color to assign (does not need to
+ * be allocated), or %NULL to undo the effect of previous
+ * calls to of gtk_widget_modify_text().
*
- * Sets the text color for a widget in a particular state. All other
- * style values are left untouched. The text color is the foreground
- * color used along with the base color (see gtk_widget_modify_base())
- * for widgets such as #GtkEntry and #GtkTextView. See also
- * gtk_widget_modify_style().
+ * Sets the text color for a widget in a particular state.
+ *
+ * All other style values are left untouched.
+ * The text color is the foreground color used along with the
+ * base color (see gtk_widget_modify_base()) for widgets such
+ * as #GtkEntry and #GtkTextView.
+ * See also gtk_widget_modify_style().
*
* Deprecated:3.0: Use gtk_widget_override_color() instead
- **/
+ */
void
gtk_widget_modify_text (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
+ GtkStateType state,
+ const GdkColor *color)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
@@ -8395,9 +8406,9 @@ gtk_widget_modify_text (GtkWidget *widget,
* gtk_widget_modify_base:
* @widget: a #GtkWidget
* @state: the state for which to set the base color
- * @color: (allow-none): the color to assign (does not need to be allocated),
- * or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_base().
+ * @color: (allow-none): the color to assign (does not need to
+ * be allocated), or %NULL to undo the effect of previous
+ * calls to of gtk_widget_modify_base().
*
* Sets the base color for a widget in a particular state.
* All other style values are left untouched. The base color
@@ -8405,20 +8416,24 @@ gtk_widget_modify_text (GtkWidget *widget,
* (see gtk_widget_modify_text()) for widgets such as #GtkEntry
* and #GtkTextView. See also gtk_widget_modify_style().
*
- * Note that "no window" widgets (which have the %GTK_NO_WINDOW flag set)
- * draw on their parent container's window and thus may not draw any
- * background themselves. This is the case for e.g. #GtkLabel. To modify
- * the background of such widgets, you have to set the base color on their
- * parent; if you want to set the background of a rectangular area around
- * a label, try placing the label in a #GtkEventBox widget and setting
- * the base color on that.
+ * <note><para>
+ * Note that "no window" widgets (which have the %GTK_NO_WINDOW
+ * flag set) draw on their parent container's window and thus may
+ * not draw any background themselves. This is the case for e.g.
+ * #GtkLabel.
+ * </para><para>
+ * To modify the background of such widgets, you have to set the
+ * base color on their parent; if you want to set the background
+ * of a rectangular area around a label, try placing the label in
+ * a #GtkEventBox widget and setting the base color on that.
+ * </para></note>
*
* Deprecated:3.0: Use gtk_widget_override_background_color() instead
- **/
+ */
void
gtk_widget_modify_base (GtkWidget *widget,
- GtkStateType state,
- const GdkColor *color)
+ GtkStateType state,
+ const GdkColor *color)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (state >= GTK_STATE_NORMAL && state <= GTK_STATE_INSENSITIVE);
@@ -8430,25 +8445,27 @@ gtk_widget_modify_base (GtkWidget *widget,
* gtk_widget_modify_cursor:
* @widget: a #GtkWidget
* @primary: the color to use for primary cursor (does not need to be
- * allocated), or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_cursor().
+ * allocated), or %NULL to undo the effect of previous calls to
+ * of gtk_widget_modify_cursor().
* @secondary: the color to use for secondary cursor (does not need to be
- * allocated), or %NULL to undo the effect of previous calls to
- * of gtk_widget_modify_cursor().
+ * allocated), or %NULL to undo the effect of previous calls to
+ * of gtk_widget_modify_cursor().
*
* Sets the cursor color to use in a widget, overriding the
* #GtkWidget:cursor-color and #GtkWidget:secondary-cursor-color
- * style properties. All other style values are left untouched.
+ * style properties.
+ *
+ * All other style values are left untouched.
* See also gtk_widget_modify_style().
*
* Since: 2.12
*
* Deprecated: 3.0. Use gtk_widget_override_cursor() instead.
- **/
+ */
void
gtk_widget_modify_cursor (GtkWidget *widget,
- const GdkColor *primary,
- const GdkColor *secondary)
+ const GdkColor *primary,
+ const GdkColor *secondary)
{
GdkRGBA primary_rgba, secondary_rgba;
@@ -8470,17 +8487,19 @@ gtk_widget_modify_cursor (GtkWidget *widget,
/**
* gtk_widget_modify_font:
* @widget: a #GtkWidget
- * @font_desc: (allow-none): the font description to use, or %NULL to undo
- * the effect of previous calls to gtk_widget_modify_font().
+ * @font_desc: (allow-none): the font description to use, or %NULL
+ * to undo the effect of previous calls to gtk_widget_modify_font()
*
- * Sets the font to use for a widget. All other style values are left
- * untouched. See also gtk_widget_modify_style().
+ * Sets the font to use for a widget.
+ *
+ * All other style values are left untouched.
+ * See also gtk_widget_modify_style().
*
* Deprecated:3.0: Use gtk_widget_override_font() instead
- **/
+ */
void
gtk_widget_modify_font (GtkWidget *widget,
- PangoFontDescription *font_desc)
+ PangoFontDescription *font_desc)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -11168,8 +11187,8 @@ _gtk_widget_synthesize_crossing (GtkWidget *from,
}
static void
-gtk_widget_propagate_state (GtkWidget *widget,
- GtkStateData *data)
+gtk_widget_propagate_state (GtkWidget *widget,
+ GtkStateData *data)
{
GtkWidgetPrivate *priv = widget->priv;
GtkStateFlags new_flags, old_flags = priv->state_flags;
@@ -11202,7 +11221,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
window = gtk_widget_get_toplevel (widget);
if (window && gtk_widget_is_toplevel (window))
- gtk_window_set_focus (GTK_WINDOW (window), NULL);
+ gtk_window_set_focus (GTK_WINDOW (window), NULL);
}
new_flags = gtk_widget_get_state_flags (widget);
@@ -11212,7 +11231,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
g_object_ref (widget);
if (!gtk_widget_is_sensitive (widget) && gtk_widget_has_grab (widget))
- gtk_grab_remove (widget);
+ gtk_grab_remove (widget);
g_signal_emit (widget, widget_signals[STATE_CHANGED], 0, old_state);
g_signal_emit (widget, widget_signals[STATE_FLAGS_CHANGED], 0, old_flags);
@@ -11275,10 +11294,8 @@ gtk_widget_propagate_state (GtkWidget *widget,
gtk_widget_get_mapped (widget))
{
gint diff, flag = 1;
- GdkWindow *window;
diff = old_flags ^ new_flags;
- window = gtk_widget_get_window (widget);
while (diff != 0)
{
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 0e8570a..91b404c 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4252,9 +4252,9 @@ gtk_window_get_size (GtkWindow *window,
* gdk_screen_height () - window_height)</literal> (note that this
* example does not take multi-head scenarios into account).
*
- * The Extended Window Manager Hints specification at <ulink
+ * The Extended Window Manager Hints specification at <ulink
* url="http://www.freedesktop.org/Standards/wm-spec">
- * http://www.freedesktop.org/Standards/wm-spec</ulink> has a
+ * http://www.freedesktop.org/Standards/wm-spec</ulink> has a
* nice table of gravities in the "implementation notes" section.
*
* The gtk_window_get_position() documentation may also be relevant.
@@ -4264,17 +4264,15 @@ gtk_window_move (GtkWindow *window,
gint x,
gint y)
{
- GtkWindowPrivate *priv;
GtkWindowGeometryInfo *info;
GtkWidget *widget;
-
+
g_return_if_fail (GTK_IS_WINDOW (window));
- priv = window->priv;
widget = GTK_WIDGET (window);
info = gtk_window_get_geometry_info (window, TRUE);
-
+
if (gtk_widget_get_mapped (widget))
{
GtkAllocation allocation;
@@ -4297,7 +4295,7 @@ gtk_window_move (GtkWindow *window,
gtk_window_constrain_position (window,
allocation.width, allocation.height,
&x, &y);
-
+
/* Note that this request doesn't go through our standard request
* framework, e.g. doesn't increment configure_request_count,
* doesn't set info->last, etc.; that's because
@@ -6500,21 +6498,18 @@ gtk_window_compute_configure_request (GtkWindow *window,
GdkGeometry new_geometry;
guint new_flags;
int w, h;
- GtkWidget *widget;
GtkWindowPosition pos;
GtkWidget *parent_widget;
GtkWindowGeometryInfo *info;
GdkScreen *screen;
int x, y;
-
- widget = GTK_WIDGET (window);
screen = gtk_window_check_screen (window);
gtk_window_compute_hints (window, &new_geometry, &new_flags);
gtk_window_compute_configure_request_size (window,
- &new_geometry, new_flags,
- (guint *)&w, (guint *)&h);
+ &new_geometry, new_flags,
+ (guint *)&w, (guint *)&h);
gtk_window_constrain_size (window,
&new_geometry, new_flags,
@@ -6522,10 +6517,10 @@ gtk_window_compute_configure_request (GtkWindow *window,
&w, &h);
parent_widget = (GtkWidget*) priv->transient_parent;
-
+
pos = get_effective_position (window);
info = gtk_window_get_geometry_info (window, FALSE);
-
+
/* by default, don't change position requested */
if (info)
{
@@ -6547,7 +6542,6 @@ gtk_window_compute_configure_request (GtkWindow *window,
*
* Not sure how to go about that.
*/
-
switch (pos)
{
/* here we are only handling CENTER_ALWAYS
@@ -6558,7 +6552,7 @@ gtk_window_compute_configure_request (GtkWindow *window,
case GTK_WIN_POS_CENTER:
center_window_on_monitor (window, w, h, &x, &y);
break;
-
+
case GTK_WIN_POS_CENTER_ON_PARENT:
{
GtkAllocation allocation;
@@ -6566,7 +6560,7 @@ gtk_window_compute_configure_request (GtkWindow *window,
gint monitor_num;
GdkRectangle monitor;
gint ox, oy;
-
+
g_assert (gtk_widget_get_mapped (parent_widget)); /* established earlier */
gdk_window = gtk_widget_get_window (parent_widget);
@@ -6600,8 +6594,8 @@ gtk_window_compute_configure_request (GtkWindow *window,
{
gint screen_width = gdk_screen_get_width (screen);
gint screen_height = gdk_screen_get_height (screen);
- gint monitor_num;
- GdkRectangle monitor;
+ gint monitor_num;
+ GdkRectangle monitor;
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *pointer;
@@ -6620,7 +6614,7 @@ gtk_window_compute_configure_request (GtkWindow *window,
monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
else
monitor_num = -1;
-
+
x = px - w / 2;
y = py - h / 2;
x = CLAMP (x, 0, screen_width - w);
@@ -6650,7 +6644,7 @@ gtk_window_compute_configure_request (GtkWindow *window,
y = info->initial_y;
gtk_window_constrain_position (window, w, h, &x, &y);
}
-
+
request->x = x;
request->y = y;
request->width = w;
@@ -7989,16 +7983,13 @@ gtk_window_begin_resize_drag (GtkWindow *window,
gint root_y,
guint32 timestamp)
{
- GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel;
-
+
g_return_if_fail (GTK_IS_WINDOW (window));
widget = GTK_WIDGET (window);
g_return_if_fail (gtk_widget_get_visible (widget));
- priv = window->priv;
-
toplevel = gtk_widget_get_window (widget);
gdk_window_begin_resize_drag (toplevel,
@@ -8030,16 +8021,13 @@ gtk_window_begin_move_drag (GtkWindow *window,
gint root_y,
guint32 timestamp)
{
- GtkWindowPrivate *priv;
GtkWidget *widget;
GdkWindow *toplevel;
-
+
g_return_if_fail (GTK_IS_WINDOW (window));
widget = GTK_WIDGET (window);
g_return_if_fail (gtk_widget_get_visible (widget));
- priv = window->priv;
-
toplevel = gtk_widget_get_window (widget);
gdk_window_begin_move_drag (toplevel,
@@ -9217,11 +9205,10 @@ _gtk_window_set_is_active (GtkWindow *window,
*/
void
_gtk_window_set_is_toplevel (GtkWindow *window,
- gboolean is_toplevel)
+ gboolean is_toplevel)
{
GtkWidget *widget;
GtkWidget *toplevel;
- gboolean was_anchored;
widget = GTK_WIDGET (window);
@@ -9233,8 +9220,6 @@ _gtk_window_set_is_toplevel (GtkWindow *window,
if (is_toplevel == gtk_widget_is_toplevel (widget))
return;
- was_anchored = _gtk_widget_get_anchored (widget);
-
if (is_toplevel)
{
/* Pass through regular pathways of an embedded toplevel
@@ -9249,7 +9234,7 @@ _gtk_window_set_is_toplevel (GtkWindow *window,
gtk_widget_hide (widget);
/* Save the toplevel this widget was previously anchored into before
- * propagating a hierarchy-changed.
+ * propagating a hierarchy-changed.
*
* Usually this happens by way of gtk_widget_unparent() and we are
* already unanchored at this point, just adding this clause incase
@@ -9257,13 +9242,13 @@ _gtk_window_set_is_toplevel (GtkWindow *window,
*/
toplevel = gtk_widget_get_toplevel (widget);
if (!gtk_widget_is_toplevel (toplevel))
- toplevel = NULL;
+ toplevel = NULL;
_gtk_widget_set_is_toplevel (widget, TRUE);
/* When a window becomes toplevel after being embedded and anchored
* into another window we need to unset it's anchored flag so that
- * the hierarchy changed signal kicks in properly.
+ * the hierarchy changed signal kicks in properly.
*/
_gtk_widget_set_anchored (widget, FALSE);
_gtk_widget_propagate_hierarchy_changed (widget, toplevel);
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index f8fd501..d2079f4 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -88,9 +88,6 @@ query_module (const char *dir, const char *name, GString *contents)
{
void (*list) (const GtkIMContextInfo ***contexts,
guint *n_contexts);
- void (*init) (GTypeModule *type_module);
- void (*exit) (void);
- GtkIMContext *(*create) (const gchar *context_id);
gpointer list_ptr;
gpointer init_ptr;
@@ -125,9 +122,6 @@ query_module (const char *dir, const char *name, GString *contents)
int i;
list = list_ptr;
- init = init_ptr;
- exit = exit_ptr;
- create = create_ptr;
print_escaped (contents, path);
g_string_append_c (contents, '\n');
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c
index 338c98c..2899262 100644
--- a/gtk/updateiconcache.c
+++ b/gtk/updateiconcache.c
@@ -1095,14 +1095,13 @@ write_bucket (FILE *cache, HashNode *node, int *offset)
int name_offset;
int name_size;
int image_list_offset;
- int tmp;
int i, len;
GList *list;
g_assert (*offset == ftell (cache));
node->offset = *offset;
-
+
get_single_node_size (node, &node_size, &image_data_size);
g_assert (node_size % 4 == 0);
g_assert (image_data_size % 4 == 0);
@@ -1110,16 +1109,16 @@ write_bucket (FILE *cache, HashNode *node, int *offset)
next_offset = *offset + node_size + image_data_size;
/* Chain offset */
if (node->next != NULL)
- {
- if (!write_card32 (cache, next_offset))
- return FALSE;
- }
+ {
+ if (!write_card32 (cache, next_offset))
+ return FALSE;
+ }
else
- {
- if (!write_card32 (cache, 0xffffffff))
- return FALSE;
- }
-
+ {
+ if (!write_card32 (cache, 0xffffffff))
+ return FALSE;
+ }
+
name_size = 0;
name_offset = find_string (node->name);
if (name_offset <= 0)
@@ -1129,113 +1128,110 @@ write_bucket (FILE *cache, HashNode *node, int *offset)
add_string (node->name, name_offset);
}
if (!write_card32 (cache, name_offset))
- return FALSE;
-
+ return FALSE;
+
image_list_offset = *offset + 12 + name_size;
if (!write_card32 (cache, image_list_offset))
- return FALSE;
-
+ return FALSE;
+
/* Icon name */
if (name_size > 0)
{
if (!write_string (cache, node->name))
- return FALSE;
+ return FALSE;
}
/* Image list */
len = g_list_length (node->image_list);
if (!write_card32 (cache, len))
- return FALSE;
-
- /* Image data goes right after the image list */
- tmp = image_list_offset + 4 + len * 8;
+ return FALSE;
list = node->image_list;
data_offset = image_data_offset;
for (i = 0; i < len; i++)
- {
- Image *image = list->data;
- int image_data_size = get_image_data_size (image);
+ {
+ Image *image = list->data;
+ int image_data_size = get_image_data_size (image);
- /* Directory index */
- if (!write_card16 (cache, image->dir_index))
- return FALSE;
-
- /* Flags */
- if (!write_card16 (cache, image->flags))
- return FALSE;
+ /* Directory index */
+ if (!write_card16 (cache, image->dir_index))
+ return FALSE;
- /* Image data offset */
- if (image_data_size > 0)
- {
- if (!write_card32 (cache, data_offset))
- return FALSE;
- data_offset += image_data_size;
- }
- else
- {
- if (!write_card32 (cache, 0))
- return FALSE;
- }
+ /* Flags */
+ if (!write_card16 (cache, image->flags))
+ return FALSE;
- list = list->next;
- }
+ /* Image data offset */
+ if (image_data_size > 0)
+ {
+ if (!write_card32 (cache, data_offset))
+ return FALSE;
+ data_offset += image_data_size;
+ }
+ else
+ {
+ if (!write_card32 (cache, 0))
+ return FALSE;
+ }
+
+ list = list->next;
+ }
/* Now write the image data */
list = node->image_list;
for (i = 0; i < len; i++, list = list->next)
- {
- Image *image = list->data;
- int pixel_data_size = get_image_pixel_data_size (image);
- int meta_data_size = get_image_meta_data_size (image);
+ {
+ Image *image = list->data;
+ int pixel_data_size = get_image_pixel_data_size (image);
+ int meta_data_size = get_image_meta_data_size (image);
- if (get_image_data_size (image) == 0)
- continue;
+ if (get_image_data_size (image) == 0)
+ continue;
- /* Pixel data */
- if (pixel_data_size > 0)
- {
- image->image_data->offset = image_data_offset + 8;
- if (!write_card32 (cache, image->image_data->offset))
- return FALSE;
- }
- else
- {
- if (!write_card32 (cache, (guint32) (image->image_data ? image->image_data->offset : 0)))
- return FALSE;
- }
+ /* Pixel data */
+ if (pixel_data_size > 0)
+ {
+ image->image_data->offset = image_data_offset + 8;
+ if (!write_card32 (cache, image->image_data->offset))
+ return FALSE;
+ }
+ else
+ {
+ if (!write_card32 (cache, (guint32) (image->image_data ? image->image_data->offset : 0)))
+ return FALSE;
+ }
- if (meta_data_size > 0)
- {
- image->icon_data->offset = image_data_offset + pixel_data_size + 8;
- if (!write_card32 (cache, image->icon_data->offset))
- return FALSE;
- }
- else
- {
- if (!write_card32 (cache, image->icon_data ? image->icon_data->offset : 0))
- return FALSE;
- }
+ if (meta_data_size > 0)
+ {
+ image->icon_data->offset = image_data_offset + pixel_data_size + 8;
+ if (!write_card32 (cache, image->icon_data->offset))
+ return FALSE;
+ }
+ else
+ {
+ if (!write_card32 (cache, image->icon_data ? image->icon_data->offset : 0))
+ return FALSE;
+ }
- if (pixel_data_size > 0)
- {
- if (!write_image_data (cache, image->image_data, image->image_data->offset))
- return FALSE;
- }
-
- if (meta_data_size > 0)
- {
+ if (pixel_data_size > 0)
+ {
+ if (!write_image_data (cache, image->image_data, image->image_data->offset))
+ return FALSE;
+ }
+
+ if (meta_data_size > 0)
+ {
if (!write_icon_data (cache, image->icon_data, image->icon_data->offset))
return FALSE;
}
- image_data_offset += pixel_data_size + meta_data_size + 8;
- }
-
+ image_data_offset += pixel_data_size + meta_data_size + 8;
+ }
+
*offset = next_offset;
node = node->next;
}
-
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]