[Xfce4-commits] <xfce4-mpc-plugin:master> Better compliance with the panel plugin HIG

Landry Breuil noreply at xfce.org
Sat Jun 23 09:42:01 CEST 2012


Updating branch refs/heads/master
         to cb6b7aabc10e013d90933b789abc01786ddfd6e1 (commit)
       from 01681240454d90363a87c3f605209034d19bbe3c (commit)

commit cb6b7aabc10e013d90933b789abc01786ddfd6e1
Author: Landry Breuil <landry at xfce.org>
Date:   Sat Jun 23 09:39:28 2012 +0200

    Better compliance with the panel plugin HIG
    
    - call mpc_set_size in frame-toggled callback
    - compute border width depending on size and frame being displayed
    - resize image accordingly (size - 2 * border_width)

 panel-plugin/xfce4-mpc-plugin.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/xfce4-mpc-plugin.c b/panel-plugin/xfce4-mpc-plugin.c
index b113491..7c08403 100644
--- a/panel-plugin/xfce4-mpc-plugin.c
+++ b/panel-plugin/xfce4-mpc-plugin.c
@@ -78,13 +78,14 @@ mpc_set_orientation (XfcePanelPlugin * plugin, GtkOrientation orientation, t_mpc
 static gboolean
 mpc_set_size (XfcePanelPlugin * plugin, int size, t_mpc * mpc)
 {
+   int border_width = (size > 26 && mpc->show_frame ? 1 : 0);
 #ifdef HAS_PANEL_49
     size /= xfce_panel_plugin_get_nrows (plugin);
 #endif
 
    DBG ("size=%d",size);
-   gtk_container_set_border_width (GTK_CONTAINER (mpc->frame), (size > 26 && mpc->show_frame ? 2 : 0));
-
+   gtk_container_set_border_width (GTK_CONTAINER (mpc->frame), border_width);
+   size -= 2 * border_width;
    gtk_widget_set_size_request (GTK_WIDGET (mpc->next), size, size);
    gtk_widget_set_size_request (GTK_WIDGET (mpc->prev), size, size);
    gtk_widget_set_size_request (GTK_WIDGET (mpc->stop), size, size);
@@ -248,7 +249,7 @@ mpc_dialog_show_frame_toggled (GtkWidget *w, t_mpc_dialog *dialog)
    size = xfce_panel_plugin_get_size(mpc->plugin);
    mpc->show_frame = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbox_frame));
    gtk_frame_set_shadow_type (GTK_FRAME (mpc->frame), (mpc->show_frame) ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
-   gtk_container_set_border_width (GTK_CONTAINER (mpc->frame), (size > 26 && mpc->show_frame ? 2 : 0));
+   mpc_set_size(mpc->plugin, size, mpc);
 }
 
 static void


More information about the Xfce4-commits mailing list