[Xfce4-commits] [panel-plugins/xfce4-mount-plugin] 01/01: - Support Gtk 3.22 - Version 1.1.0 for release - Bugfix with several spaces in mountpoint names - Works with fuseblk devices by using umount for them instead of fusermount

noreply at xfce.org noreply at xfce.org
Sat Jan 28 16:17:27 CET 2017


This is an automated email from the git hooks/post-receive script.

timystery pushed a commit to branch master
in repository panel-plugins/xfce4-mount-plugin.

commit 9a144a358ab7b00ebd1f0cef19ca4bbe400f27ea
Author: Fabian <timystery at arcor.de>
Date:   Sat Jan 28 16:16:07 2017 +0100

    - Support Gtk 3.22
    - Version 1.1.0 for release
    - Bugfix with several spaces in mountpoint names
    - Works with fuseblk devices by using umount for them instead of fusermount
---
 NEWS                        |  7 ++++++-
 README                      |  4 ++--
 configure.ac.in             |  4 ++--
 panel-plugin/devices.c      |  9 ++++-----
 panel-plugin/devices.h      |  8 ++++----
 panel-plugin/helpers.c      | 40 +++++++++++++++++++++-------------------
 panel-plugin/mount-plugin.c | 11 +++++------
 7 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/NEWS b/NEWS
index 207f5f5..2b93490 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,9 @@
-2016/05/29 - Versoin 1.0.0
+2017/01/28 - Version 1.1.0
+- Gtk 3.22 supported
+- Allow several spaces in mountpoint names
+- Support fuseblk devices by not using fusermount -u for them (checks for fuse.* now)
+
+2016/05/29 - Version 1.0.0
 - Gtk 3 Support only
 - Panel Version 4.12 only
 
diff --git a/README b/README
index 1e40790..4b9acd3 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 # ================================================ #
-# Version 1.0.0. for Xfce Panel 4.12.0 and higher    #
+# Version 1.1.0. for Xfce Panel 4.12.0 and higher    #
 # Ported and maintained by Fabian Nowak and others #
 # ================================================ #
 
-xfce4-mount-plugin - version 1.0.0
+xfce4-mount-plugin - version 1.1.0
 
 This little plugin behaves like the "kwikdisk - removable media utility" 
 shipped with KDE.
diff --git a/configure.ac.in b/configure.ac.in
index 07dc904..a3f03d5 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -9,9 +9,9 @@ dnl
 dnl for Xfce4-panel 4.12 and higher only!
 
 m4_define([mount_version_major], [1])
-m4_define([mount_version_minor], [0])
+m4_define([mount_version_minor], [1])
 m4_define([mount_version_micro], [0])
-m4_define([mount_version_tag], [git]) # Leave empty only for releases, but use 'git' in most cases
+m4_define([mount_version_tag], []) # Leave empty only for releases, but use 'git' in most cases
 m4_define([mount_version_build], [@REVISION@])
 m4_define([mount_version], [mount_version_major().mount_version_minor().mount_version_micro()ifelse(mount_version_tag(), [], [], [mount_version_tag()-mount_version_build()])])
 
diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
index 47c640e..797b079 100644
--- a/panel-plugin/devices.c
+++ b/panel-plugin/devices.c
@@ -180,14 +180,14 @@ disk_print (t_disk * pdisk)
 }
 
 char *
