Exemplo n.º 1
0
static void
show_twitch_login_cb(GSimpleAction* action,
                     GVariant* par,
                     gpointer udata)
{
    GtWin* self = GT_WIN(udata);
    GtWinPrivate* priv = gt_win_get_instance_private(self);
    gchar* oauth_token;
    gchar* user_name;

    g_object_get(main_app,
                 "oauth-token", &oauth_token,
                 "user-name", &user_name,
                 NULL);

    if (oauth_token && user_name &&
        strlen(oauth_token) > 0 && strlen(user_name) > 0)
    {
        gt_win_ask_question(self, _("Already logged into Twitch, refresh login?"),
                            G_CALLBACK(refresh_login_cb), self);
    }
    else
    {
        GtTwitchLoginDlg* dlg = gt_twitch_login_dlg_new(GTK_WINDOW(self));

        gtk_window_present(GTK_WINDOW(dlg));
    }
}
Exemplo n.º 2
0
void
gt_win_show_error_message(GtWin* self, const gchar* secondary, const gchar* details)
{
    GtWinPrivate* priv = gt_win_get_instance_private(self);
    QueuedInfoData* data = g_new(QueuedInfoData, 1);
    gchar** udata = g_malloc(sizeof(gchar*)*3);
    // Translators: Please keep the markup tags
    gchar* msg = g_strdup_printf(_("<b>Something went wrong:</b> %s."), secondary);

    *udata = g_strdup(secondary);
    *(udata+1) = g_strdup(details);
    *(udata+2) = NULL;

    gt_win_ask_question(self, msg, G_CALLBACK(show_error_dialogue_cb), udata);
}
Exemplo n.º 3
0
static void
follows_all_cb(GObject* source,
               GAsyncResult* res,
               gpointer udata)
{
    GtFavouritesManager* self = GT_FAVOURITES_MANAGER(udata);
    GtFavouritesManagerPrivate* priv = gt_favourites_manager_get_instance_private(self);
    GError* error = NULL;
    GList* list = g_task_propagate_pointer(G_TASK(res), &error);
    gchar* fp = FAV_CHANNELS_FILE;

    if (error)
    {
        g_error_free(error);
        return;
    }

    if (list)
    {
        for (GList* l = list; l != NULL; l = l->next)
        {
            GtChannel* chan = l->data;

            g_signal_handlers_block_by_func(chan, channel_favourited_cb, self);
            g_object_set(chan,
                         "auto-update", TRUE,
                         "favourited", TRUE,
                         NULL);
            g_object_ref_sink(chan);
            g_signal_emit(self, sigs[SIG_CHANNEL_FAVOURITED], 0, chan);
            g_signal_handlers_unblock_by_func(chan, channel_favourited_cb, self);
        }

        self->favourite_channels = list;
    }

    if (g_file_test(fp, G_FILE_TEST_EXISTS))
        gt_win_ask_question(GT_WIN_ACTIVE,
                            _("GNOME Twitch has detected local favourites, would you like to move them to Twitch?"),
                            G_CALLBACK(move_local_favourites_cb), self);

    g_signal_emit(self, sigs[SIG_FINISHED_LOADING_FAVOURITES], 0);

    g_free(fp);
}