~ubuntu-branches/ubuntu/vivid/vino/vivid-proposed

« back to all changes in this revision

Viewing changes to server/vino-status-icon.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-11-18 15:53:41 UTC
  • mfrom: (1.4.8)
  • Revision ID: package-import@ubuntu.com-20131118155341-u7aet62hkfzomvi6
Tags: 3.8.1-0ubuntu1
* New upstream version, drop changes included in the new version
* debian/patches/revert_use_prompt_notification.patch:
  - revert upstream change to use a notification with actions to accept or
    deny clients, since notify-osd doesn't support those, we keep using
    the old standalone dialog instead
* debian/patches/git_tls_read.patch:
  - "Fix reading of TLS data to account for cached data"

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <gtk/gtk.h>
27
27
#include <gio/gdesktopappinfo.h>
28
28
#include <string.h>
29
 
#ifdef VINO_HAVE_LIBNOTIFY
30
29
#include <libnotify/notify.h>
31
 
#endif
32
30
 
33
31
#include "vino-status-icon.h"
34
32
#include "vino-enums.h"
42
40
  GtkWidget  *disconnect_dialog;
43
41
  VinoStatusIconVisibility visibility;
44
42
 
45
 
#ifdef VINO_HAVE_LIBNOTIFY
46
43
  NotifyNotification *new_client_notification;
47
 
#endif
48
44
};
49
45
 
50
46
G_DEFINE_TYPE (VinoStatusIcon, vino_status_icon, GTK_TYPE_STATUS_ICON);
69
65
{
70
66
  VinoStatusIcon *icon = VINO_STATUS_ICON (object);
71
67
 
72
 
#ifdef VINO_HAVE_LIBNOTIFY
73
68
  if (icon->priv->new_client_notification)
74
69
    g_object_unref (icon->priv->new_client_notification);
75
70
  icon->priv->new_client_notification = NULL;
76
 
#endif
77
71
 
78
72
  if (icon->priv->menu)
79
73
    gtk_widget_destroy (GTK_WIDGET(icon->priv->menu));
205
199
  GError *error = NULL;
206
200
 
207
201
  screen = gtk_status_icon_get_screen (GTK_STATUS_ICON (icon));
208
 
  info = g_desktop_app_info_new ("vino-preferences.desktop");
 
202
  info = g_desktop_app_info_new ("gnome-sharing-panel.desktop");
 
203
  if (info == NULL)
 
204
    info = g_desktop_app_info_new ("vino-preferences.desktop");
209
205
  context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
210
206
  if (!g_app_info_launch (G_APP_INFO (info), NULL, G_APP_LAUNCH_CONTEXT (context), &error))
211
207
    {
571
567
  g_type_class_add_private (gobject_class, sizeof (VinoStatusIconPrivate));
572
568
}
573
569
 
574
 
#ifdef VINO_HAVE_LIBNOTIFY
575
570
static void
576
571
vino_status_handle_new_client_notification_closed (VinoStatusIcon *icon)
577
572
{
578
573
  g_object_unref (icon->priv->new_client_notification);
579
574
  icon->priv->new_client_notification = NULL;
580
575
}
581
 
#endif /* VINO_HAVE_LIBNOTIFY */
582
576
 
583
577
static gboolean
584
578
vino_status_icon_show_new_client_notification (gpointer user_data)
585
579
{
586
 
#ifdef VINO_HAVE_LIBNOTIFY
587
580
#define NOTIFICATION_TIMEOUT 5
588
581
 
589
582
  GError     *error;
638
631
    }
639
632
 
640
633
  icon->priv->new_client_notification =
641
 
#ifdef VINO_HAVE_LIBNOTIFY_0_7
642
634
    notify_notification_new (summary,
643
635
                             body,
644
636
                             "preferences-desktop-remote-desktop");
645
 
#else
646
 
    notify_notification_new_with_status_icon (summary,
647
 
                                              body,
648
 
                                              "preferences-desktop-remote-desktop",
649
 
                                              GTK_STATUS_ICON (icon));
650
 
#endif
651
637
 
652
638
  g_free (body);
653
639
 
654
640
  g_signal_connect_swapped (icon->priv->new_client_notification, "closed",
655
641
                            G_CALLBACK (vino_status_handle_new_client_notification_closed),
656
642
                            icon);
657
 
 
 
643
  notify_notification_set_hint_string (icon->priv->new_client_notification,
 
644
                                       "desktop-entry", "vino-server");
658
645
  notify_notification_set_timeout (icon->priv->new_client_notification,
659
646
                                   NOTIFICATION_TIMEOUT * 1000);
660
647
 
669
656
  g_free (user_data);
670
657
 
671
658
#undef NOTIFICATION_TIMEOUT
672
 
#endif /* VINO_HAVE_LIBNOTIFY */
673
659
 
674
660
  return FALSE;
675
661
}