[Goodies-commits] r6494 - xfce4-mount-plugin/trunk/panel-plugin
Fabian Nowak
timystery at xfce.org
Sun Jan 18 19:13:49 CET 2009
Author: timystery
Date: 2009-01-18 18:13:49 +0000 (Sun, 18 Jan 2009)
New Revision: 6494
Modified:
xfce4-mount-plugin/trunk/panel-plugin/devices.c
xfce4-mount-plugin/trunk/panel-plugin/devices.h
xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c
xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h
Log:
- included popup dialog when fstab was not readable and show it only once
Modified: xfce4-mount-plugin/trunk/panel-plugin/devices.c
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/devices.c 2009-01-18 17:54:19 UTC (rev 6493)
+++ xfce4-mount-plugin/trunk/panel-plugin/devices.c 2009-01-18 18:13:49 UTC (rev 6494)
@@ -315,19 +315,35 @@
* @return GPtrArray *pdisks containing elements to be displayed
*/
GPtrArray *
-disks_new (gboolean include_NFSs)
+disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog)
{
GPtrArray * pdisks; /* to be returned */
t_disk * pdisk;
struct fstab *pfstab;
gboolean has_valid_mount_device;
+ GtkWidget *dialog;
+ pdisks = g_ptr_array_new();
+
/* open fstab */
if (setfsent()!=1)
- return NULL; /* on error return NULL */
+ {
+ /* popup notification dialog */
+ if (! (*showed_fstab_dialog) ) {
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ "Your /etc/fstab could not be read. This will severely degrade the plugin's abilities.");
+ /* gtk_dialog_run (GTK_DIALOG (dialog)); */
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+ gtk_widget_show (dialog);
+ *showed_fstab_dialog = TRUE;
+ }
- pdisks = g_ptr_array_new();
+ return pdisks; /* on error return empty pdisks */
+ }
+
for (pfstab = getfsent(); pfstab!=NULL; pfstab = getfsent())
{
has_valid_mount_device =
Modified: xfce4-mount-plugin/trunk/panel-plugin/devices.h
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/devices.h 2009-01-18 17:54:19 UTC (rev 6493)
+++ xfce4-mount-plugin/trunk/panel-plugin/devices.h 2009-01-18 18:13:49 UTC (rev 6494)
@@ -120,9 +120,10 @@
* 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
* @return GPtrArray with t_disks
*/
-GPtrArray * disks_new (gboolean include_NFSs) ;
+GPtrArray * disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog) ;
/**
Modified: xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c 2009-01-18 17:54:19 UTC (rev 6493)
+++ xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c 2009-01-18 18:13:49 UTC (rev 6494)
@@ -19,6 +19,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+#include <stdlib.h>
+
#include "mount-plugin.h"
static void
@@ -54,7 +57,7 @@
msg = _("The device \"%s\" should be removable safely "
"now.");
else
- msg = _("An error occurred. The device should not be "
+ msg = _("An error occurred. The device \"%s\" should not be "
"removed!");
my_dlg = gtk_message_dialog_new (NULL,
@@ -294,7 +297,7 @@
gboolean removed_device;
/*get static infos from /etc/fstab */
- mt->pdisks = disks_new (mt->include_NFSs);
+ mt->pdisks = disks_new (mt->include_NFSs, &(mt->showed_fstab_dialog));
/* remove unwanted file systems from list */
if (mt->exclude_FSs) {
@@ -702,13 +705,13 @@
}
-static gboolean
+/*static gboolean
exclude_devicenames_toggled (GtkWidget *widget, t_mounter_dialog *md)
{
return TRUE;
-}
+}*/
static void
mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt)
@@ -718,7 +721,7 @@
xfce_panel_plugin_block_menu (plugin);
- GtkWidget *dlg, *header;
+ GtkWidget *dlg; //, *header;
//dlg = gtk_dialog_new_with_buttons (_("Edit Properties"),
dlg = xfce_titled_dialog_new_with_buttons(
_("Mount Plugin"),
Modified: xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h 2009-01-18 17:54:19 UTC (rev 6493)
+++ xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h 2009-01-18 18:13:49 UTC (rev 6494)
@@ -52,7 +52,7 @@
#define DEFAULT_MOUNT_COMMAND "mount %d"
#define DEFAULT_UMOUNT_COMMAND "umount %d"
-#define DEFAULT_ICON PACKAGE_DATA_DIR"/icons/hicolor/scalable/apps/xfce-mount.svg"
+#define DEFAULT_ICON PACKAGE_DATA_DIR "/icons/hicolor/scalable/apps/xfce-mount.svg"
static GtkTooltips *tooltips = NULL;
@@ -73,6 +73,7 @@
gboolean exclude_FSs;
gboolean exclude_devicenames;
gboolean eject_drives;
+ gboolean showed_fstab_dialog;
GtkWidget *button;
GdkPixbuf *button_pb;
GtkWidget *menu;
More information about the Goodies-commits
mailing list