[glibmm] Gio::DBus::[watch|own]_name(): Add default values for parameters.



commit af212561fbe40e4bdfada2564071640c34f34e18
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Sun Jan 16 16:15:56 2011 -0500

    Gio::DBus::[watch|own]_name(): Add default values for parameters.
    
    	* gio/src/dbusownname.{ccg,hg} (own_name):
    	* gio/src/dbuswatchname.{ccg,hg} (watch_name): Add default values for
    	the slot parameters instead of writing up overloads since there would
    	be many.  Also reorder the parameters so that the flags have default
    	values.

 ChangeLog                 |   10 ++++++++++
 gio/src/dbusownname.ccg   |   10 +++++++---
 gio/src/dbusownname.hg    |   16 +++++++++-------
 gio/src/dbuswatchname.ccg |   21 ++++++++++++++-------
 gio/src/dbuswatchname.hg  |   29 ++++++++++++++++-------------
 5 files changed, 56 insertions(+), 30 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0f885c2..7c0d8db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-01-16  José Alburquerque  <jaalburqu svn gnome org>
 
+	Gio::DBus::[watch|own]_name(): Add default values for parameters.
+
+	* gio/src/dbusownname.{ccg,hg} (own_name):
+	* gio/src/dbuswatchname.{ccg,hg} (watch_name): Add default values for
+	the slot parameters instead of writing up overloads since there would
+	be many.  Also reorder the parameters so that the flags have default
+	values.
+
+2011-01-16  José Alburquerque  <jaalburqu svn gnome org>
+
 	InetAddress: Wrap properties.
 
 	* gio/src/inetaddress.hg: Wrap the properties.
