[Goodies-commits] r2363 - in thunar-volman/trunk: . icons/48x48 thunar-volman

Benedikt Meurer benny at xfce.org
Mon Jan 15 18:21:08 CET 2007


Author: benny
Date: 2007-01-15 17:21:08 +0000 (Mon, 15 Jan 2007)
New Revision: 2363

Added:
   thunar-volman/trunk/icons/48x48/tvm-dev-pocketpc.png
   thunar-volman/trunk/thunar-volman/tvm-pda-device.c
   thunar-volman/trunk/thunar-volman/tvm-pda-device.h
Modified:
   thunar-volman/trunk/ChangeLog
   thunar-volman/trunk/icons/48x48/Makefile.am
   thunar-volman/trunk/thunar-volman/Makefile.am
   thunar-volman/trunk/thunar-volman/tvm-device.c
   thunar-volman/trunk/thunar-volman/tvm-input-device.c
   thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c
   thunar-volman/trunk/thunar-volman/tvm-preferences.c
Log:
2007-01-15	Benedikt Meurer <benny at xfce.org>

	* icons/48x48/, thunar-volman/: Add support for PDAs (currently
	  Palm Pilots and Pocket PCs).




Modified: thunar-volman/trunk/ChangeLog
===================================================================
--- thunar-volman/trunk/ChangeLog	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/ChangeLog	2007-01-15 17:21:08 UTC (rev 2363)
@@ -1,3 +1,8 @@
+2007-01-15	Benedikt Meurer <benny at xfce.org>
+
+	* icons/48x48/, thunar-volman/: Add support for PDAs (currently
+	  Palm Pilots and Pocket PCs).
+
 2007-01-12	Benedikt Meurer <benny at xfce.org>
 
 	* icons/48x48/tvm-dev-tablet.png: Use tangoified tablet icon.

Modified: thunar-volman/trunk/icons/48x48/Makefile.am
===================================================================
--- thunar-volman/trunk/icons/48x48/Makefile.am	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/icons/48x48/Makefile.am	2007-01-15 17:21:08 UTC (rev 2363)
@@ -3,6 +3,7 @@
 iconsdir = $(datadir)/icons/hicolor/48x48/apps
 icons_DATA =								\
 	tvm-burn-cd.png							\
+	tvm-dev-pocketpc.png						\
 	tvm-dev-tablet.png
 
 EXTRA_DIST =								\

Added: thunar-volman/trunk/icons/48x48/tvm-dev-pocketpc.png
===================================================================
(Binary files differ)


Property changes on: thunar-volman/trunk/icons/48x48/tvm-dev-pocketpc.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: thunar-volman/trunk/thunar-volman/Makefile.am
===================================================================
--- thunar-volman/trunk/thunar-volman/Makefile.am	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/thunar-volman/Makefile.am	2007-01-15 17:21:08 UTC (rev 2363)
@@ -27,6 +27,8 @@
 	tvm-input-device.h						\
 	tvm-pango-extensions.c						\
 	tvm-pango-extensions.h						\
+	tvm-pda-device.c						\
+	tvm-pda-device.h						\
 	tvm-preferences-dialog.c					\
 	tvm-preferences-dialog.h					\
 	tvm-preferences.c						\

Modified: thunar-volman/trunk/thunar-volman/tvm-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-device.c	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/thunar-volman/tvm-device.c	2007-01-15 17:21:08 UTC (rev 2363)
@@ -40,6 +40,7 @@
 #include <thunar-volman/tvm-camera-device.h>
 #include <thunar-volman/tvm-device.h>
 #include <thunar-volman/tvm-input-device.h>
+#include <thunar-volman/tvm-pda-device.h>
 
 
 
@@ -59,6 +60,7 @@
   { "input.keyboard", tvm_input_device_added,  },
   { "input.mouse",    tvm_input_device_added,  },
   { "input.tablet",   tvm_input_device_added,  },
+  { "pda",            tvm_pda_device_added,    },
 };
 
 