-shorten_disk_name (const char *dev, gint len)
+shorten_disk_name (const char *dev, guint len)
 {
     char *r, *lastchars, *firstchars;
     if (strncmp(dev, "LABEL=", 6)==0)
     {
       r = g_strdup(dev+6*sizeof(char));
     }
-    else if (strlen(dev)>len) // len canot be set lower than 9
+    else if (strlen(dev)>len) // len cannot be set lower than 9
     {
         // we want at least 5 characters at the end so that trimmed UUIDs are still readable
         lastchars = (char *) (dev + strlen(dev) - 5);
@@ -346,7 +346,7 @@ disk_umount (t_disk *pdisk, char* umount_command, gboolean show_message_dialog,
     {
 
         DBG("disk_umount: dev=%s, mountpoint=%s, umount_command=%s, show_message_dialog=%d, eject=%d, type=%s", pdisk->device, pdisk->mount_point, umount_command, show_message_dialog, eject, pdisk->mount_info->type);
-        if (strstr(pdisk->mount_info->type, "fuse"))
+        if (strstr(pdisk->mount_info->type, "fuse."))
           deviceprintf(&tmp, "fusermount -u %m", pdisk->device);
         else
           deviceprintf(&tmp, umount_command, pdisk->device);
@@ -418,7 +418,7 @@ gboolean
 device_or_mountpoint_exists (GPtrArray * pdisks, t_disk * pdisk)
 {
   gboolean returnValue = FALSE;
-  int i;
+  guint i;
   t_disk *disk;
   int stringlength1, stringlength2, stringlength3, stringlength4;
 
@@ -470,7 +470,6 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
     t_disk * pdisk;
     struct fstab *pfstab;
     gboolean has_valid_mount_device;
-    GtkWidget *dialog;
 
     pdisks = g_ptr_array_new();
 
diff --git a/panel-plugin/devices.h b/panel-plugin/devices.h
index 2dd65bc..fb87705 100644
--- a/panel-plugin/devices.h
+++ b/panel-plugin/devices.h
@@ -107,15 +107,17 @@ void disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolea
  */
 void disk_umount (t_disk *pdisk, char* umount_command, gboolean show_message_dialog, gboolean eject);
 
+gboolean device_or_mountpoint_exists (GPtrArray * pdisks, t_disk * pdisk);
 
 /**
  * Fill a GPtrArray with pointers on struct t_disk containing infos on devices
  * and theoretical mount point. Uses setfsent() and getfsent().
  * @param include_NFSs    TRUE if remote file systems should also be displayed.
  * @param showed_fstab_dialog Pointer to whether dialog has already been shown before
+ * @param length Length of the mount point names to display when shortened
  * @return                GPtrArray with t_disks
  */
-GPtrArray * disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length) ;
+GPtrArray * disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length);
 
 
 /**
@@ -195,11 +197,9 @@ void mount_info_print(t_mount_info * mount_info);
 t_mount_info * mount_info_new (float size, float used, float avail, unsigned int percent, char * type, char * mounted_on);
 void mount_info_free(t_mount_info * * mount_info);
 void disk_print (t_disk * pdisk);
-char * shorten_disk_name (const char *dev, gint length);
+char * shorten_disk_name (const char *dev, guint length);
 t_disk * disk_new (const char * dev, const char * mountpoint, gint length);
 void disk_free(t_disk **pdisk);
 void disks_free_mount_info(GPtrArray * pdisks);
 
 #endif /* _DEVICES_H_ */
-
-
diff --git a/panel-plugin/helpers.c b/panel-plugin/helpers.c
index 071b1f0..f51862a 100644
--- a/panel-plugin/helpers.c
+++ b/panel-plugin/helpers.c
@@ -33,8 +33,8 @@ seperate_list (GPtrArray *array, char *list)
     int retval = 0;
     char *p, *q;
 
-	if (list==NULL)
-		return retval;
+    if (list==NULL)
+        return retval;
 
     p = strdup(list);
 
@@ -103,35 +103,37 @@ int
 mountpointprintf (char **dest, char *format, char *mountpoint)
 {
     int retval=0;
-    char *p = strdup(format), *q, *r, *s, *t;
-
-    r = p;
+    char *p, *q, *r, *s, *t, *escaped_mp="";
 
     if (*dest==NULL)
         *dest = "";
 
+    p = strdup(mountpoint);
+    r = p;
+
+    while ((q=strchr(p, ' ')) != NULL) {
+        t = strdup(p);
+        s = strchr(t, ' ');
+        s[0] = '\0';
+        escaped_mp = g_strconcat (escaped_mp, t, "\\ ", NULL);
+        g_free(t);
+        p = q+1;
+    }
+    escaped_mp = g_strconcat(escaped_mp, p, NULL);
+    g_free(r);
+
+    p = strdup(format);
+    r = p;
     for (q = strstr(p, "\%m"); q!=NULL; q = strstr(p, "\%m")) {
         q[0] = '\0';
-
-        if (strchr(mountpoint, ' ')!=NULL) {
-			t = strdup(mountpoint);
-			s = strchr(t, ' ');
-			s[0] = '\\';
-			s[1] = '\0';
-			s = g_strconcat (t, strchr(mountpoint, ' '), NULL);
-			/* g_free(t); */
-        }
-        else
-			s = mountpoint;
-
-        *dest = g_strconcat (*dest, p, s, " ", NULL);
+        *dest = g_strconcat (*dest, p, escaped_mp, " ", NULL);
         p = q+2;
         retval++;
     }
     *dest = g_strconcat (*dest, p, NULL);
 
     g_free(r);
+    g_free(escaped_mp);
 
     return retval;
 }
-
diff --git a/panel-plugin/mount-plugin.c b/panel-plugin/mount-plugin.c
index b277b7f..9d4a277 100644
--- a/panel-plugin/mount-plugin.c
+++ b/panel-plugin/mount-plugin.c
@@ -351,16 +351,15 @@ mounter_refresh (t_mounter * mt)
 
 
 static gboolean
-on_button_press (GtkWidget *widget, GdkEventButton *event, t_mounter *mounter)
+on_button_press (GtkWidget *widget, GdkEventButton *eventButton, t_mounter *mounter)
 {
     TRACE ("enters on_button_press");
-    if (mounter != NULL && event->button == 1) /* left click only */
+    if (mounter != NULL && eventButton->button == 1) /* left click only */
     {
-
+        GdkEvent event;
+        event.button = *eventButton;
         mounter_refresh (mounter); /* refreshs infos regarding mounts data */
-        gtk_menu_popup (GTK_MENU(mounter->menu), NULL, NULL,
-                        xfce_panel_plugin_position_menu, mounter->plugin,
-                        0, event->time);
+        gtk_menu_popup_at_widget (GTK_MENU(mounter->menu), mounter->button, GDK_GRAVITY_CENTER, GDK_GRAVITY_CENTER, &event);
         return TRUE;
     }
     TRACE ("leaves on_button_press");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list