Esempio n. 1
0
File: mailme.c Progetto: jku/mailme
static void
on_unread_count_changed (GObject    *object,
                         GParamSpec *pspec,
                         gpointer    user_data)
{
  MailmeTelepathyAccount *account;
  NotifyNotification *note;
  gchar *display_name = NULL;
  guint unread_count = 0;
  guint last_unread_count;

  account = MAILME_TELEPATHY_ACCOUNT (object);
  note = g_object_get_data (object, "notification");

  g_return_if_fail (note != NULL);

  print_status (account);

  g_object_get (account,
                "display-name", &display_name,
                "unread-count", &unread_count,
                NULL);
  last_unread_count = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (account),
                                                           "last-unread-count"));

  update_notification (note, display_name, unread_count, last_unread_count);

  g_object_set_data (G_OBJECT (account), "last-unread-count",
                     GUINT_TO_POINTER(unread_count));
  g_free(display_name);
}
Esempio n. 2
0
File: mailme.c Progetto: jku/mailme
static void
on_get_inbox (GObject      *source,
              GAsyncResult *result,
              gpointer      user_data)
{
  MailmeInboxOpenFormat format;
  gchar *value;
  GError *error = NULL;

  value = mailme_telepathy_account_get_inbox_finish (
                                        MAILME_TELEPATHY_ACCOUNT (source),
                                        result,
                                        &format,
                                        &error);

  if (error)
  {
    g_warning ("Failed to get inbox information: %s", error->message);
    g_error_free (error);
    return;
  }

  switch (format) {
    case MAILME_INBOX_URI:
      if (!g_app_info_launch_default_for_uri (value, NULL, NULL))
        g_warning ("Failed to launch default handler for uri %s", value);
      break;
    default:
      g_warning ("Only inbox uri handling has been implemented");
      break;
  }

  g_free (value);
}
Esempio n. 3
0
static void
on_account_changed (GObject    *object,
                    GParamSpec *pspec,
                    gpointer    user_data)
{
   print_status (MAILME_TELEPATHY_ACCOUNT (object));
}
Esempio n. 4
0
File: mailme.c Progetto: jku/mailme
static void
on_open_action (NotifyNotification *notification,
                char *action,
                gpointer user_data)
{
  mailme_telepathy_account_get_inbox_async (MAILME_TELEPATHY_ACCOUNT (user_data),
                                            on_get_inbox,
                                            NULL);
}
Esempio n. 5
0
static void
_account_changed_cb (GObject    *object,
                     GParamSpec *pspec,
                     gpointer    user_data)
{
  GObject *widget = G_OBJECT (user_data);
  _update_count_pane (CLUTTER_ACTOR (widget),
                      MAILME_TELEPATHY_ACCOUNT (object));
}
Esempio n. 6
0
static void
_account_button_clicked_cb (MxButton *button,
                            gpointer  user_data)
{
  MailmeTelepathyAccount *account = MAILME_TELEPATHY_ACCOUNT (user_data);

  mailme_telepathy_account_get_inbox_async (
      account,
      _received_inbox_open_info_cb,
      button);
}
Esempio n. 7
0
static void
_received_inbox_open_info_cb (GObject      *source,
                              GAsyncResult *result,
                              gpointer      user_data)
{
  GError *error = NULL;
  MailmeInboxOpenFormat format;
  gchar *value;
  ClutterActor *actor = CLUTTER_ACTOR (user_data);

  value = mailme_telepathy_account_get_inbox_finish (
                                        MAILME_TELEPATHY_ACCOUNT (source),
                                        result,
                                        &format,
                                        &error);

  if (error)
  {
    g_warning ("Failed to get inbox information: %s", error->message);
    g_error_free (error);
    return;
  }

  switch (format)
  {
    case MAILME_INBOX_URI:
      if (!penge_utils_launch_for_uri (actor, value))
      {
        g_warning (G_STRLOC ": Error launching: %s", value);
      } else {
        penge_utils_signal_activated (actor);
      }
      break;

    case MAILME_INBOX_COMMAND_LINE:
      if (!penge_utils_launch_by_command_line (actor, value))
      {
        g_warning (G_STRLOC ": Error launching: %s", value);
      } else {
        penge_utils_signal_activated (actor);
      }
      break;

    default:
      g_warning ("Unknown inbox open format.");
  }
}
Esempio n. 8
0
static void
on_received_inbox_open_info (GObject      *source,
                             GAsyncResult *result,
                             gpointer      user_data)
{
  GError *error = NULL;
  MailmeInboxOpenFormat format;
  gchar *value;

  value = mailme_telepathy_account_get_inbox_finish (
                                        MAILME_TELEPATHY_ACCOUNT (source),
                                        result,
                                        &format,
                                        &error);

  if (error)
  {
    g_warning ("Failed to get inbox information: %s", error->message);
    g_error_free (error);
    return;
  }

  g_free (value);
}