Modified: thunar-volman/trunk/thunar-volman/tvm-input-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-input-device.c	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/thunar-volman/tvm-input-device.c	2007-01-15 17:21:08 UTC (rev 2363)
@@ -48,7 +48,7 @@
 
 
 /**
- * tvm_block_input_added:
+ * tvm_input_device_added:
  * @preferences : a #TvmPreferences.
  * @context     : a #LibHalContext.
  * @udi         : the HAL device UDI of the newly added input device.

Copied: thunar-volman/trunk/thunar-volman/tvm-pda-device.c (from rev 2362, thunar-volman/trunk/thunar-volman/tvm-input-device.c)
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-pda-device.c	                        (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-pda-device.c	2007-01-15 17:21:08 UTC (rev 2363)
@@ -0,0 +1,121 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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., 59 Temple
+ * Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <thunar-volman/tvm-pda-device.h>
+#include <thunar-volman/tvm-prompt.h>
+#include <thunar-volman/tvm-run.h>
+
+
+
+static const struct
+{
+  const gchar *platform;
+  const gchar *auto_option_name;
+  const gchar *auto_command_name;
+} commands[] = {
+  { "palm",     "autopalm",     "autopalm-command", },
+  { "pocketpc", "autopocketpc", "autopocketpc-command",    },
+};
+
+
+
+/**
+ * tvm_pda_device_added:
+ * @preferences : a #TvmPreferences.
+ * @context     : a #LibHalContext.
+ * @udi         : the HAL device UDI of the newly added PDA device.
+ * @capability  : the capability, which caused this handler to be run.
+ * @error       : return location for errors or %NULL.
+ *
+ * See #TvmDeviceCallback for further information.
+ *
+ * Return value: %TRUE if handled, %FALSE if not handled or an
+ *               unrecoverable error occurred.
+ **/
+gboolean
+tvm_pda_device_added (TvmPreferences *preferences,
+                      LibHalContext  *context,
+                      const gchar    *udi,
+                      const gchar    *capability,
+                      GError        **error)
+{
+  DBusError derror;
+  gboolean  result = FALSE;
+  gboolean  auto_enabled;
+  gchar    *auto_command;
+  gchar    *platform;
+  guint     n;
+
+  g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+  g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+  g_return_val_if_fail (capability != NULL, FALSE);
+  g_return_val_if_fail (context != NULL, FALSE);
+
+  /* initialize D-Bus error */
+  dbus_error_init (&derror);
+
+  /* determine the PDA platform */
+  platform = libhal_device_get_property_string (context, udi, "pda.platform", &derror);
+  if (G_UNLIKELY (platform == NULL))
+    {
+      /* propagate the error */
+      dbus_set_g_error (error, &derror);
+      dbus_error_free (&derror);
+      return FALSE;
+    }
+
+  /* check if we can handle that platform */
+  for (n = 0; n < G_N_ELEMENTS (commands); ++n)
+    if (strcmp (commands[n].platform, platform) == 0)
+      break;
+  if (G_LIKELY (n < G_N_ELEMENTS (commands)))
+    {
+      /* check if this handling is enabled and we have a command */
+      g_object_get (G_OBJECT (preferences), commands[n].auto_option_name, &auto_enabled, commands[n].auto_command_name, &auto_command, NULL);
+      if (G_LIKELY (auto_enabled && auto_command != NULL && *auto_command != '\0'))
+        {
+          /* try to run the command */
+          result = tvm_run_command (context, udi, auto_command, NULL, NULL, error);
+        }
+      g_free (auto_command);
+    }
+
+  /* cleanup */
+  libhal_free_string (platform);
+
+  return result;
+}
+
+
+
+

Copied: thunar-volman/trunk/thunar-volman/tvm-pda-device.h (from rev 2362, thunar-volman/trunk/thunar-volman/tvm-input-device.h)
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-pda-device.h	                        (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-pda-device.h	2007-01-15 17:21:08 UTC (rev 2363)
@@ -0,0 +1,35 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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., 59 Temple
+ * Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __TVM_PDA_DEVICE_H__
+#define __TVM_PDA_DEVICE_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+gboolean tvm_pda_device_added (TvmPreferences *preferences,
+                               LibHalContext  *context,
+                               const gchar    *udi,
+                               const gchar    *capability,
+                               GError        **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_PDA_DEVICE_H__ */

Modified: thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c	2007-01-15 17:21:08 UTC (rev 2363)
@@ -378,7 +378,82 @@
   gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   gtk_widget_show (entry);
 
+
   /*
+     Cameras
+   */
+  label = gtk_label_new (_("PDAs"));
+  vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
+  gtk_widget_show (label);
+  gtk_widget_show (vbox);
+
+  frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+  gtk_widget_show (frame);
+
+  label = gtk_label_new (_("Palm™"));
+  gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+  gtk_widget_show (label);
+
+  table = gtk_table_new (2, 2, FALSE);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+  gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+  gtk_container_add (GTK_CONTAINER (frame), table);
+  gtk_widget_show (table);
+
+  image = gtk_image_new_from_icon_name ("palm-pilot", GTK_ICON_SIZE_DIALOG);
+  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (image);
+
+  button = gtk_check_button_new_with_mnemonic (_("Sync _Palm™ devices when connected"));
+  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autopalm", G_OBJECT (button), "active");
+  gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (button);
+
+  entry = tvm_command_entry_new_with_label (_("_Command:"));
+  exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autopalm-command", G_OBJECT (entry), "command");
+  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (entry);
+
+  frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+  gtk_widget_show (frame);
+
+  label = gtk_label_new (_("Pocket PC"));
+  gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+  gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+  gtk_widget_show (label);
+
+  table = gtk_table_new (2, 2, FALSE);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+  gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+  gtk_container_add (GTK_CONTAINER (frame), table);
+  gtk_widget_show (table);
+
+  image = gtk_image_new_from_icon_name ("tvm-dev-pocketpc", GTK_ICON_SIZE_DIALOG);
+  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (image);
+
+  button = gtk_check_button_new_with_mnemonic (_("Sync Pocket P_C devices when connected"));
+  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autopocketpc", G_OBJECT (button), "active");
+  gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (button);
+
+  entry = tvm_command_entry_new_with_label (_("C_ommand:"));
+  exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autopocketpc-command", G_OBJECT (entry), "command");
+  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+  gtk_widget_show (entry);
+
+
+  /*
      Input Devices
    */
   label = gtk_label_new (_("Input Devices"));
@@ -513,3 +588,4 @@
   return g_object_new (TVM_TYPE_PREFERENCES_DIALOG, NULL);
 }
 
+/* vim:set encoding=UTF-8: */

Modified: thunar-volman/trunk/thunar-volman/tvm-preferences.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences.c	2007-01-14 20:25:26 UTC (rev 2362)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences.c	2007-01-15 17:21:08 UTC (rev 2363)
@@ -54,6 +54,10 @@
   PROP_AUTOIPOD_COMMAND,
   PROP_AUTOPHOTO,
   PROP_AUTOPHOTO_COMMAND,
+  PROP_AUTOPALM,
+  PROP_AUTOPALM_COMMAND,
+  PROP_AUTOPOCKETPC,
+  PROP_AUTOPOCKETPC_COMMAND,
   PROP_AUTOKEYBOARD,
   PROP_AUTOKEYBOARD_COMMAND,
   PROP_AUTOMOUSE,
@@ -290,7 +294,7 @@
                                    g_param_spec_boolean ("autoplay-audio-cd",
                                                          "autoplay-audio-cd",
                                                          "autoplay-audio-cd",
-                                                         FALSE,
+                                                         TRUE,
                                                          EXO_PARAM_READWRITE));
 
   /**
@@ -385,6 +389,58 @@
                                                         EXO_PARAM_READWRITE));
 
   /**
+   * TvmPreferences:autopalm:
+   *
+   * Sync Palm devices when connected.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_AUTOPALM,
+                                   g_param_spec_boolean ("autopalm",
+                                                         "autopalm",
+                                                         "autopalm",
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
+  /**
+   * TvmPreferences:autopalm-command:
+   *
+   * Command to run when Palm device is connected.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_AUTOPALM_COMMAND,
+                                   g_param_spec_string ("autopalm-command",
+                                                        "autopalm-command",
+                                                        "autopalm-command",
+                                                        "gpilotd-control-applet",
+                                                        EXO_PARAM_READWRITE));
+
+  /**
+   * TvmPreferences:autopocketpc:
+   *
+   * Sync PocketPC devices when connected.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_AUTOPOCKETPC,
+                                   g_param_spec_boolean ("autopocketpc",
+                                                         "autopocketpc",
+                                                         "autopocketpc",
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
+  /**
+   * TvmPreferences:autopocketpc-command:
+   *
+   * Command to run when PocketPC device is connected.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_AUTOPOCKETPC_COMMAND,
+                                   g_param_spec_string ("autopocketpc-command",
+                                                        "autopocketpc-command",
+                                                        "autopocketpc-command",
+                                                        "multisync",
+                                                        EXO_PARAM_READWRITE));
+
+  /**
    * TvmPreferences:autokeyboard:
    *
    * Automatically run a program when an USB keyboard is connected.




More information about the Goodies-commits mailing list