Updating branch refs/heads/master to 0c15ac55ad681e37c998c0169693f87070423c26 (commit) from a2a8232e2f894381f5b4c1e451a956bac1c1b8ba (commit)
commit 0c15ac55ad681e37c998c0169693f87070423c26 Author: Nick Schermer <n...@xfce.org> Date: Sun Dec 11 16:34:52 2011 +0100 Separator: Remove new line option. This will be replaced by the nrows property. libxfce4panel/libxfce4panel.symbols | 1 + libxfce4panel/xfce-panel-plugin-provider.h | 2 - panel/panel-application.c | 10 - panel/panel-itembar.c | 305 ++++++++++------------------ plugins/separator/separator-dialog.glade | 3 - plugins/separator/separator.c | 29 +-- 6 files changed, 115 insertions(+), 235 deletions(-) diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols index 3730482..64a299e 100644 --- a/libxfce4panel/libxfce4panel.symbols +++ b/libxfce4panel/libxfce4panel.symbols @@ -45,6 +45,7 @@ libxfce4panel_minor_version #if IN_HEADER(__LIBXFCE4PANEL_ENUM_TYPES_H__) #if IN_SOURCE(__LIBXFCE4PANEL_ENUM_TYPES_C__) xfce_screen_position_get_type G_GNUC_CONST +xfce_panel_plugin_mode_get_type G_GNUC_CONST #endif #endif diff --git a/libxfce4panel/xfce-panel-plugin-provider.h b/libxfce4panel/xfce-panel-plugin-provider.h index ed300c0..e603986 100644 --- a/libxfce4panel/xfce-panel-plugin-provider.h +++ b/libxfce4panel/xfce-panel-plugin-provider.h @@ -79,8 +79,6 @@ typedef enum /*< skip >*/ PROVIDER_SIGNAL_MOVE_PLUGIN = 0, PROVIDER_SIGNAL_EXPAND_PLUGIN, PROVIDER_SIGNAL_COLLAPSE_PLUGIN, - PROVIDER_SIGNAL_WRAP_PLUGIN, - PROVIDER_SIGNAL_UNWRAP_PLUGIN, PROVIDER_SIGNAL_SMALL_PLUGIN, PROVIDER_SIGNAL_UNSMALL_PLUGIN, PROVIDER_SIGNAL_LOCK_PANEL, diff --git a/panel/panel-application.c b/panel/panel-application.c index 2680e25..0d3b493 100644 --- a/panel/panel-application.c +++ b/panel/panel-application.c @@ -633,16 +633,6 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider *provide NULL); break; - case PROVIDER_SIGNAL_WRAP_PLUGIN: - case PROVIDER_SIGNAL_UNWRAP_PLUGIN: - itembar = gtk_bin_get_child (GTK_BIN (window)); - gtk_container_child_set (GTK_CONTAINER (itembar), - GTK_WIDGET (provider), - "wrap", - provider_signal == PROVIDER_SIGNAL_WRAP_PLUGIN, - NULL); - break; - case PROVIDER_SIGNAL_SMALL_PLUGIN: case PROVIDER_SIGNAL_UNSMALL_PLUGIN: itembar = gtk_bin_get_child (GTK_BIN (window)); diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c index cbf845e..e0f0ba6 100644 --- a/panel/panel-itembar.c +++ b/panel/panel-itembar.c @@ -101,7 +101,6 @@ struct _PanelItembarChild GtkWidget *widget; guint expand : 1; guint shrink : 1; - guint wrap : 1; guint small : 1; }; @@ -118,7 +117,6 @@ enum CHILD_PROP_0, CHILD_PROP_EXPAND, CHILD_PROP_SHRINK, - CHILD_PROP_WRAP, CHILD_PROP_SMALL }; @@ -208,13 +206,6 @@ panel_itembar_class_init (PanelItembarClass *klass) EXO_PARAM_READWRITE)); gtk_container_class_install_child_property (gtkcontainer_class, - CHILD_PROP_WRAP, - g_param_spec_boolean ("wrap", - NULL, NULL, - FALSE, - EXO_PARAM_READWRITE)); - - gtk_container_class_install_child_property (gtkcontainer_class, CHILD_PROP_SMALL, g_param_spec_boolean ("small", NULL, NULL, @@ -333,30 +324,10 @@ panel_itembar_size_request (GtkWidget *widget, gtk_widget_size_request (child->widget, &child_requisition); - if (G_LIKELY (!child->wrap)) - { - if (HORIZONTAL (itembar)) - row_length += child_requisition.width; - else - row_length += child_requisition.height; - } + if (HORIZONTAL (itembar)) + row_length += child_requisition.width; else - { - /* add to size for new wrap element */ - if (HORIZONTAL (itembar)) - { - requisition->height += itembar->size; - requisition->width = MAX (requisition->width, row_length); - } - else - { - requisition->width += itembar->size; - requisition->height = MAX (requisition->height, row_length); - } - - /* reset length for new row */ - row_length = 0; - } + row_length += child_requisition.height; } else { @@ -384,11 +355,10 @@ panel_itembar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PanelItembar *itembar = PANEL_ITEMBAR (widget); - GSList *li, *lp; + GSList *lp; PanelItembarChild *child; GtkRequisition child_req; GtkAllocation child_alloc; - guint row; gint widget_length, border_width; gint expand_length_avail, expand_length_req; gint shrink_length_avail, shrink_length_req; @@ -407,176 +377,136 @@ panel_itembar_size_allocate (GtkWidget *widget, else widget_length = allocation->height - 2 * border_width; - /* loop for wrap items */ - for (row = 0, li = itembar->children; li != NULL; li = g_slist_next (li), row++) - { - expand_length_avail = widget_length; - expand_length_req = 0; - shrink_length_avail = 0; - shrink_length_req = 0; + expand_length_avail = widget_length; + expand_length_req = 0; + shrink_length_avail = 0; + shrink_length_req = 0; - /* get information about the expandable lengths */ - for (lp = li; lp != NULL; lp = g_slist_next (lp)) + /* get information about the expandable lengths */ + for (lp = itembar->children; lp != NULL; lp = g_slist_next (lp)) + { + child = lp->data; + if (G_LIKELY (child != NULL)) { - child = lp->data; - if (G_LIKELY (child != NULL)) + if (!GTK_WIDGET_VISIBLE (child->widget)) + continue; + + gtk_widget_get_child_requisition (child->widget, &child_req); + length = HORIZONTAL (itembar) ? child_req.width : child_req.height; + + if (G_UNLIKELY (child->expand)) { - if (!GTK_WIDGET_VISIBLE (child->widget)) - continue; - - /* continue allocating until we hit a wrap child */ - if (G_UNLIKELY (child->wrap)) - break; - - gtk_widget_get_child_requisition (child->widget, &child_req); - length = HORIZONTAL (itembar) ? child_req.width : child_req.height; - - if (G_UNLIKELY (child->expand)) - { - expand_length_req += length; - } - else - { - expand_length_avail -= length; - - if (child->shrink) - shrink_length_avail += length; - } + expand_length_req += length; } else { - expand_length_avail -= itembar->size; + expand_length_avail -= length; + + if (child->shrink) + shrink_length_avail += length; } } - - /* set start coordinates for the items in the row*/ - x = allocation->x + border_width; - y = allocation->y + border_width; - if (HORIZONTAL (itembar)) - y += row * itembar->size; else - x += row * itembar->size; - - /* whether the expandable items fit on this row; we use this - * as a fast-path when there are expanding items on a panel with - * not really enough length to expand (ie. items make the panel grow, - * not the length set by the user) */ - expand_children_fit = expand_length_req == expand_length_avail; - - if (expand_length_avail < 0) { - /* check if there are plugins on the panel we can shrink */ - if (shrink_length_avail > 0) - shrink_length_req = ABS (expand_length_avail); - - expand_length_avail = 0; + expand_length_avail -= itembar->size; } + } - /* allocate the children on this row */ - for (; li != NULL; li = g_slist_next (li)) - { - child = li->data; + /* set start coordinates for the items in the row*/ + x = allocation->x + border_width; + y = allocation->y + border_width; - /* the highlight item for which we keep some spare space */ - if (G_UNLIKELY (child == NULL)) - { - itembar->highlight_x = x; - itembar->highlight_y = y; - expand_length_avail -= itembar->size; + /* whether the expandable items fit on this row; we use this + * as a fast-path when there are expanding items on a panel with + * not really enough length to expand (ie. items make the panel grow, + * not the length set by the user) */ + expand_children_fit = expand_length_req == expand_length_avail; - if (HORIZONTAL (itembar)) - x += itembar->size; - else - y += itembar->size; + if (expand_length_avail < 0) + { + /* check if there are plugins on the panel we can shrink */ + if (shrink_length_avail > 0) + shrink_length_req = ABS (expand_length_avail); - continue; - } + expand_length_avail = 0; + } - if (!GTK_WIDGET_VISIBLE (child->widget)) - continue; + /* allocate the children on this row */ + for (lp = itembar->children; lp != NULL; lp = g_slist_next (lp)) + { + child = lp->data; - gtk_widget_get_child_requisition (child->widget, &child_req); + /* the highlight item for which we keep some spare space */ + if (G_UNLIKELY (child == NULL)) + { + itembar->highlight_x = x; + itembar->highlight_y = y; + expand_length_avail -= itembar->size; + + if (HORIZONTAL (itembar)) + x += itembar->size; + else + y += itembar->size; - child_alloc.x = x; - child_alloc.y = y; + continue; + } - if (child->wrap) - { - /* if there is any expanding length available use it for the - * wrapping plugin to improve accessibility */ - if (expand_length_avail > 0) - { - if (HORIZONTAL (itembar)) - { - child_alloc.height = itembar->size; - child_alloc.width = expand_length_avail; - } - else - { - child_alloc.width = itembar->size; - child_alloc.height = expand_length_avail; - } - } - else - { - /* hide it */ - child_alloc.width = child_alloc.height = 0; - } - - gtk_widget_size_allocate (child->widget, &child_alloc); - - /* stop and continue to the next row */ - break; - } + if (!GTK_WIDGET_VISIBLE (child->widget)) + continue; - child_length = HORIZONTAL (itembar) ? child_req.width : child_req.height; + gtk_widget_get_child_requisition (child->widget, &child_req); - if (G_UNLIKELY (!expand_children_fit && child->expand)) - { - /* equally share the length between the expanding plugins */ - panel_assert (expand_length_req > 0); - new_length = expand_length_avail * child_length / expand_length_req; + child_alloc.x = x; + child_alloc.y = y; - expand_length_req -= child_length; - expand_length_avail -= new_length; + child_length = HORIZONTAL (itembar) ? child_req.width : child_req.height; - child_length = new_length; - } - else if (child->shrink && shrink_length_req > 0) - { - /* equally shrink all shrinking plugins */ - panel_assert (shrink_length_avail > 0); - new_length = shrink_length_req * child_length / shrink_length_avail; - - shrink_length_req -= new_length; - shrink_length_avail -= child_length; - - /* the size we decrease can never be more then the actual length, - * if this is the case the size allocation is lacking behind, - * which happens on panel startup with a expanding panel */ - if (new_length < child_length) - child_length -= new_length; - } + if (G_UNLIKELY (!expand_children_fit && child->expand)) + { + /* equally share the length between the expanding plugins */ + panel_assert (expand_length_req > 0); + new_length = expand_length_avail * child_length / expand_length_req; - if (child_length < 1) - child_length = 1; + expand_length_req -= child_length; + expand_length_avail -= new_length; - if (HORIZONTAL (itembar)) - { - child_alloc.height = itembar->size; - child_alloc.width = child_length; - x += child_alloc.width; - } - else - { - child_alloc.width = itembar->size; - child_alloc.height = child_length; - y += child_alloc.height; - } + child_length = new_length; + } + else if (child->shrink && shrink_length_req > 0) + { + /* equally shrink all shrinking plugins */ + panel_assert (shrink_length_avail > 0); + new_length = shrink_length_req * child_length / shrink_length_avail; + + shrink_length_req -= new_length; + shrink_length_avail -= child_length; + + /* the size we decrease can never be more then the actual length, + * if this is the case the size allocation is lacking behind, + * which happens on panel startup with a expanding panel */ + if (new_length < child_length) + child_length -= new_length; + } - gtk_widget_size_allocate (child->widget, &child_alloc); + if (child_length < 1) + child_length = 1; + + if (HORIZONTAL (itembar)) + { + child_alloc.height = itembar->size; + child_alloc.width = child_length; + x += child_alloc.width; + } + else + { + child_alloc.width = itembar->size; + child_alloc.height = child_length; + y += child_alloc.height; } + + gtk_widget_size_allocate (child->widget, &child_alloc); } + } @@ -706,13 +636,6 @@ panel_itembar_set_child_property (GtkContainer *container, child->shrink = boolean; break; - case CHILD_PROP_WRAP: - boolean = g_value_get_boolean (value); - if (child->wrap == boolean) - return; - child->wrap = boolean; - break; - case CHILD_PROP_SMALL: boolean = g_value_get_boolean (value); if (child->small == boolean) @@ -753,10 +676,6 @@ panel_itembar_get_child_property (GtkContainer *container, g_value_set_boolean (value, child->shrink); break; - case CHILD_PROP_WRAP: - g_value_set_boolean (value, child->wrap); - break; - case CHILD_PROP_SMALL: g_value_set_boolean (value, child->small); break; @@ -815,7 +734,6 @@ panel_itembar_insert (PanelItembar *itembar, child = g_slice_new0 (PanelItembarChild); child->widget = widget; child->expand = FALSE; - child->wrap = FALSE; itembar->children = g_slist_insert (itembar->children, child, position); gtk_widget_set_parent (widget, GTK_WIDGET (itembar)); @@ -903,7 +821,6 @@ panel_itembar_get_drop_index (PanelItembar *itembar, GSList *li; GtkAllocation *alloc; guint idx; - gint row = 0; panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), 0); @@ -920,16 +837,6 @@ panel_itembar_get_drop_index (PanelItembar *itembar, if (G_UNLIKELY (child == NULL)) continue; - if (child->wrap) - { - row += itembar->size; - - /* always make sure the item is on the row */ - if ((HORIZONTAL (itembar) && y < row) - || (!HORIZONTAL (itembar) && x < row)) - break; - } - alloc = &child->widget->allocation; if (HORIZONTAL (itembar)) diff --git a/plugins/separator/separator-dialog.glade b/plugins/separator/separator-dialog.glade index 53d5c5e..b8fae9a 100644 --- a/plugins/separator/separator-dialog.glade +++ b/plugins/separator/separator-dialog.glade @@ -162,9 +162,6 @@ <row> <col id="0" translatable="yes">Dots</col> </row> - <row> - <col id="0" translatable="yes">New Line</col> - </row> </data> </object> </interface> diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c index 99f988c..8543ee7 100644 --- a/plugins/separator/separator.c +++ b/plugins/separator/separator.c @@ -66,7 +66,7 @@ enum _SeparatorPluginStyle SEPARATOR_PLUGIN_STYLE_SEPARATOR, SEPARATOR_PLUGIN_STYLE_HANDLE, SEPARATOR_PLUGIN_STYLE_DOTS, - SEPARATOR_PLUGIN_STYLE_WRAP, + SEPARATOR_PLUGIN_STYLE_WRAP, /* not used in 4.10, nrows property is now used */ /* defines */ SEPARATOR_PLUGIN_STYLE_MIN = SEPARATOR_PLUGIN_STYLE_TRANSPARENT, @@ -194,17 +194,17 @@ separator_plugin_set_property (GObject *object, GParamSpec *pspec) { SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (object); - gboolean wrap; switch (prop_id) { case PROP_STYLE: plugin->style = g_value_get_uint (value); - gtk_widget_queue_draw (GTK_WIDGET (object)); - wrap = plugin->style == SEPARATOR_PLUGIN_STYLE_WRAP; - xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (object), - wrap ? PROVIDER_SIGNAL_WRAP_PLUGIN : PROVIDER_SIGNAL_UNWRAP_PLUGIN); + /* old property */ + if (plugin->style == SEPARATOR_PLUGIN_STYLE_WRAP) + plugin->style = SEPARATOR_PLUGIN_STYLE_DEFAULT; + + gtk_widget_queue_draw (GTK_WIDGET (object)); break; case PROP_EXPAND: @@ -380,17 +380,6 @@ separator_plugin_size_changed (XfcePanelPlugin *panel_plugin, static void -separator_plugin_configure_style_changed (GtkComboBox *combo_box, - GtkWidget *expand) -{ - /* expand is not functional when the wrap function is enabled */ - gtk_widget_set_sensitive (expand, - gtk_combo_box_get_active (combo_box) != SEPARATOR_PLUGIN_STYLE_WRAP); -} - - - -static void separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) { SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin); @@ -407,12 +396,10 @@ separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin) return; style = gtk_builder_get_object (builder, "style"); - expand = gtk_builder_get_object (builder, "expand"); - g_signal_connect (G_OBJECT (style), "changed", - G_CALLBACK (separator_plugin_configure_style_changed), expand); - exo_mutual_binding_new (G_OBJECT (plugin), "style", G_OBJECT (style), "active"); + + expand = gtk_builder_get_object (builder, "expand"); exo_mutual_binding_new (G_OBJECT (plugin), "expand", G_OBJECT (expand), "active"); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits