]> Dogcows Code - chaz/tint2/blob - src/tint2conf/main.c
cleanup tested code
[chaz/tint2] / src / tint2conf / main.c
1 /**************************************************************************
2 *
3 * Tint2conf
4 *
5 * Copyright (C) 2009 Thierry lorthiois (lorthiois@bbsoft.fr)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 **************************************************************************/
19
20 #include <stdio.h>
21 #include <locale.h>
22 #include <gtk/gtk.h>
23 #include <glib.h>
24 #include <glib/gstdio.h>
25 #include <glib/gi18n.h>
26
27
28 // gcc -Wall -g main.c -o tint2conf `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0 --libs gthread-2.0`
29 // need GTK+-2.4 ou plus
30
31 #define LONG_VERSION_STRING "0.2"
32
33 static GtkUIManager *myUIManager = NULL;
34
35 static const char *fallback_ui_file =
36 "<ui>"
37 " <menubar name='MenuBar'>"
38 " <menu action='ThemeMenu'>"
39 " </menu>"
40 " </menubar>"
41 " <toolbar name='ToolBar'>"
42 " <toolitem action='ViewRefreshAll'/>"
43 " <separator/>"
44 " <toolitem action='ThemeProperties'/>"
45 " <toolitem action='ViewApply'/>"
46 " </toolbar>"
47 "</ui>";
48
49
50 static void about( GtkWindow * parent )
51 {
52 const char *authors[] = { "Thierry Lorthiois", "Christian Ruppert (Build system)", NULL };
53
54 const char *website_url = "http://code.google.com/p/tint2/";
55
56 gtk_show_about_dialog( parent, "name", g_get_application_name( ),
57 "comments", _( "Theming tool for tint2 panel" ),
58 "version", LONG_VERSION_STRING,
59 "website", website_url, "website-label", website_url,
60 "copyright", _( "Copyright 2009 Thierry Lorthiois" ),
61 "logo-icon-name", "",
62 #ifdef SHOW_LICENSE
63 "license", LICENSE, "wrap-license", TRUE,
64 #endif
65 "authors", authors,
66 /* Translators: translate "translator-credits" as
67 your name to have it appear in the credits in the "About"
68 dialog */
69 "translator-credits", _( "translator-credits" ),
70 NULL );
71 }
72
73
74 static void destroy( GtkWidget *widget, gpointer data )
75 {
76 gtk_main_quit ();
77 }
78
79
80 int main (int argc, char ** argv)
81 {
82 /*
83 bindtextdomain( domain, LOCALEDIR );
84 bind_textdomain_codeset( domain, "UTF-8" );
85 textdomain( domain );
86 */
87
88 setlocale( LC_ALL, "" );
89 gtk_init (&argc, &argv);
90 g_thread_init( NULL );
91
92 GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
93 gtk_window_set_title(GTK_WINDOW(window), "Tint2 theme");
94 gtk_window_set_default_size(GTK_WINDOW(window), 600, 350);
95
96 // define GUI action
97 myUIManager = gtk_ui_manager_new ( );
98 GtkActionGroup *action_group;
99
100 //actions_init ( myUIManager, cbdata );
101 gtk_ui_manager_add_ui_from_string ( myUIManager, fallback_ui_file, -1, NULL );
102 gtk_ui_manager_ensure_update ( myUIManager );
103
104 // XDG specification
105 char *dir = g_build_filename (g_get_user_config_dir(), "tint2", NULL);
106 if (!g_file_test (dir, G_FILE_TEST_IS_DIR)) g_mkdir(dir, 0777);
107 //window.view.set_dir(dir);
108 //window.view.load_dir();
109 g_free(dir);
110
111 g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
112 // rig up idle/thread routines
113 //Glib::Thread::create(sigc::mem_fun(window.view, &Thumbview::load_cache_images), true);
114 //Glib::Thread::create(sigc::mem_fun(window.view, &Thumbview::create_cache_images), true);
115
116 gtk_widget_show (window);
117 gtk_main ();
118
119 return 0;
120 }
121
This page took 0.039506 seconds and 5 git commands to generate.