diff --git a/gio/src/dbusownname.ccg b/gio/src/dbusownname.ccg
index 403fde1..6e5bb22 100644
--- a/gio/src/dbusownname.ccg
+++ b/gio/src/dbusownname.ccg
@@ -108,10 +108,14 @@ namespace Gio
 namespace DBus
 {
 
-guint own_name(BusType bus_type, const Glib::ustring& name,
-  BusNameOwnerFlags flags, const SlotBusAcquired& bus_acquired_slot,
+guint own_name(
+  BusType bus_type,
+  const Glib::ustring& name,
+  const SlotBusAcquired& bus_acquired_slot,
   const SlotNameAcquired& name_acquired_slot,
-  const SlotNameLost& name_lost_slot)
+  const SlotNameLost& name_lost_slot,
+  BusNameOwnerFlags flags
+)
 {
   struct OwnSlots* slots = new OwnSlots;
 
diff --git a/gio/src/dbusownname.hg b/gio/src/dbusownname.hg
index 7ef61aa..e6db230 100644
--- a/gio/src/dbusownname.hg
+++ b/gio/src/dbusownname.hg
@@ -98,25 +98,27 @@ typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring
  *
  * @param bus_type The type of bus to own a name on.
  * @param name The well-known name to own.
- * @param flags A set of flags from the BusNameOwnerFlags enumeration.
  * @param bus_acquired_slot Slot to invoke when connected to the bus of
  * type bus_type.
  * @param name_acquired_slot Slot to invoke when name is acquired.
  * @param name_lost_slot Slot to invoke when name is lost.
+ * @param flags A set of flags from the BusNameOwnerFlags enumeration.
  * @return An identifier (never 0) that an be used with unown_name() to stop
  * owning the name.
  *
  * @newin{2,28}
  * @ingroup DBus
  */
-guint own_name(BusType bus_type, const Glib::ustring& name,
-  BusNameOwnerFlags flags, const SlotBusAcquired& bus_acquired_slot,
-  const SlotNameAcquired& name_acquired_slot,
-  const SlotNameLost& name_lost_slot);
+guint own_name(
+  BusType bus_type,
+  const Glib::ustring& name,
+  const SlotBusAcquired& bus_acquired_slot = SlotBusAcquired(),
+  const SlotNameAcquired& name_acquired_slot = SlotNameAcquired(),
+  const SlotNameLost& name_lost_slot = SlotNameLost(),
+  BusNameOwnerFlags flags = Gio::DBus::BUS_NAME_OWNER_FLAGS_NONE
+);
 _IGNORE(g_bus_own_name)
 
-//TODO: Add own_name() overloads that don't require all the slots.
-
 /** Stops owning a name.
  * @param owner_id An identifier obtained from own_name().
  */
diff --git a/gio/src/dbuswatchname.ccg b/gio/src/dbuswatchname.ccg
index c685698..587d922 100644
--- a/gio/src/dbuswatchname.ccg
+++ b/gio/src/dbuswatchname.ccg
@@ -89,9 +89,13 @@ namespace Gio
 namespace DBus
 {
 
-guint watch_name(BusType bus_type, const Glib::ustring& name,
-  BusNameWatcherFlags flags, const SlotNameAppeared& name_appeared_slot,
-  const SlotNameVanished& name_vanished_slot)
+guint watch_name(
+  BusType bus_type,
+  const Glib::ustring& name,
+  const SlotNameAppeared& name_appeared_slot,
+  const SlotNameVanished& name_vanished_slot,
+  BusNameWatcherFlags flags
+)
 {
   struct WatchSlots* slots = new WatchSlots;
 
@@ -105,10 +109,13 @@ guint watch_name(BusType bus_type, const Glib::ustring& name,
     slots, &Bus_Watch_Name_giomm_callback_destroy);
 }
 
-guint watch_name(const Glib::RefPtr<DBusConnection>& connection,
-const Glib::ustring& name, BusNameWatcherFlags flags,
-const SlotNameAppeared& name_appeared_slot,
-  const SlotNameVanished& name_vanished_slot)
+guint watch_name(
+  const Glib::RefPtr<DBusConnection>& connection,
+  const Glib::ustring& name,
+  const SlotNameAppeared& name_appeared_slot,
+  const SlotNameVanished& name_vanished_slot,
+  BusNameWatcherFlags flags
+)
 {
   struct WatchSlots* slots = new WatchSlots;
 
diff --git a/gio/src/dbuswatchname.hg b/gio/src/dbuswatchname.hg
index edd0f2f..5668cda 100644
--- a/gio/src/dbuswatchname.hg
+++ b/gio/src/dbuswatchname.hg
@@ -74,45 +74,48 @@ typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring
  *
  * @param bus_type The type of bus to watch a name on.
  * @param name The name (well-known or unique) to watch.
- * @param flags Flags from the BusNameWatcherFlags enumeration.
  * @param name_appeared_slot Slot to invoke when name is known to exist.
  * @param name_vanished_slot Slot to invoke when name is known to not
  * exist.
+ * @param flags Flags from the BusNameWatcherFlags enumeration.
  * @return An identifier (never 0) that can be used with unwatch_name() to
  * stop watching the name.
  *
  * @newin{2,28}
  * @ingroup DBus
  */
-guint watch_name(BusType bus_type, const Glib::ustring& name,
-  BusNameWatcherFlags flags, const SlotNameAppeared& name_appeared_slot,
-  const SlotNameVanished& name_vanished_slot);
+guint watch_name(
+  BusType bus_type,
+  const Glib::ustring& name,
+  const SlotNameAppeared& name_appeared_slot = SlotNameAppeared(),
+  const SlotNameVanished& name_vanished_slot = SlotNameVanished(),
+  BusNameWatcherFlags flags = Gio::DBus::BUS_NAME_WATCHER_FLAGS_NONE
+);
 _IGNORE(g_bus_watch_name)
 
-//TODO: Add overloads that don't require all the slots.
-
 /** A watch_name() function that takes a DBusConnection instead of a BusType.
  *
  * @param connection A DBusConnection.
  * @param name The name (well-known or unique) to watch.
- * @param flags Flags from the BusNameWatcherFlags enumeration.
  * @param name_appeared_slot Slot to invoke when name is known to exist.
  * @param name_vanished_slot Slot to invoke when name is known to not
  * exist.
+ * @param flags Flags from the BusNameWatcherFlags enumeration.
  * @return An identifier (never 0) that can be used with unwatch_name() to
  * stop watching the name.
  *
  * @newin{2,28}
  * @ingroup DBus
  */
-guint watch_name(const Glib::RefPtr<DBusConnection>& connection,
-  const Glib::ustring& name, BusNameWatcherFlags flags,
-  const SlotNameAppeared& name_appeared_slot,
-  const SlotNameVanished& name_vanished_slot);
+guint watch_name(
+  const Glib::RefPtr<DBusConnection>& connection,
+  const Glib::ustring& name,
+  const SlotNameAppeared& name_appeared_slot = SlotNameAppeared(),
+  const SlotNameVanished& name_vanished_slot = SlotNameVanished(),
+  BusNameWatcherFlags flags = Gio::DBus::BUS_NAME_WATCHER_FLAGS_NONE
+);
 _IGNORE(g_bus_watch_name_on_connection)
 
-//TODO: Add overloads that don't require all the slots.
-
 /** Stops watching a name.
  * @param watcher_id An identifier obtained from watch_name().
  * @ingroup DBus



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]