public
Description: A Clutter-based Twitter client
Homepage: http://live.gnome.org/Tweet
Clone URL: git://github.com/ebassi/tweet.git
Search Repo:
Emmanuele Bassi (author)
Fri Apr 18 02:21:03 -0700 2008
commit  455bcf01d7cb8a5c84630024c693349a9c06dafe
tree    2eca12004870287376467b447dbfefccf872cc47
parent  72ff55611b6b5df82e6d7a270c279644c7ba252b
tweet / src / tweet-app.c
100644 74 lines (56 sloc) 1.36 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
 
#include <string.h>
#include <stdlib.h>
 
#include <glib.h>
 
#include <clutter/clutter.h>
#include <clutter-gtk/gtk-clutter-embed.h>
 
#include "tweet-app.h"
#include "tweet-config.h"
#include "tweet-window.h"
 
static TweetApp *default_app = NULL;
 
G_DEFINE_TYPE (TweetApp, tweet_app, G_TYPE_OBJECT);
 
static void
tweet_app_class_init (TweetAppClass *klass)
{
}
 
static void
tweet_app_init (TweetApp *app)
{
  app->config = tweet_config_get_default ();
  app->main_window = tweet_window_new ();
}
 
TweetApp *
tweet_app_get_default (int *argc,
                       char ***argv,
                       GError **error)
{
  if (!default_app)
    {
      g_thread_init (NULL);
      gtk_init (argc, argv);
      clutter_init (argc, argv);
 
      default_app = g_object_new (TWEET_TYPE_APP, NULL);
    }
 
  return default_app;
}
 
gboolean
tweet_app_is_running (TweetApp *app)
{
  g_return_val_if_fail (TWEET_IS_APP (app), FALSE);
 
  return app->is_running;
}
 
gint
tweet_app_run (TweetApp *app)
{
  g_return_val_if_fail (TWEET_IS_APP (app), EXIT_FAILURE);
  g_return_val_if_fail (!tweet_app_is_running (app), EXIT_SUCCESS);
 
  if (!tweet_config_get_username (app->config))
    {
      /* ask the user for the credentials */
    }
 
  gtk_main ();
 
  tweet_config_save (app->config);
 
  return EXIT_SUCCESS;
}