[Goodies-commits] r2527 - xfce4-mount-plugin/trunk/panel-plugin
Fabian Nowak
timystery at xfce.org
Thu Mar 1 11:24:25 CET 2007
Author: timystery
Date: 2007-03-01 10:24:25 +0000 (Thu, 01 Mar 2007)
New Revision: 2527
Added:
xfce4-mount-plugin/trunk/panel-plugin/helpers.h
Modified:
xfce4-mount-plugin/trunk/panel-plugin/Makefile.am
xfce4-mount-plugin/trunk/panel-plugin/devices.c
xfce4-mount-plugin/trunk/panel-plugin/devices.h
xfce4-mount-plugin/trunk/panel-plugin/helpers.c
xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c
xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h
Log:
Removed compilation warnings
Modified: xfce4-mount-plugin/trunk/panel-plugin/Makefile.am
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/Makefile.am 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/Makefile.am 2007-03-01 10:24:25 UTC (rev 2527)
@@ -7,7 +7,9 @@
devices.c \
devices.h \
mount-plugin.c \
- mount-plugin.h
+ mount-plugin.h \
+ helpers.c \
+ helpers.h
xfce4_mount_plugin_CFLAGS = \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
@@ -34,7 +36,6 @@
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
- helpers.c \
icons.h \
kcmpartitions.png \
$(desktop_in_in_files)
Modified: xfce4-mount-plugin/trunk/panel-plugin/devices.c
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/devices.c 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/devices.c 2007-03-01 10:24:25 UTC (rev 2527)
@@ -30,9 +30,9 @@
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/xfce-exec.h>
+#include <libxfcegui4/dialogs.h>
#include "devices.h"
-#include "helpers.c"
#define KB 1024
#define MB 1048576
@@ -252,7 +252,6 @@
gchar *tmp = NULL, *tmp2 = NULL;
gboolean val;
char *cmd;
- gint filehandle;
GError *error = NULL;
#ifdef DEBUG
@@ -394,7 +393,7 @@
disks_remove_device (GPtrArray * pdisks, char *device)
{
int i;
- gpointer p;
+ gpointer p=NULL;
for (i=0; i < pdisks->len ; i++)
{
@@ -418,7 +417,7 @@
disks_remove_mountpoint (GPtrArray * pdisks, char *mountp)
{
int i;
- gpointer p;
+ gpointer p=NULL;
for (i=0; i < pdisks->len ; i++)
{
@@ -581,7 +580,6 @@
FILE *fmtab = NULL; /* file /etc/mtab */
struct mntent *pmntent = NULL; /* struct for mnt info */
gboolean retval = FALSE;
- int i = 0;
/* open file */
fmtab = setmntent (MTAB, "r"); /* mtab file */
Modified: xfce4-mount-plugin/trunk/panel-plugin/devices.h
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/devices.h 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/devices.h 2007-03-01 10:24:25 UTC (rev 2527)
@@ -23,6 +23,7 @@
# define _DEVICES_H_
#include <glib.h>
+#include "helpers.h"
/* #define DEBUG 1
#define DEBUG_TRACE 1 */
Modified: xfce4-mount-plugin/trunk/panel-plugin/helpers.c
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/helpers.c 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/helpers.c 2007-03-01 10:24:25 UTC (rev 2527)
@@ -19,8 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glib.h>
-#include <glib/gprintf.h>
+#include "helpers.h"
/**
* seperate list by spaces and store information in @array.
@@ -135,3 +134,4 @@
return retval;
}
+
Added: xfce4-mount-plugin/trunk/panel-plugin/helpers.h
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/helpers.h (rev 0)
+++ xfce4-mount-plugin/trunk/panel-plugin/helpers.h 2007-03-01 10:24:25 UTC (rev 2527)
@@ -0,0 +1,62 @@
+/* helpers.c */
+
+/*
+Copyright (C) 2007 Fabian Nowak timystery at arcor.de.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef HELPERS_H
+#define HELPERS_H
+
+#include <glib.h>
+#include <glib/gprintf.h>
+
+#include <string.h>
+
+/**
+ * seperate list by spaces and store information in @array.
+ * @param array pointer array where list entries are stored in
+ * @param list list string with entres seperated by space
+ * @return 0 on failure, number of entries on success.
+ */
+int
+seperate_list (GPtrArray *array, char *list);
+
+/**
+ * Print device to the format string where there is \%d. The new string dest
+ * is allocated with malloc and must therefore be freed.
+ * @param dest double pointer to store location of newly created string
+ * @param format format string containing '\%d' to be replaced by @device
+ * @param device argument to replace '\%d' in @format with
+ * @return 0 on failure or no replacement, >0 on success.
+ */
+int
+deviceprintf (char **dest, char *format, char *device);
+
+/**
+ * Print mount point to the format string where there is \%m. The new string
+ * dest is allocated with malloc and must therefore be freed.
+ * @param dest double pointer to store location of newly created string
+ * @param format format string containing '%m' to be replaced by @mountpoint
+ * @param mountpoint argument to replace '%m' in @format with
+ * @return 0 on failure or no replacement, >0 on success.
+ */
+int
+mountpointprintf (char **dest, char *format, char *mountpoint);
+
+#endif /* HELPER_H */
+
Modified: xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.c 2007-03-01 10:24:25 UTC (rev 2527)
@@ -19,10 +19,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include "mount-plugin.h"
-
static void
on_message_dialog_response (GtkWidget *widget, gpointer *data)
{
@@ -49,10 +47,6 @@
int result = disk_umount (disk, mt->umount_command,
mt->message_dialog, eject);
- g_printf("mt->message_dialog=%d\n"
- "eject=%d\n"
- "result=%d\n", mt->message_dialog, eject, result);
-
if (mt->message_dialog && (!eject || result!=NONE) ) { /* popup dialog */
msg = (gchar *) g_malloc (1024*sizeof(gchar));
@@ -354,39 +348,41 @@
rc = xfce_rc_simple_open (file, TRUE);
g_free (file);
- if ( value = xfce_rc_read_entry(rc, "on_mount_cmd", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "on_mount_cmd", NULL)) )
mt->on_mount_cmd = g_strdup (value);
- if ( value = xfce_rc_read_entry(rc, "icon", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "icon", NULL)) )
mt->icon = g_strdup (value);
else
- asprintf (&(mt->icon), "%s/icons/hicolor/scalable/apps/xfce-mount.svg", PACKAGE_DATA_DIR);
+ mt->icon = g_strdup_printf (
+ "%s/icons/hicolor/scalable/apps/xfce-mount.svg",
+ PACKAGE_DATA_DIR );
- if ( value = xfce_rc_read_entry (rc, "mount_command", NULL) )
+ if ( (value = xfce_rc_read_entry (rc, "mount_command", NULL)) )
mt->mount_command = g_strdup (value);
else
mt->mount_command = g_strdup (DEFAULT_MOUNT_COMMAND);
- if ( value = xfce_rc_read_entry (rc, "umount_command", NULL) )
+ if ( (value = xfce_rc_read_entry (rc, "umount_command", NULL)) )
mt->umount_command = g_strdup (value);
else
mt->umount_command = g_strdup (DEFAULT_UMOUNT_COMMAND);
- if ( value = xfce_rc_read_entry (rc, "excluded_filesystems", NULL) )
+ if ( (value = xfce_rc_read_entry (rc, "excluded_filesystems", NULL)) )
mt->excluded_filesystems = g_strdup (value);
else
mt->excluded_filesystems = g_strdup ("");
- if ( value = xfce_rc_read_entry(rc, "message_dialog", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "message_dialog", NULL)) )
mt->message_dialog = atoi (value);
- if ( value = xfce_rc_read_entry(rc, "include_NFSs", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "include_NFSs", NULL)) )
mt->include_NFSs= atoi (value);
- if ( value = xfce_rc_read_entry(rc, "exclude_FSs", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "exclude_FSs", NULL)) )
mt->exclude_FSs= atoi (value);
- if ( value = xfce_rc_read_entry(rc, "eject_drives", NULL) )
+ if ( (value = xfce_rc_read_entry(rc, "eject_drives", NULL)) )
mt->eject_drives= atoi (value);
xfce_rc_close (rc);
@@ -491,11 +487,11 @@
}
-static void
+/* static void
free_mounter_dialog(GtkWidget * widget, t_mounter_dialog * md)
{
g_free(md);
-}
+} */
static void
@@ -555,9 +551,9 @@
mt->icon = g_strdup( gtk_file_chooser_get_filename (
GTK_FILE_CHOOSER(md->string_icon)) );
else
- asprintf (&(mt->icon),
+ mt->icon = g_strdup_printf (
"%s/icons/hicolor/scalable/apps/xfce-mount.svg",
- PACKAGE_DATA_DIR);
+ PACKAGE_DATA_DIR );
mt->button_pb = gdk_pixbuf_new_from_file (mt->icon, NULL);
xfce_iconbutton_set_pixbuf (XFCE_ICONBUTTON(mt->button), mt->button_pb);
@@ -587,16 +583,16 @@
* This shows a way to update plugin settings when the user leaves a text
* entry, by connecting to the "focus-out" event on the entry.
*/
-static gboolean
+/* static gboolean
entry_lost_focus(t_mounter_dialog * md)
{
mounter_apply_options (md);
- /* also write config? */
+ // also write config?
- /* NB: needed to let entry handle focus-out as well */
+ // NB: needed to let entry handle focus-out as well
return FALSE;
-}
+} */
static gboolean
@@ -647,7 +643,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header, FALSE,
TRUE, 0);
- GtkWidget *vbox, *label;
+ GtkWidget *vbox;
t_mounter_dialog * md;
md = g_new0 (t_mounter_dialog, 1);
Modified: xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h
===================================================================
--- xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h 2007-03-01 00:28:43 UTC (rev 2526)
+++ xfce4-mount-plugin/trunk/panel-plugin/mount-plugin.h 2007-03-01 10:24:25 UTC (rev 2527)
@@ -40,6 +40,7 @@
#include <string.h>
#include "devices.h"
+#include "helpers.h"
#include "icons.h"
#define APP_NAME N_("Mount Plugin")
More information about the Goodies-commits
mailing list