[Goodies-commits] r2310 - in xfce4-wavelan-plugin/trunk: . panel-plugin

James Westby jamesw at xfce.org
Sun Jan 7 18:21:52 CET 2007


Author: jamesw
Date: 2007-01-07 17:21:51 +0000 (Sun, 07 Jan 2007)
New Revision: 2310

Modified:
   xfce4-wavelan-plugin/trunk/ChangeLog
   xfce4-wavelan-plugin/trunk/NEWS
   xfce4-wavelan-plugin/trunk/panel-plugin/wavelan.c
Log:
Add an option to make the panel plugin icon square.


Modified: xfce4-wavelan-plugin/trunk/ChangeLog
===================================================================
--- xfce4-wavelan-plugin/trunk/ChangeLog	2007-01-07 13:34:55 UTC (rev 2309)
+++ xfce4-wavelan-plugin/trunk/ChangeLog	2007-01-07 17:21:51 UTC (rev 2310)
@@ -1,3 +1,7 @@
+2007-01-07 16:49  james
+
+	* Add an option to make the panel icon square.
+
 2006-12-21 22:23  james
 
 	* Add a THANKS file for people who contribute to the plugin.

Modified: xfce4-wavelan-plugin/trunk/NEWS
===================================================================
--- xfce4-wavelan-plugin/trunk/NEWS	2007-01-07 13:34:55 UTC (rev 2309)
+++ xfce4-wavelan-plugin/trunk/NEWS	2007-01-07 17:21:51 UTC (rev 2310)
@@ -1,3 +1,8 @@
+20060911:
+---------
+  * Version 0.5.3
+  * Fix a typo that referenced the wrong executable in the .desktop file.
+
 20060810:
 ---------
   * Version 0.5.2

Modified: xfce4-wavelan-plugin/trunk/panel-plugin/wavelan.c
===================================================================
--- xfce4-wavelan-plugin/trunk/panel-plugin/wavelan.c	2007-01-07 13:34:55 UTC (rev 2309)
+++ xfce4-wavelan-plugin/trunk/panel-plugin/wavelan.c	2007-01-07 17:21:51 UTC (rev 2310)
@@ -64,6 +64,7 @@
 
   gboolean autohide;
   gboolean autohide_missing;
+  gboolean square_icon;
 
   int size;
   GtkOrientation orientation;
@@ -109,7 +110,7 @@
 static void
 wavelan_load_pixbufs(t_wavelan *wavelan)
 {
-  int n, w, h;
+  int n, w, h, second_dim;
 
   TRACE ("Entered wavelan_load_pixbufs, size = %d", wavelan->size);
 
@@ -122,15 +123,25 @@
   }
 
   /*
+   * Make it square if desired.
+   */
+  if (wavelan->square_icon) {
+    second_dim = wavelan->size;
+  }
+  else {
+    second_dim = -1;
+  }
+
+  /*
    * Determine dimension
    */
   if (wavelan->orientation == GTK_ORIENTATION_HORIZONTAL) {
-    w = -1;
+    w = second_dim;
     h = wavelan->size;
   }
   else {
     w = wavelan->size;
-    h = -1;
+    h = second_dim;
   }
 
   /*
@@ -277,6 +288,7 @@
       
       wavelan->autohide = xfce_rc_read_bool_entry (rc, "Autohide", FALSE);
       wavelan->autohide_missing = xfce_rc_read_bool_entry(rc, "AutohideMissing", FALSE);
+      wavelan->square_icon = xfce_rc_read_bool_entry(rc, "SquareIcon", FALSE);
     }
   }
   
@@ -297,6 +309,8 @@
   wavelan->autohide = FALSE;
   wavelan->autohide_missing = FALSE;
 
+  wavelan->square_icon = FALSE;
+
   wavelan->plugin = plugin;
   
   wavelan->size = xfce_panel_plugin_get_size (plugin);
@@ -396,6 +410,7 @@
   }
   xfce_rc_write_bool_entry (rc, "Autohide", wavelan->autohide);
   xfce_rc_write_bool_entry (rc, "AutohideMissing", wavelan->autohide_missing);
+  xfce_rc_write_bool_entry (rc, "SquareIcon", wavelan->square_icon);
 
   xfce_rc_close(rc);
   
@@ -416,6 +431,14 @@
   gtk_widget_set_size_request (wavelan->box, -1, -1);
 }
 
+static void
+wavelan_set_square_icon(t_wavelan *wavelan, gboolean square_icon)
+{
+  wavelan->square_icon = square_icon;
+  wavelan_load_pixbufs(wavelan);
+  gtk_widget_set_size_request (wavelan->box, -1, -1);
+}
+
 /* interface changed callback */
 static void
 wavelan_interface_changed(GtkEntry *entry, t_wavelan *wavelan)
@@ -444,6 +467,14 @@
   wavelan_set_state(wavelan, wavelan->state);
 }
 
+/* square icon callback */
+static void 
+wavelan_square_icon_changed(GtkToggleButton *button, t_wavelan *wavelan)
+{
+  TRACE ("Entered wavelan_square_icon_changed");
+  wavelan_set_square_icon(wavelan, gtk_toggle_button_get_active(button));
+}
+
 /* query installed devices */
 static GList*
 wavelan_query_interfaces (void)
@@ -490,7 +521,7 @@
 wavelan_create_options (XfcePanelPlugin *plugin, t_wavelan *wavelan)
 {
   GtkWidget *dlg, *hbox, *label, *interface, *vbox, *autohide;
-  GtkWidget *autohide_missing, *header, *warn_label;
+  GtkWidget *autohide_missing, *header, *warn_label, *square_icon;
   GtkWidget *combo;
   GList     *interfaces, *lp;
 
@@ -577,6 +608,17 @@
   gtk_box_pack_start(GTK_BOX(hbox), warn_label, TRUE, TRUE, 1);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 1);
 
+  hbox = gtk_hbox_new(FALSE, 2);
+  gtk_widget_show(hbox);
+  square_icon = gtk_check_button_new_with_label(_("Use a square icon"));
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(square_icon), 
+      wavelan->square_icon);
+  g_signal_connect(square_icon, "toggled", 
+      G_CALLBACK(wavelan_square_icon_changed), wavelan);
+  gtk_widget_show(square_icon);
+  gtk_box_pack_start(GTK_BOX(hbox), square_icon, TRUE, TRUE, 1);
+  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 1);
+
   for (lp = interfaces; lp != NULL; lp = lp ->next)
     g_free (lp->data);
   g_list_free (interfaces);




More information about the Goodies-commits mailing list