[yanhwizhao at gmail.com: [Xfce4-commits] commit patch to xfce4-panel]
Mike Massonnet
mmassonnet at gmail.com
Sat May 10 13:32:44 CEST 2008
Forwarded to the xfce dev ml as it will reach more exposure.
http://foo-projects.org/pipermail/xfce4-commits/2008-May/027207.html
----- Forwarded message from joy zhao <yanhwizhao at gmail.com> -----
From: joy zhao <yanhwizhao at gmail.com>
To: xfce4-commits at xfce.org
Subject: [Xfce4-commits] commit patch to xfce4-panel
List-Id: Xfce4 SVN Commits list <xfce4-commits.xfce.org>
hi,
I'd commit a patch for xfce4-panel, however, I don't know whom exactly I
should send this mail to . So I just send it to this address. If it's no t
a proper way, can anyone kindly enough let me know ? Thanks!
This patch is to add a show/hide button on panel, which, when clicked, will
toggle panel's show/hide status, and for example, have panel hide to left
corner or bottom corner.
users can choose whether to have this button on panel in panel property
dialog.
The attachment is my patch.
YanZhao
diff -uprN xfce4-panel/trunk/panel/panel.c xfce4-panel-new/trunk/panel/panel.c
--- xfce4-panel/trunk/panel/panel.c 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel.c 2008-05-10 16:15:53.000000000 +0800
@@ -58,7 +58,8 @@ enum
PROP_AUTOHIDE,
PROP_FULL_WIDTH,
PROP_TRANSPARENCY,
- PROP_ACTIVE_TRANS
+ PROP_ACTIVE_TRANS,
+ PROP_SHOW_HIDEBUTTON
};
@@ -81,6 +82,9 @@ static void panel_size_request (GtkWidg
static gboolean panel_button_pressed (GtkWidget *widget,
GdkEventButton *ev);
+/*hide button*/
+
+static void panel_setup_widgets(Panel *panel);
/* plugin menu */
static void panel_menu_deactivated (GtkWidget *item);
@@ -214,6 +218,17 @@ panel_class_init (PanelClass * klass)
DEFAULT_ACTIVE_TRANS, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_ACTIVE_TRANS, pspec);
+
+ pspec = g_param_spec_boolean ("show-hidebutton",
+ "show_hidebutton",
+ "whether show hide button on panel",
+ DEFAULT_SHOW_HIDEBUTTON, G_PARAM_READWRITE);
+
+ g_object_class_install_property (object_class, PROP_SHOW_HIDEBUTTON, pspec);
+
+
+
+
}
static void
@@ -234,11 +249,11 @@ panel_init (Panel * panel)
priv->full_width = DEFAULT_FULL_WIDTH;
priv->transparency = DEFAULT_TRANSPARENCY;
priv->activetrans = DEFAULT_ACTIVE_TRANS;
+ priv->panel_state = DEFAULT_PANEL_STATE;
+ priv->show_hidebutton = DEFAULT_SHOW_HIDEBUTTON;
- priv->itembar = xfce_itembar_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show (priv->itembar);
- gtk_container_add (GTK_CONTAINER (panel), priv->itembar);
-
+ panel_setup_widgets(panel);
+
panel_dnd_set_dest_name_and_widget (priv->itembar);
panel_dnd_set_source_widget (priv->itembar);
@@ -282,38 +297,41 @@ panel_get_property (GObject *object,
PanelPrivate *priv = PANEL(object)->priv;
switch (prop_id)
- {
- case PROP_SIZE:
- g_value_set_int (value, priv->size);
- break;
- case PROP_MONITOR:
- g_value_set_int (value, priv->monitor);
- break;
- case PROP_SCREEN_POSITION:
- g_value_set_enum (value, priv->screen_position);
- break;
- case PROP_XOFFSET:
- g_value_set_int (value, priv->xoffset);
- break;
- case PROP_YOFFSET:
- g_value_set_int (value, priv->yoffset);
- break;
- case PROP_AUTOHIDE:
- g_value_set_boolean (value, priv->autohide);
- break;
- case PROP_FULL_WIDTH:
- g_value_set_int (value, priv->full_width);
- break;
- case PROP_TRANSPARENCY:
- g_value_set_int (value, priv->transparency);
- break;
- case PROP_ACTIVE_TRANS:
- g_value_set_boolean (value, priv->activetrans);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ {
+ case PROP_SIZE:
+ g_value_set_int (value, priv->size);
+ break;
+ case PROP_MONITOR:
+ g_value_set_int (value, priv->monitor);
+ break;
+ case PROP_SCREEN_POSITION:
+ g_value_set_enum (value, priv->screen_position);
+ break;
+ case PROP_XOFFSET:
+ g_value_set_int (value, priv->xoffset);
+ break;
+ case PROP_YOFFSET:
+ g_value_set_int (value, priv->yoffset);
+ break;
+ case PROP_AUTOHIDE:
+ g_value_set_boolean (value, priv->autohide);
+ break;
+ case PROP_FULL_WIDTH:
+ g_value_set_int (value, priv->full_width);
+ break;
+ case PROP_TRANSPARENCY:
+ g_value_set_int (value, priv->transparency);
+ break;
+ case PROP_ACTIVE_TRANS:
+ g_value_set_boolean (value, priv->activetrans);
+ break;
+ case PROP_SHOW_HIDEBUTTON:
+ g_value_set_boolean (value, priv->show_hidebutton);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
@@ -353,12 +371,205 @@ panel_set_property (GObject *object
case PROP_ACTIVE_TRANS:
panel_set_activetrans (panel, g_value_get_boolean (value));
break;
+ case PROP_SHOW_HIDEBUTTON:
+ panel_set_show_hidebutton (panel, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
+static void
+panel_unhide (Panel *panel)
+{
+ g_return_if_fail (PANEL_IS_PANEL (panel));
+ PanelPrivate *priv = panel->priv;
+
+ if (priv->panel_state == PANEL_STATE_NORMAL)
+ return;
+ priv->panel_state = PANEL_STATE_NORMAL;
+ panel_update_hide_buttons (panel);
+ gtk_widget_queue_resize (GTK_WIDGET (panel));
+}
+
+
+static void
+panel_hide (Panel *panel, gboolean auto_hide, GtkDirectionType direction)
+{
+ g_return_if_fail (PANEL_IS_PANEL (panel));
+ PanelPrivate *priv = panel->priv;
+
+ if (priv->panel_state != PANEL_STATE_NORMAL)
+ return;
+
+ if (auto_hide)
+ priv->panel_state = PANEL_STATE_AUTO_HIDDEN;
+ else {
+ if (direction == -1) {
+ if (xfce_screen_position_is_horizontal(priv->screen_position))
+ direction = GTK_DIR_RIGHT;
+ else
+ direction = GTK_DIR_DOWN;
+ }
+ switch (direction) {
+ case GTK_DIR_DOWN:
+ g_return_if_fail (!xfce_screen_position_is_horizontal(priv->screen_position));
+ priv->panel_state = PANEL_STATE_HIDDEN_DOWN;
+ break;
+ case GTK_DIR_LEFT:
+ g_return_if_fail (xfce_screen_position_is_horizontal(priv->screen_position));
+ priv->panel_state = PANEL_STATE_HIDDEN_LEFT;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ panel_update_hide_buttons (panel);
+ }
+ gtk_widget_queue_resize (GTK_WIDGET (panel));
+}
+
+static void
+panel_hide_button_clicked (Panel *panel, GtkButton *button)
+{
+ GtkArrowType arrow_type;
+ gboolean ltr;
+ PanelPrivate *priv = panel->priv;
+
+ ltr = gtk_widget_get_direction (GTK_WIDGET (panel)) == GTK_TEXT_DIR_LTR;
+ arrow_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "arrow-type"));
+ if(priv->panel_state == PANEL_STATE_NORMAL){
+ GtkDirectionType direction = -1;
+ switch (arrow_type) {
+ case GTK_ARROW_UP:
+ direction = GTK_DIR_UP;
+ break;
+ case GTK_ARROW_DOWN:
+ direction = GTK_DIR_DOWN;
+ break;
+ case GTK_ARROW_LEFT:
+ direction = ltr ? GTK_DIR_LEFT : GTK_DIR_RIGHT;
+ break;
+ case GTK_ARROW_RIGHT:
+ direction = ltr ? GTK_DIR_RIGHT : GTK_DIR_LEFT;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ panel_hide (panel, FALSE, direction);
+ }else
+ panel_unhide (panel);
+}
+
+static GtkWidget *
+panel_add_hide_button (Panel *panel,
+ GtkArrowType arrow_type,
+ int left_attach,
+ int right_attach,
+ int top_attach,
+ int bottom_attach)
+{
+ PanelPrivate *priv;
+
+ priv = panel->priv = G_TYPE_INSTANCE_GET_PRIVATE (panel,
+ PANEL_TYPE_PANEL,
+ PanelPrivate);
+ GtkWidget *button;
+ GtkWidget *arrow;
+ int arrow_size;
+
+ button = gtk_button_new ();
+ GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT);
+
+ arrow_size = DEFAULT_HIDEBUTTON_SIZE;
+
+ switch (arrow_type) {
+ case GTK_ARROW_UP:
+ gtk_widget_set_size_request (button, -1, arrow_size);
+ break;
+ case GTK_ARROW_DOWN:
+ gtk_widget_set_size_request (button, -1, arrow_size);
+ break;
+ case GTK_ARROW_LEFT:
+ gtk_widget_set_size_request (button, arrow_size, -1);
+ break;
+ case GTK_ARROW_RIGHT:
+ gtk_widget_set_size_request (button, arrow_size, -1);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ arrow = gtk_arrow_new (arrow_type, GTK_SHADOW_NONE);
+ gtk_misc_set_padding (GTK_MISC (arrow), 0, 0);
+ gtk_container_add (GTK_CONTAINER (button), arrow);
+ gtk_widget_show (arrow);
+ g_object_set_data (G_OBJECT (button),
+ "arrow-type",
+ GINT_TO_POINTER (arrow_type));
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (panel_hide_button_clicked), panel);
+ gtk_table_attach (GTK_TABLE (priv->table),
+ button,
+ left_attach,
+ right_attach,
+ top_attach,
+ bottom_attach,
+ GTK_FILL,
+ GTK_FILL,
+ 0,
+ 0);
+
+ return button;
+}
+
+static void
+panel_setup_widgets(Panel *panel)
+{
+ PanelPrivate *priv;
+
+ priv = panel->priv = G_TYPE_INSTANCE_GET_PRIVATE (panel,
+ PANEL_TYPE_PANEL,
+ PanelPrivate);
+ priv->table = gtk_table_new(3, 3, FALSE);
+
+ priv->hide_button_left =
+ panel_add_hide_button (panel, GTK_ARROW_LEFT, 0, 1, 1, 2);
+
+ priv->hide_button_right =
+ panel_add_hide_button (panel, GTK_ARROW_RIGHT, 2, 3, 1, 2);
+
+ priv->hide_button_top =
+ panel_add_hide_button (panel, GTK_ARROW_UP, 1, 2, 0, 1);
+
+ priv->hide_button_bottom =
+ panel_add_hide_button (panel, GTK_ARROW_DOWN, 1, 2, 2, 3);
+
+ if(priv->show_hidebutton){
+ if (xfce_screen_position_is_horizontal(priv->screen_position)) {
+ gtk_widget_show (priv->hide_button_left);
+ } else {
+ gtk_widget_show (priv->hide_button_bottom);
+ }
+ }
+
+ priv->itembar = xfce_itembar_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_table_attach (GTK_TABLE (priv->table),
+ GTK_WIDGET (priv->itembar),
+ 1, 2,
+ 1, 2,
+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
+ 0, 0);
+ gtk_widget_show (priv->itembar);
+
+ gtk_container_add (GTK_CONTAINER (panel), priv->table);
+ gtk_widget_show (priv->table);
+
+}
+
static void
panel_size_request (GtkWidget *widget,
GtkRequisition *requisition)
diff -uprN xfce4-panel/trunk/panel/panel-config.c xfce4-panel-new/trunk/panel/panel-config.c
--- xfce4-panel/trunk/panel/panel-config.c 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel-config.c 2008-05-10 16:15:53.000000000 +0800
@@ -215,6 +215,7 @@ struct _ConfigParser
guint autohide : 1;
gint transparency;
guint activetrans : 1;
+ guint show_hidebutton : 1;
};
static void
@@ -233,6 +234,7 @@ init_properties (ConfigParser *parser)
parser->autohide = DEFAULT_AUTOHIDE;
parser->transparency = DEFAULT_TRANSPARENCY;
parser->activetrans = DEFAULT_ACTIVE_TRANS;
+ parser->show_hidebutton = FALSE;
}
static void
@@ -240,51 +242,56 @@ config_set_property (ConfigParser *parse
const gchar *name,
const gchar *value)
{
- g_return_if_fail (name != NULL && value != NULL);
+ g_return_if_fail (name != NULL && value != NULL);
- parser->properties_set = TRUE;
+ parser->properties_set = TRUE;
+
+ if (strcmp (name, "size") == 0)
+ {
+ parser->size = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "monitor") == 0)
+ {
+ parser->monitor = (gint) strtol (value, NULL, 0);
+ parser->monitor_set = TRUE;
+ }
+ else if (strcmp (name, "screen-position") == 0)
+ {
+ parser->screen_position = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "fullwidth") == 0)
+ {
+ parser->full_width = ((gint) strtol (value, NULL, 0));
+ }
+ else if (strcmp (name, "xoffset") == 0)
+ {
+ parser->xoffset = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "yoffset") == 0)
+ {
+ parser->yoffset = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "handlestyle") == 0)
+ {
+ parser->handle_style = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "autohide") == 0)
+ {
+ parser->autohide = ((gint) strtol (value, NULL, 0) == 1);
+ }
+ else if (strcmp (name, "transparency") == 0)
+ {
+ parser->transparency = (gint) strtol (value, NULL, 0);
+ }
+ else if (strcmp (name, "activetrans") == 0)
+ {
+ parser->activetrans = ((gint) strtol (value, NULL, 0) == 1);
+ }
+ else if (strcmp (name, "show-hidebutton") == 0)
+ {
+ parser->show_hidebutton = ((int) strtol (value, NULL, 0) == 1);
+ }
- if (strcmp (name, "size") == 0)
- {
- parser->size = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "monitor") == 0)
- {
- parser->monitor = (gint) strtol (value, NULL, 0);
- parser->monitor_set = TRUE;
- }
- else if (strcmp (name, "screen-position") == 0)
- {
- parser->screen_position = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "fullwidth") == 0)
- {
- parser->full_width = ((gint) strtol (value, NULL, 0));
- }
- else if (strcmp (name, "xoffset") == 0)
- {
- parser->xoffset = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "yoffset") == 0)
- {
- parser->yoffset = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "handlestyle") == 0)
- {
- parser->handle_style = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "autohide") == 0)
- {
- parser->autohide = ((gint) strtol (value, NULL, 0) == 1);
- }
- else if (strcmp (name, "transparency") == 0)
- {
- parser->transparency = (gint) strtol (value, NULL, 0);
- }
- else if (strcmp (name, "activetrans") == 0)
- {
- parser->activetrans = ((gint) strtol (value, NULL, 0) == 1);
- }
}
static void
@@ -452,6 +459,7 @@ end_element_handler (GMarkupParseContext
"autohide", parser->autohide,
"transparency", parser->transparency,
"activetrans", parser->activetrans,
+ "show-hidebutton", parser->show_hidebutton,
NULL);
}
MARK(" ++ end properties");
@@ -659,6 +667,8 @@ config_save_to_file (GPtrArray *array,
gint transparency = 0;
gboolean autohide = FALSE;
gboolean activetrans = FALSE;
+ gboolean show_hidebutton = FALSE;
+
Panel *panel;
GList *configlist, *l;
XfcePanelItem *item;
@@ -678,6 +688,7 @@ config_save_to_file (GPtrArray *array,
"autohide", &autohide,
"transparency", &transparency,
"activetrans", &activetrans,
+ "show-hidebutton", &show_hidebutton,
NULL);
/* grouping */
@@ -715,6 +726,9 @@ config_save_to_file (GPtrArray *array,
fprintf (fp, "\t\t\t<property name=\"activetrans\" value=\"%d\"/>\n",
activetrans);
+ fprintf (fp, "\t\t\t<property name=\"show-hidebutton\" value=\"%d\"/>\n",
+ show_hidebutton);
+
/* grouping */
fprintf (fp, "\t\t</properties>\n"
"\t\t<items>\n");
diff -uprN xfce4-panel/trunk/panel/panel-dialogs.c xfce4-panel-new/trunk/panel/panel-dialogs.c
--- xfce4-panel/trunk/panel/panel-dialogs.c 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel-dialogs.c 2008-05-10 16:15:54.000000000 +0800
@@ -102,6 +102,7 @@ struct _PanelManagerDialog
GtkWidget *fullwidth;
gint n_width_items;
GtkWidget *autohide;
+ GtkWidget *show_hidebutton;
GtkWidget *floating_box;
GtkWidget *orientation;
@@ -734,6 +735,9 @@ update_widgets (PanelManagerDialog *pmd)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->autohide),
priv->autohide);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->show_hidebutton),
+ priv->show_hidebutton);
+
/* position */
if (!xfce_screen_position_is_floating (priv->screen_position))
{
@@ -937,6 +941,15 @@ autohide_changed (GtkToggleButton *tb
}
static void
+show_hidebutton_changed (GtkToggleButton *tb, PanelManagerDialog *pmd)
+{
+ if (pmd->updating)
+ return;
+ panel_set_show_hidebutton (pmd->panel, gtk_toggle_button_get_active (tb));
+}
+
+
+static void
orientation_changed (GtkComboBox *box,
PanelManagerDialog *pmd)
{
@@ -993,227 +1006,237 @@ static void
add_position_options (GtkBox *box,
PanelManagerDialog *pmd)
{
- GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label, *sep;
- GtkSizeGroup *sg;
- gint i;
-
- /* position */
- frame = xfce_create_framebox (_("Position"), &align);
- gtk_widget_show (frame);
- gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, BORDER);
- gtk_widget_show (vbox2);
- gtk_container_add (GTK_CONTAINER (align), vbox2);
-
- /* type */
- hbox = gtk_hbox_new (FALSE, BORDER);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
-
- pmd->fixed =
- gtk_radio_button_new_with_label (NULL, _("Fixed Position"));
- gtk_widget_show (pmd->fixed);
- gtk_box_pack_start (GTK_BOX (hbox), pmd->fixed, FALSE, FALSE, 0);
-
- pmd->floating =
- gtk_radio_button_new_with_label_from_widget (
- GTK_RADIO_BUTTON (pmd->fixed), _("Freely Moveable"));
- gtk_widget_show (pmd->floating);
- gtk_box_pack_start (GTK_BOX (hbox), pmd->floating, FALSE, FALSE, 0);
-
- g_signal_connect (G_OBJECT (pmd->fixed), "toggled",
- G_CALLBACK (type_changed), pmd);
-
- g_signal_connect (G_OBJECT (pmd->floating), "toggled",
- G_CALLBACK (type_changed), pmd);
-
- sep = gtk_hseparator_new ();
- gtk_widget_show (sep);
- gtk_box_pack_start (GTK_BOX (vbox2), sep, FALSE, FALSE, 0);
-
- /* fixed */
- pmd->fixed_box = hbox = gtk_hbox_new (FALSE, BORDER);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
-
- /* fixed: position */
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (vbox);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-
- table = gtk_table_new (5, 5, FALSE);
- gtk_widget_show (table);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_widget_show (align);
- gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
-
- for (i = 0; i < 12; ++i)
- {
- pmd->screen_position[i] = gtk_toggle_button_new ();
- gtk_widget_show (pmd->screen_position[i]);
-
- if (i <= 2 || i >= 9)
- gtk_widget_set_size_request (pmd->screen_position[i], 30, 15);
- else
- gtk_widget_set_size_request (pmd->screen_position[i], 15, 25);
-
- g_signal_connect (G_OBJECT (pmd->screen_position[i]), "button-press-event",
- G_CALLBACK (screen_position_pressed), pmd);
-
- g_signal_connect (G_OBJECT (pmd->screen_position[i]), "key-press-event",
- G_CALLBACK (screen_position_pressed), pmd);
- }
-
- /* fixed:postion:top */
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[0],
- 1, 2, 0, 1);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[1],
- 2, 3, 0, 1);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[2],
- 3, 4, 0, 1);
-
- /* fixed:postion:left */
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[3],
- 0, 1, 1, 2);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[4],
- 0, 1, 2, 3);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[5],
- 0, 1, 3, 4);
-
- /* fixed:postion:right */
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[6],
- 4, 5, 1, 2);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[7],
- 4, 5, 2, 3);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[8],
- 4, 5, 3, 4);
-
- /* fixed:postion:bottom */
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[9],
- 1, 2, 4, 5);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[10],
- 2, 3, 4, 5);
-
- gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[11],
- 3, 4, 4, 5);
-
- /* fixed:full width */
- vbox = gtk_vbox_new (FALSE, BORDER);
- gtk_widget_show (vbox);
- gtk_box_pack_start (GTK_BOX (pmd->fixed_box), vbox, TRUE, TRUE, 0);
-
- pmd->fullwidth = gtk_combo_box_new_text ();
- gtk_widget_show (pmd->fullwidth);
- gtk_box_pack_start (GTK_BOX (vbox), pmd->fullwidth, FALSE, FALSE, 0);
-
- if (panel_is_horizontal (pmd->panel))
- {
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Normal Width"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Full Width"));
- }
- else
- {
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Normal Height"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Full Height"));
- }
-
-
- pmd->n_width_items = 2;
- if (can_span_monitors (pmd->panel))
- {
- pmd->n_width_items = 3;
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
- _("Span Monitors"));
- }
-
- g_signal_connect (G_OBJECT (pmd->fullwidth), "changed",
- G_CALLBACK (fullwidth_changed), pmd);
-
- /* fixed:autohide */
- pmd->autohide =
- gtk_check_button_new_with_mnemonic (_("Auto_hide"));
- gtk_widget_show (pmd->autohide);
- gtk_box_pack_start (GTK_BOX (vbox), pmd->autohide, FALSE, FALSE, 0);
-
- g_signal_connect (G_OBJECT (pmd->autohide), "toggled",
- G_CALLBACK (autohide_changed), pmd);
-
- /* floating */
- pmd->floating_box = vbox = gtk_vbox_new (FALSE, BORDER);
- /* don't show by default */
- gtk_box_pack_start (GTK_BOX (vbox2), vbox, TRUE, TRUE, 0);
-
- sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- hbox = gtk_hbox_new (FALSE, BORDER);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- label = gtk_label_new (_("Orientation:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- gtk_size_group_add_widget (sg, label);
-
- pmd->orientation = gtk_combo_box_new_text ();
- gtk_widget_show (pmd->orientation);
- gtk_box_pack_start (GTK_BOX (hbox), pmd->orientation, TRUE, TRUE, 0);
-
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
- _("Horizontal"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
- _("Vertical"));
-
- g_signal_connect (G_OBJECT (pmd->orientation), "changed",
- G_CALLBACK (orientation_changed), pmd);
-
- hbox = gtk_hbox_new (FALSE, BORDER);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- label = gtk_label_new (_("Handle:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- gtk_size_group_add_widget (sg, label);
-
- pmd->handle_style = gtk_combo_box_new_text ();
- gtk_widget_show (pmd->handle_style);
- gtk_box_pack_start (GTK_BOX (hbox), pmd->handle_style, TRUE, TRUE, 0);
-
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
- _("At both sides"));
- if (panel_is_horizontal (pmd->panel))
- {
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
- _("Left"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
- _("Right"));
- }
- else
- {
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
- _("Top"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
- _("Bottom"));
- }
+ GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label, *sep;
+ GtkSizeGroup *sg;
+ gint i;
+
+ /* position */
+ frame = xfce_create_framebox (_("Position"), &align);
+ gtk_widget_show (frame);
+ gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
+
+ vbox2 = gtk_vbox_new (FALSE, BORDER);
+ gtk_widget_show (vbox2);
+ gtk_container_add (GTK_CONTAINER (align), vbox2);
+
+ /* type */
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
+
+ pmd->fixed =
+ gtk_radio_button_new_with_label (NULL, _("Fixed Position"));
+ gtk_widget_show (pmd->fixed);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->fixed, FALSE, FALSE, 0);
+
+ pmd->floating =
+ gtk_radio_button_new_with_label_from_widget (
+ GTK_RADIO_BUTTON (pmd->fixed), _("Freely Moveable"));
+ gtk_widget_show (pmd->floating);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->floating, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (pmd->fixed), "toggled",
+ G_CALLBACK (type_changed), pmd);
+
+ g_signal_connect (G_OBJECT (pmd->floating), "toggled",
+ G_CALLBACK (type_changed), pmd);
+
+ sep = gtk_hseparator_new ();
+ gtk_widget_show (sep);
+ gtk_box_pack_start (GTK_BOX (vbox2), sep, FALSE, FALSE, 0);
+
+ /* fixed */
+ pmd->fixed_box = hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
+
+ /* fixed: position */
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+
+ table = gtk_table_new (5, 5, FALSE);
+ gtk_widget_show (table);
+ gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+
+ align = gtk_alignment_new (0, 0, 0, 0);
+ gtk_widget_show (align);
+ gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+
+ for (i = 0; i < 12; ++i)
+ {
+ pmd->screen_position[i] = gtk_toggle_button_new ();
+ gtk_widget_show (pmd->screen_position[i]);
+
+ if (i <= 2 || i >= 9)
+ gtk_widget_set_size_request (pmd->screen_position[i], 30, 15);
+ else
+ gtk_widget_set_size_request (pmd->screen_position[i], 15, 25);
+
+ g_signal_connect (G_OBJECT (pmd->screen_position[i]), "button-press-event",
+ G_CALLBACK (screen_position_pressed), pmd);
+
+ g_signal_connect (G_OBJECT (pmd->screen_position[i]), "key-press-event",
+ G_CALLBACK (screen_position_pressed), pmd);
+ }
+
+ /* fixed:postion:top */
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[0],
+ 1, 2, 0, 1);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[1],
+ 2, 3, 0, 1);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[2],
+ 3, 4, 0, 1);
+
+ /* fixed:postion:left */
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[3],
+ 0, 1, 1, 2);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[4],
+ 0, 1, 2, 3);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[5],
+ 0, 1, 3, 4);
+
+ /* fixed:postion:right */
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[6],
+ 4, 5, 1, 2);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[7],
+ 4, 5, 2, 3);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[8],
+ 4, 5, 3, 4);
+
+ /* fixed:postion:bottom */
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[9],
+ 1, 2, 4, 5);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[10],
+ 2, 3, 4, 5);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[11],
+ 3, 4, 4, 5);
+
+ /* fixed:full width */
+ vbox = gtk_vbox_new (FALSE, BORDER);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (pmd->fixed_box), vbox, TRUE, TRUE, 0);
+
+ pmd->fullwidth = gtk_combo_box_new_text ();
+ gtk_widget_show (pmd->fullwidth);
+ gtk_box_pack_start (GTK_BOX (vbox), pmd->fullwidth, FALSE, FALSE, 0);
+
+ if (panel_is_horizontal (pmd->panel))
+ {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Normal Width"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Full Width"));
+ }
+ else
+ {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Normal Height"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth), _("Full Height"));
+ }
+
+
+ pmd->n_width_items = 2;
+ if (can_span_monitors (pmd->panel))
+ {
+ pmd->n_width_items = 3;
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
+ _("Span Monitors"));
+ }
+
+ g_signal_connect (G_OBJECT (pmd->fullwidth), "changed",
+ G_CALLBACK (fullwidth_changed), pmd);
+
+ /* fixed:autohide */
+ pmd->autohide =
+ gtk_check_button_new_with_mnemonic (_("Auto_hide"));
+ gtk_widget_show (pmd->autohide);
+ gtk_box_pack_start (GTK_BOX (vbox), pmd->autohide, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (pmd->autohide), "toggled",
+ G_CALLBACK (autohide_changed), pmd);
+
+ /* fixed:show hide button*/
+ pmd->show_hidebutton =
+ gtk_check_button_new_with_mnemonic (_("Show_hide_Button"));
+ gtk_widget_show (pmd->show_hidebutton);
+ gtk_box_pack_start (GTK_BOX (vbox), pmd->show_hidebutton, FALSE, FALSE, 0);
+
+ g_signal_connect (pmd->show_hidebutton, "toggled",
+ G_CALLBACK (show_hidebutton_changed), pmd);
+
+
+ /* floating */
+ pmd->floating_box = vbox = gtk_vbox_new (FALSE, BORDER);
+ /* don't show by default */
+ gtk_box_pack_start (GTK_BOX (vbox2), vbox, TRUE, TRUE, 0);
+
+ sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Orientation:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ gtk_size_group_add_widget (sg, label);
+
+ pmd->orientation = gtk_combo_box_new_text ();
+ gtk_widget_show (pmd->orientation);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->orientation, TRUE, TRUE, 0);
+
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
+ _("Horizontal"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
+ _("Vertical"));
+
+ g_signal_connect (G_OBJECT (pmd->orientation), "changed",
+ G_CALLBACK (orientation_changed), pmd);
+
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Handle:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ gtk_size_group_add_widget (sg, label);
+
+ pmd->handle_style = gtk_combo_box_new_text ();
+ gtk_widget_show (pmd->handle_style);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->handle_style, TRUE, TRUE, 0);
+
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ _("At both sides"));
+ if (panel_is_horizontal (pmd->panel))
+ {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ _("Left"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ _("Right"));
+ }
+ else
+ {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ _("Top"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ _("Bottom"));
+ }
- g_signal_connect (G_OBJECT (pmd->handle_style), "changed",
- G_CALLBACK (handle_style_changed), pmd);
+ g_signal_connect (G_OBJECT (pmd->handle_style), "changed",
+ G_CALLBACK (handle_style_changed), pmd);
- g_object_unref (G_OBJECT (sg));
+ g_object_unref (G_OBJECT (sg));
}
/* monitors */
diff -uprN xfce4-panel/trunk/panel/panel-private.h xfce4-panel-new/trunk/panel/panel-private.h
--- xfce4-panel/trunk/panel/panel-private.h 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel-private.h 2008-05-10 16:15:54.000000000 +0800
@@ -36,9 +36,24 @@
#define DEFAULT_FULL_WIDTH XFCE_PANEL_NORMAL_WIDTH
#define DEFAULT_TRANSPARENCY 20
#define DEFAULT_ACTIVE_TRANS FALSE
+#define DEFAULT_SHOW_HIDEBUTTON FALSE
+#define DEFAULT_HIDEBUTTON_SIZE 24
+#define DEFAULT_PANEL_STATE PANEL_STATE_NORMAL
+
#define PANEL_GET_PRIVATE(o) (PANEL(o)->priv)
+typedef enum {
+ PANEL_STATE_NORMAL = 0, /* not hidden state*/
+ PANEL_STATE_AUTO_HIDDEN = 1,
+ PANEL_STATE_HIDDEN_UP = 2, /* hidden to the top corner, not used at this time*/
+ PANEL_STATE_HIDDEN_DOWN = 3, /* hidden to the bottom corner */
+ PANEL_STATE_HIDDEN_LEFT = 4, /* hidden to the left corner */
+ PANEL_STATE_HIDDEN_RIGHT = 5 /* hidden to the right corner, not used at this time */
+}
+XfcePanelState;
+
+
typedef struct _PanelPrivate PanelPrivate;
typedef enum
@@ -51,31 +66,40 @@ XfcePanelWidthType;
struct _PanelPrivate
{
- GtkWidget *itembar;
- GtkWidget *menu;
-
- gint size;
- gint monitor;
- XfceScreenPosition screen_position;
- gint xoffset;
- gint yoffset;
- XfcePanelWidthType full_width;
- gint transparency;
-
- guint opacity;
- guint saved_opacity;
-
- gint block_autohide;
- gint hide_timeout;
- gint unhide_timeout;
-
- /* booleans */
- guint autohide : 1;
- guint activetrans : 1;
- guint hidden : 1;
- guint edit_mode : 1;
+ GtkWidget *table;
+ GtkWidget *itembar;
+ GtkWidget *hide_button_left;
+ GtkWidget *hide_button_right;
+ GtkWidget *hide_button_bottom;
+ GtkWidget *hide_button_top;
+ GtkWidget *menu;
+
+ gint size;
+ gint monitor;
+ XfceScreenPosition screen_position;
+ gint xoffset;
+ gint yoffset;
+ XfcePanelWidthType full_width;
+ gint transparency;
+
+ guint opacity;
+ guint saved_opacity;
+
+ XfcePanelState panel_state;
+ gboolean show_hidebutton;
+
+
+ gint block_autohide;
+ gint hide_timeout;
+ gint unhide_timeout;
+
+ /* booleans */
+ guint autohide : 1;
+ guint activetrans : 1;
+ guint hidden : 1;
+ guint edit_mode : 1;
- gulong struts[12];
+ gulong struts[12];
};
#endif /* !__PANEL_PRIVATE_H__ */
diff -uprN xfce4-panel/trunk/panel/panel-properties.c xfce4-panel-new/trunk/panel/panel-properties.c
--- xfce4-panel/trunk/panel/panel-properties.c 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel-properties.c 2008-05-10 16:15:55.000000000 +0800
@@ -72,6 +72,46 @@ static void panel_leave
/* moving and resizing */
+ static void
+ _calculate_coordinates_after_hide (Panel *panel,
+ GdkRectangle *screen, /* monitor geometry */
+ int width,
+ int height,
+ int *x,
+ int *y)
+{
+ PanelPrivate *priv = panel->priv;
+ XfcePanelState panel_state = priv->panel_state;
+
+ gint hide_button_width, hide_button_height;
+
+ switch (panel_state)
+ {
+ case PANEL_STATE_HIDDEN_LEFT:
+ gtk_widget_get_size_request (priv->hide_button_left,
+ &hide_button_width,
+ &hide_button_height);
+ *x = screen->x -width + hide_button_width +
+ ((priv->full_width != XFCE_PANEL_FULL_WIDTH)?GTK_WIDGET(panel)->style->xthickness:0);
+ break;
+
+ case PANEL_STATE_HIDDEN_DOWN:
+ gtk_widget_get_size_request (priv->hide_button_bottom,
+ &hide_button_width,
+ &hide_button_height);
+ *y = screen->y + screen->height - hide_button_height -
+ ((priv->full_width != XFCE_PANEL_FULL_WIDTH) ? GTK_WIDGET(panel)->style->ythickness : 0);
+ break;
+ case PANEL_STATE_HIDDEN_UP:
+ case PANEL_STATE_HIDDEN_RIGHT:
+ /*not used at this time*/
+ break;
+ default:
+ break;
+ }
+}
+
+
static void
_calculate_coordinates (XfceScreenPosition position, /* screen position */
GdkRectangle *screen, /* monitor geometry */
@@ -285,7 +325,8 @@ _set_struts (Panel *panel,
return;
if (!priv->autohide &&
- !xfce_screen_position_is_floating (priv->screen_position))
+ !xfce_screen_position_is_floating (priv->screen_position) &&
+ (priv->panel_state == PANEL_STATE_NORMAL ))
{
if (xfce_screen_position_is_left (priv->screen_position))
{
@@ -483,32 +524,50 @@ panel_resize_function (XfcePanelWindow *
xmon = panel_app_get_monitor (priv->monitor);
if (priv->full_width < XFCE_PANEL_SPAN_MONITORS)
- {
- _calculate_coordinates (priv->screen_position,
- &(xmon->geometry),
- alloc_new->width,
- alloc_new->height,
- x, y);
-
- priv->xoffset = *x - xmon->geometry.x;
- priv->yoffset = *y - xmon->geometry.y;
- }
+ {
+ if(priv->panel_state == PANEL_STATE_NORMAL)
+ _calculate_coordinates (priv->screen_position,
+ &(xmon->geometry),
+ alloc_new->width,
+ alloc_new->height,
+ x, y);
+ else
+ _calculate_coordinates_after_hide (panel,
+ &(xmon->geometry),
+ alloc_new->width,
+ alloc_new->height,
+ x,
+ y);
+
+ priv->xoffset = *x - xmon->geometry.x;
+ priv->yoffset = *y - xmon->geometry.y;
+ }
else
- {
- rect.x = 0;
- rect.y = 0;
- rect.width = gdk_screen_get_width (xmon->screen);
- rect.height = gdk_screen_get_height (xmon->screen);
-
- _calculate_coordinates (priv->screen_position,
- &rect,
- alloc_new->width,
- alloc_new->height,
- x, y);
-
- priv->xoffset = *x;
- priv->yoffset = *y;
- }
+ {
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = gdk_screen_get_width (xmon->screen);
+ rect.height = gdk_screen_get_height (xmon->screen);
+
+
+ if(priv->panel_state == PANEL_STATE_NORMAL)
+ _calculate_coordinates (priv->screen_position,
+ &rect,
+ alloc_new->width,
+ alloc_new->height,
+ x, y);
+ else
+ _calculate_coordinates_after_hide (panel,
+ &rect,
+ alloc_new->width,
+ alloc_new->height,
+ x,
+ y);
+
+
+ priv->xoffset = *x;
+ priv->yoffset = *y;
+ }
_set_struts (panel, xmon, *x, *y, alloc_new->width, alloc_new->height);
}
@@ -590,6 +649,43 @@ panel_set_position (Panel *
gtk_window_move (GTK_WINDOW (panel), x, y);
_set_struts (panel, xmon, x, y, req.width, req.height);
+ panel_update_hide_buttons(panel);
+}
+
+void panel_update_hide_buttons(Panel *panel)
+{
+ PanelPrivate *priv = panel->priv;
+ if((xfce_screen_position_is_floating (priv->screen_position))||(!priv->show_hidebutton)){
+ gtk_widget_hide (priv->hide_button_bottom);
+ gtk_widget_hide (priv->hide_button_left);
+ gtk_widget_hide (priv->hide_button_top);
+ }else
+ switch(priv->panel_state){
+ case PANEL_STATE_NORMAL:
+ if (xfce_screen_position_is_horizontal(priv->screen_position)) {
+ gtk_widget_show (priv->hide_button_left);
+ gtk_widget_hide (priv->hide_button_right);
+ gtk_widget_hide (priv->hide_button_bottom);
+ gtk_widget_hide (priv->hide_button_top);
+ } else {
+ gtk_widget_show (priv->hide_button_bottom);
+ gtk_widget_hide (priv->hide_button_top);
+ gtk_widget_hide (priv->hide_button_left);
+ }
+ break;
+ case PANEL_STATE_HIDDEN_LEFT:
+ gtk_widget_hide (priv->hide_button_left);
+ gtk_widget_show (priv->hide_button_right);
+ gtk_widget_hide (priv->hide_button_bottom);
+ gtk_widget_hide (priv->hide_button_top);
+ break;
+ case PANEL_STATE_HIDDEN_DOWN:
+ gtk_widget_show (priv->hide_button_top);
+ gtk_widget_hide (priv->hide_button_bottom);
+ gtk_widget_hide (priv->hide_button_left);
+ default:
+ break;
+ }
}
/* screen size */
@@ -1341,6 +1437,30 @@ panel_get_monitor (Panel *panel)
}
void
+panel_set_show_hidebutton(Panel *panel,
+ gboolean show_hidebutton)
+{
+ PanelPrivate *priv = panel->priv;
+ if(show_hidebutton != priv->show_hidebutton)
+ {
+ priv->show_hidebutton = show_hidebutton;
+ panel_update_hide_buttons(panel);
+ }
+}
+
+gboolean
+panel_get_show_hidebutton (Panel *panel)
+{
+ PanelPrivate *priv;
+
+ g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_SHOW_HIDEBUTTON);
+
+ priv = panel->priv;
+ return priv->show_hidebutton;
+}
+
+
+void
panel_set_monitor (Panel *panel,
gint monitor)
{
@@ -1475,7 +1595,8 @@ panel_set_screen_position (Panel
/* update itembar size request */
panel_set_size (panel, priv->size);
-
+
+ panel_update_hide_buttons(panel);
gtk_widget_queue_resize (GTK_WIDGET (panel));
g_idle_add((GSourceFunc)unblock_struts, panel);
diff -uprN xfce4-panel/trunk/panel/panel-properties.h xfce4-panel-new/trunk/panel/panel-properties.h
--- xfce4-panel/trunk/panel/panel-properties.h 2008-05-10 16:14:04.000000000 +0800
+++ xfce4-panel-new/trunk/panel/panel-properties.h 2008-05-10 16:15:55.000000000 +0800
@@ -37,6 +37,11 @@ gint panel_get_monitor (Panel *panel);
void panel_set_monitor (Panel *panel, gint monitor);
+gboolean panel_get_show_hidebutton (Panel *panel);
+
+void panel_set_show_hidebutton(Panel *panel,
+ gboolean show_hidebutton);
+
XfceScreenPosition panel_get_screen_position (Panel *panel);
@@ -81,6 +86,9 @@ void panel_set_transparency (Panel *pane
void panel_set_activetrans (Panel *panel,
gboolean activetrans);
+void panel_update_hide_buttons (Panel *panel);
+
+
G_END_DECLS
#endif /* !__PANEL_POSITION_H__ */
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits at xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits
----- End forwarded message -----
More information about the Xfce4-dev
mailing list