[kdbus] Update kdbus interface header (commit: b620b72c9127) 14/10/16
[platform/upstream/glib.git] / gio / ggtknotificationbackend.c
index 79486b1..c5ceced 100644 (file)
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
-* Public License along with this library; if not, write to the
-* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-* Boston, MA 02111-1307, USA.
+* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Lars Uebernickel <lars@uebernic.de>
 */
 
+#include "config.h"
 #include "gnotificationbackend.h"
 
 #include "giomodule-priv.h"
@@ -35,8 +34,6 @@ typedef GNotificationBackendClass       GGtkNotificationBackendClass;
 struct _GGtkNotificationBackend
 {
   GNotificationBackend parent;
-
-  GDBusConnection *session_bus;
 };
 
 GType g_gtk_notification_backend_get_type (void);
@@ -46,16 +43,6 @@ G_DEFINE_TYPE_WITH_CODE (GGtkNotificationBackend, g_gtk_notification_backend, G_
   g_io_extension_point_implement (G_NOTIFICATION_BACKEND_EXTENSION_POINT_NAME,
                                  g_define_type_id, "gtk", 100))
 
-static void
-g_gtk_notification_backend_dispose (GObject *object)
-{
-  GGtkNotificationBackend *backend = G_GTK_NOTIFICATION_BACKEND (object);
-
-  g_clear_object (&backend->session_bus);
-
-  G_OBJECT_CLASS (g_gtk_notification_backend_parent_class)->dispose (object);
-}
-
 static gboolean
 g_gtk_notification_backend_is_supported (void)
 {
@@ -91,16 +78,13 @@ g_gtk_notification_backend_send_notification (GNotificationBackend *backend,
                                               const gchar          *id,
                                               GNotification        *notification)
 {
-  GApplication *application;
   GVariant *params;
 
-  application = g_notification_backend_get_application (backend);
-
-  params = g_variant_new ("(ss@a{sv})", g_application_get_application_id (application),
+  params = g_variant_new ("(ss@a{sv})", g_application_get_application_id (backend->application),
                                         id,
                                         g_notification_serialize (notification));
 
-  g_dbus_connection_call (g_notification_backend_get_dbus_connection (backend),
+  g_dbus_connection_call (backend->dbus_connection,
                           "org.gtk.Notifications", "/org/gtk/Notifications",
                           "org.gtk.Notifications", "AddNotification", params,
                           G_VARIANT_TYPE_UNIT,
@@ -111,15 +95,11 @@ static void
 g_gtk_notification_backend_withdraw_notification (GNotificationBackend *backend,
                                                   const gchar          *id)
 {
-  GGtkNotificationBackend *self = G_GTK_NOTIFICATION_BACKEND (backend);
-  GApplication *application;
   GVariant *params;
 
-  application = g_notification_backend_get_application (backend);
+  params = g_variant_new ("(ss)", g_application_get_application_id (backend->application), id);
 
-  params = g_variant_new ("(ss)", g_application_get_application_id (application), id);
-
-  g_dbus_connection_call (self->session_bus, "org.gtk.Notifications",
+  g_dbus_connection_call (backend->dbus_connection, "org.gtk.Notifications",
                           "/org/gtk/Notifications", "org.gtk.Notifications",
                           "RemoveNotification", params, G_VARIANT_TYPE_UNIT,
                           G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
@@ -133,11 +113,8 @@ g_gtk_notification_backend_init (GGtkNotificationBackend *backend)
 static void
 g_gtk_notification_backend_class_init (GGtkNotificationBackendClass *class)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (class);
   GNotificationBackendClass *backend_class = G_NOTIFICATION_BACKEND_CLASS (class);
 
-  object_class->dispose = g_gtk_notification_backend_dispose;
-
   backend_class->is_supported = g_gtk_notification_backend_is_supported;
   backend_class->send_notification = g_gtk_notification_backend_send_notification;
   backend_class->withdraw_notification = g_gtk_notification_backend_withdraw_notification;