diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-10-24 15:49:18 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-10-24 15:49:18 +0900 |
commit | 0e3179b669e9f334fa877b9cf5b2c41acaa79a74 (patch) | |
tree | 77f65c439fd9b1e330d587e718b81e58834a3b82 /gtk | |
parent | 0d7fdfb36ecd7a1eeae5050656aff538a5b0440a (diff) | |
parent | 520a6aeb8ff06217373b9f567578850cb3598106 (diff) | |
download | gtk+-0e3179b669e9f334fa877b9cf5b2c41acaa79a74.tar.gz |
Merge branch 'master' into treeview-refactor
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtk.symbols | 4 | ||||
-rw-r--r-- | gtk/gtkapplication.c | 41 | ||||
-rw-r--r-- | gtk/gtkapplication.h | 3 | ||||
-rw-r--r-- | gtk/gtkcolorbutton.c | 10 | ||||
-rw-r--r-- | gtk/gtkcombobox.c | 90 | ||||
-rw-r--r-- | gtk/gtkcombobox.h | 3 | ||||
-rw-r--r-- | gtk/gtkcomboboxtext.c | 34 | ||||
-rw-r--r-- | gtk/gtkcomboboxtext.h | 4 | ||||
-rw-r--r-- | gtk/gtkentry.c | 9 | ||||
-rw-r--r-- | gtk/gtkgrid.h | 2 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 54 | ||||
-rw-r--r-- | gtk/gtktable.c | 2 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 20 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 13 |
14 files changed, 136 insertions, 153 deletions
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 0ee0e314c5..c8df972e39 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -754,6 +754,7 @@ gtk_color_button_get_type G_GNUC_CONST gtk_color_button_get_use_alpha gtk_color_button_new gtk_color_button_new_with_color +gtk_color_button_new_with_rgba gtk_color_button_set_alpha gtk_color_button_set_color gtk_color_button_set_title @@ -801,7 +802,6 @@ gtk_combo_box_get_column_span_column gtk_combo_box_get_entry_text_column gtk_combo_box_get_focus_on_click gtk_combo_box_get_has_entry -gtk_combo_box_get_id_column gtk_combo_box_get_model gtk_combo_box_get_popup_accessible gtk_combo_box_get_popup_fixed_width @@ -823,7 +823,6 @@ gtk_combo_box_set_add_tearoffs gtk_combo_box_set_column_span_column gtk_combo_box_set_entry_text_column gtk_combo_box_set_focus_on_click -gtk_combo_box_set_id_column gtk_combo_box_set_model gtk_combo_box_set_popup_fixed_width gtk_combo_box_set_row_separator_func @@ -840,7 +839,6 @@ gtk_combo_box_text_append_text gtk_combo_box_text_get_active_text gtk_combo_box_text_get_type G_GNUC_CONST gtk_combo_box_text_insert_text -gtk_combo_box_text_insert_text_with_id gtk_combo_box_text_new gtk_combo_box_text_new_with_entry gtk_combo_box_text_prepend_text diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 11af1baed3..70c9754177 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -44,11 +44,11 @@ * of a GTK+ application in a convenient fashion, without enforcing * a one-size-fits-all application model. * - * Currently, GtkApplication handles application uniqueness, provides - * some basic scriptability by exporting 'actions', implements some - * standard actions itself (such as 'Quit') and provides a main window - * whose life-cycle is automatically tied to the life-cycle of your - * application. + * Currently, GtkApplication handles GTK+ initialization, application + * uniqueness, provides some basic scriptability by exporting 'actions', + * implements some standard actions itself (such as 'Quit') and manages + * a list of toplevel windows whose life-cycle is automatically tied to + * the life-cycle of your application. * * <example id="gtkapplication"><title>A simple application</title> * <programlisting> @@ -151,6 +151,20 @@ gtk_application_class_init (GtkApplicationClass *class) g_type_class_add_private (class, sizeof (GtkApplicationPrivate)); } +/** + * gtk_application_new: + * @application_id: the application id + * @flags: the application flags + * + * Creates a new #GtkApplication instance. + * + * This function calls g_type_init() for you. gtk_init() is called + * as soon as the application gets registered as the primary instance. + * + * The application id must be valid. See g_application_id_is_valid(). + * + * Returns: a new #GtkApplication instance + */ GtkApplication * gtk_application_new (const gchar *application_id, GApplicationFlags flags) @@ -181,12 +195,15 @@ void gtk_application_add_window (GtkApplication *application, GtkWindow *window) { + GtkApplicationPrivate *priv; + g_return_if_fail (GTK_IS_APPLICATION (application)); - if (!g_list_find (application->priv->windows, window)) + priv = application->priv; + + if (!g_list_find (priv->windows, window)) { - application->priv->windows = g_list_prepend (application->priv->windows, - window); + priv->windows = g_list_prepend (priv->windows, window); gtk_window_set_application (window, application); g_application_hold (G_APPLICATION (application)); } @@ -212,12 +229,14 @@ void gtk_application_remove_window (GtkApplication *application, GtkWindow *window) { + GtkApplicationPrivate *priv; + g_return_if_fail (GTK_IS_APPLICATION (application)); - if (g_list_find (application->priv->windows, window)) + priv = application->priv; + if (g_list_find (priv->windows, window)) { - application->priv->windows = g_list_remove (application->priv->windows, - window); + priv->windows = g_list_remove (priv->windows, window); g_application_release (G_APPLICATION (application)); gtk_window_set_application (window, NULL); } diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h index c9c8571a46..8fafd4ef5b 100644 --- a/gtk/gtkapplication.h +++ b/gtk/gtkapplication.h @@ -55,9 +55,6 @@ struct _GtkApplicationClass { GApplicationClass parent_class; - /*< vfuncs >*/ - GtkWindow *(* create_window) (GtkApplication *application); - /*< private >*/ gpointer padding[12]; }; diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 9548280010..2e2214f85b 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -537,6 +537,16 @@ gtk_color_button_new_with_color (const GdkColor *color) return g_object_new (GTK_TYPE_COLOR_BUTTON, "color", color, NULL); } +/** + * gtk_color_button_new_with_rgba: + * @rgba: A #GdkRGBA to set the current color with. + * + * Creates a new color button. + * + * Returns: a new color button + * + * Since: 3.0 + */ GtkWidget * gtk_color_button_new_with_rgba (const GdkRGBA *rgba) { diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 64023569e3..c17326e3df 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -143,8 +143,6 @@ struct _GtkComboBoxPrivate gint text_column; GtkCellRenderer *text_renderer; - gint id_column; - GSList *cells; guint popup_in_progress : 1; @@ -247,8 +245,7 @@ enum { PROP_EDITING_CANCELED, PROP_HAS_ENTRY, PROP_ENTRY_TEXT_COLUMN, - PROP_POPUP_FIXED_WIDTH, - PROP_ID_COLUMN + PROP_POPUP_FIXED_WIDTH }; static guint combo_box_signals[LAST_SIGNAL] = {0,}; @@ -952,23 +949,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) GTK_PARAM_READWRITE)); /** - * GtkComboBox:id-column: - * - * The column in the combo box's model that provides numeric - * IDs for the values in the model, if != -1. - * - * Since: 3.0 - */ - g_object_class_install_property (object_class, - PROP_ID_COLUMN, - g_param_spec_int ("id-column", - P_("ID Column"), - P_("The column in the combo box's model that provides " - "numeric IDs for the values in the model"), - -1, G_MAXINT, -1, - GTK_PARAM_READWRITE)); - - /** * GtkComboBox:popup-fixed-width: * * Whether the popup's width should be a fixed width matching the @@ -1097,7 +1077,6 @@ gtk_combo_box_init (GtkComboBox *combo_box) priv->text_column = -1; priv->text_renderer = NULL; - priv->id_column = -1; gtk_combo_box_check_appearance (combo_box); } @@ -1189,10 +1168,6 @@ gtk_combo_box_set_property (GObject *object, gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value)); break; - case PROP_ID_COLUMN: - gtk_combo_box_set_id_column (combo_box, g_value_get_int (value)); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1270,10 +1245,6 @@ gtk_combo_box_get_property (GObject *object, g_value_set_int (value, priv->text_column); break; - case PROP_ID_COLUMN: - g_value_set_int (value, priv->id_column); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -5900,14 +5871,14 @@ gtk_combo_box_set_title (GtkComboBox *combo_box, * @combo_box: a #GtkComboBox * @fixed: whether to use a fixed popup width * - * Specifies whether the popup's width should be a fixed width matching - * the allocated width of the combo box. + * Specifies whether the popup's width should be a fixed width + * matching the allocated width of the combo box. * * Since: 3.0 **/ void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, - gboolean fixed) + gboolean fixed) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); @@ -5923,9 +5894,11 @@ gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, * gtk_combo_box_get_popup_fixed_width: * @combo_box: a #GtkComboBox * - * Gets whether the popup uses a fixed width matching + * Gets whether the popup uses a fixed width matching * the allocated width of the combo box. * + * Returns: %TRUE if the popup uses a fixed width + * * Since: 3.0 **/ gboolean @@ -6573,7 +6546,7 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, xpad = 2 * (border_width + cell_style->xthickness); ypad = 2 * (border_width + cell_style->ythickness); - } + } size -= but_width; size -= 2 * focus_width; @@ -6602,50 +6575,3 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, if (natural_size) *natural_size = nat_height; } - -/** - * gtk_combo_box_set_id_column: - * @combo_box: A #GtkComboBox - * @id_column: A column in @model to get numeric IDs for values from - * - * Sets the model column which @combo_box should use to get numeric IDs - * for values from. The column @id_column in the model of @combo_box - * must be of type %G_TYPE_INT. - * - * Since: 3.0 - */ -void -gtk_combo_box_set_id_column (GtkComboBox *combo_box, - gint id_column) -{ - GtkComboBoxPrivate *priv = combo_box->priv; - GtkTreeModel *model; - - g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); - - model = gtk_combo_box_get_model (combo_box); - - g_return_if_fail (id_column >= 0); - g_return_if_fail (model == NULL || id_column < gtk_tree_model_get_n_columns (model)); - - priv->id_column = id_column; -} - -/** - * gtk_combo_box_get_id_column: - * @combo_box: A #GtkComboBox - * - * Returns the column which @combo_box is using to get numeric IDs - * for values from. - * - * Return value: A column in the data source model of @combo_box. - * - * Since: 3.0 - */ -gint -gtk_combo_box_get_id_column (GtkComboBox *combo_box) -{ - g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0); - - return combo_box->priv->id_column; -} diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h index ac256a7746..c5b6a3c1e0 100644 --- a/gtk/gtkcombobox.h +++ b/gtk/gtkcombobox.h @@ -133,9 +133,6 @@ void gtk_combo_box_popup_for_device (GtkComboBox *combo_box, void gtk_combo_box_popdown (GtkComboBox *combo_box); AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box); -gint gtk_combo_box_get_id_column (GtkComboBox *combo_box); -void gtk_combo_box_set_id_column (GtkComboBox *combo_box, - gint id_column); G_END_DECLS diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c index d8df72fdf1..db3a4e86aa 100644 --- a/gtk/gtkcomboboxtext.c +++ b/gtk/gtkcomboboxtext.c @@ -72,7 +72,7 @@ gtk_combo_box_text_init (GtkComboBoxText *combo_box) { GtkListStore *store; - store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); + store = gtk_list_store_new (1, G_TYPE_STRING); gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store)); g_object_unref (store); } @@ -102,7 +102,6 @@ gtk_combo_box_text_new (void) { return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, "entry-text-column", 0, - "id-column", 1, NULL); } @@ -122,7 +121,6 @@ gtk_combo_box_text_new_with_entry (void) return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, "has-entry", TRUE, "entry-text-column", 0, - "id-column", 1, NULL); } @@ -173,27 +171,6 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, gint position, const gchar *text) { - gtk_combo_box_text_insert_text_with_id (combo_box, position, text, 0); -} - -/** - * gtk_combo_box_text_insert_text_with_id: - * @combo_box: A #GtkComboBoxText - * @position: An index to insert @text - * @text: A string - * @id: a numeric ID for this value - * - * Inserts @text at @position in the list of strings stored in @combo_box, - * and sets its numeric ID to @id. See #GtkComboBox::id-column. - * - * Since: 3.0 - */ -void -gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, - gint position, - const gchar *text, - gint id) -{ GtkListStore *store; GtkTreeIter iter; gint text_column; @@ -209,18 +186,11 @@ gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column); g_return_if_fail (column_type == G_TYPE_STRING); - id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box)); - if (id_column != -1) - { - column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column); - g_return_if_fail (column_type == G_TYPE_INT); - } gtk_list_store_insert (store, &iter, position); - gtk_list_store_set (store, &iter, text_column, text, id_column, id, -1); + gtk_list_store_set (store, &iter, text_column, text, -1); } - /** * gtk_combo_box_text_remove: * @combo_box: A #GtkComboBox diff --git a/gtk/gtkcomboboxtext.h b/gtk/gtkcomboboxtext.h index 7322e45134..50ebcb501c 100644 --- a/gtk/gtkcomboboxtext.h +++ b/gtk/gtkcomboboxtext.h @@ -72,10 +72,6 @@ void gtk_combo_box_text_remove (GtkComboBoxText *combo_box void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box); gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); -void gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, - gint position, - const gchar *text, - gint id); G_END_DECLS diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 4d10e36305..053e02baa5 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6660,9 +6660,11 @@ gtk_entry_set_buffer (GtkEntry *entry, * @entry: a #GtkEntry * @text_area: Return location for the text area. * - * Returns the area where the entry's text is drawn. This function is + * Gets the area where the entry's text is drawn. This function is * useful when drawing something to the entry in a draw callback. * + * If the entry is not realized, @text_area is filled with zeros. + * * See also gtk_entry_get_icon_area(). * * Since: 3.0 @@ -8111,10 +8113,13 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry) * @icon_pos: Icon position * @icon_area: Return location for the icon's area * - * Returns the area where entry's icon at @icon_pos is drawn. + * Gets the area where entry's icon at @icon_pos is drawn. * This function is useful when drawing something to the * entry in a draw callback. * + * If the entry is not realized or has no icon at the given position, + * @icon_area is filled with zeros. + * * See also gtk_entry_get_text_area() * * Since: 3.0 diff --git a/gtk/gtkgrid.h b/gtk/gtkgrid.h index 590d9cddeb..860658a0b7 100644 --- a/gtk/gtkgrid.h +++ b/gtk/gtkgrid.h @@ -74,7 +74,7 @@ void gtk_grid_attach (GtkGrid *grid, gint width, gint height); void gtk_grid_attach_next_to (GtkGrid *grid, - GtkWidget *widget, + GtkWidget *child, GtkWidget *sibling, GtkPositionType side, gint width, diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 7906bd6a70..02fe2a5f50 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -2181,6 +2181,16 @@ gtk_scrolled_window_get_preferred_width_for_height (GtkWidget *widget, GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width); } +/** + * gtk_scrolled_window_get_min_content_width: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the minimum content width of @scrolled_window, or -1 if not set. + * + * Returns: the minimum content width + * + * Since: 3.0 + */ gint gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window) { @@ -2189,9 +2199,20 @@ gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window) return scrolled_window->priv->min_content_width; } +/** + * gtk_scrolled_window_set_min_content_width: + * @scrolled_window: a #GtkScrolledWindow + * @width: the minimal content width + * + * Sets the minimum width that @scrolled_window should keep visible. + * Note that this can and (usually will) be smaller than the minimum + * size of the content. + * + * Since: 3.0 + */ void gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, - gint min_content_width) + gint width) { GtkScrolledWindowPrivate *priv; @@ -2199,9 +2220,9 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, priv = scrolled_window->priv; - if (priv->min_content_width != min_content_width) + if (priv->min_content_width != width) { - priv->min_content_width = min_content_width; + priv->min_content_width = width; gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); @@ -2209,6 +2230,16 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, } } +/** + * gtk_scrolled_window_get_min_content_height: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the minimal content height of @scrolled_window, or -1 if not set. + * + * Returns: the minimal content height + * + * Since: 3.0 + */ gint gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window) { @@ -2217,9 +2248,20 @@ gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window) return scrolled_window->priv->min_content_height; } +/** + * gtk_scrolled_window_set_min_content_height: + * @scrolled_window: a #GtkScrolledWindow + * @height: the minimal content height + * + * Sets the minimum height that @scrolled_window should keep visible. + * Note that this can and (usually will) be smaller than the minimum + * size of the content. + * + * Since: 3.0 + */ void gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window, - gint min_content_height) + gint height) { GtkScrolledWindowPrivate *priv; @@ -2227,9 +2269,9 @@ gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window, priv = scrolled_window->priv; - if (priv->min_content_height != min_content_height) + if (priv->min_content_height != height) { - priv->min_content_height = min_content_height; + priv->min_content_height = height; gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 7178aa0895..80cf51a5a9 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -934,7 +934,7 @@ gtk_table_get_homogeneous (GtkTable *table) * @columns: (out) (allow-none): return location for the number * of columns, or %NULL * - * Returns the number of rows and columns in the table. + * Gets the number of rows and columns in the table. * * Since: 2.22 **/ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 43f8c377ba..97e89f2c51 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11204,6 +11204,16 @@ gtk_widget_update_computed_expand (GtkWidget *widget) } } +/** + * gtk_widget_queue_compute_expand: + * @widget: a #GtkWidget + * + * Mark @widget as needing to recompute its expand flags. Call + * this function when setting legacy expand child properties + * on the child of a container. + * + * See gtk_widget_compute_expand(). + */ void gtk_widget_queue_compute_expand (GtkWidget *widget) { @@ -13146,6 +13156,16 @@ gtk_widget_send_focus_change (GtkWidget *widget, return res; } +/** + * gtk_widget_in_destruction: + * @widget: a #GtkWidget + * + * Returns whether the widget is currently being destroyed. + * This information can sometimes be used to avoid doing + * unnecessary work. + * + * Returns: %TRUE if @widget is being destroyed + */ gboolean gtk_widget_in_destruction (GtkWidget *widget) { diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 08202a29b6..fb63d1c4d2 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -2673,19 +2673,22 @@ void gtk_window_set_application (GtkWindow *window, GtkApplication *application) { + GtkWindowPrivate *priv; + g_return_if_fail (GTK_IS_WINDOW (window)); - if (window->priv->application != application) + priv = window->priv; + if (priv->application != application) { gtk_window_release_application (window); - window->priv->application = application; + priv->application = application; - if (window->priv->application != NULL) + if (priv->application != NULL) { - g_object_ref (window->priv->application); + g_object_ref (priv->application); - gtk_application_add_window (window->priv->application, window); + gtk_application_add_window (priv->application, window); } g_object_notify (G_OBJECT (window), "application"); |