2007-04-30 16:51:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 The GNOME Foundation
|
|
|
|
* Written by Thomas Wood <thos@gnome.org>
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2007-04-30 14:33:05 +00:00
|
|
|
#include "appearance.h"
|
2007-05-02 14:04:53 +00:00
|
|
|
#include "appearance-desktop.h"
|
2007-05-04 17:18:34 +00:00
|
|
|
#include "appearance-font.h"
|
2007-04-30 14:33:05 +00:00
|
|
|
#include "appearance-themes.h"
|
2007-05-07 19:09:24 +00:00
|
|
|
#include "appearance-style.h"
|
2007-05-01 13:02:29 +00:00
|
|
|
#include "appearance-ui.h"
|
2007-04-30 14:33:05 +00:00
|
|
|
#include "theme-thumbnail.h"
|
|
|
|
#include "activate-settings-daemon.h"
|
2007-05-06 20:14:56 +00:00
|
|
|
#include "capplet-util.h"
|
2007-04-30 14:33:05 +00:00
|
|
|
|
|
|
|
/* required for gnome_program_init(): */
|
|
|
|
#include <libgnome/libgnome.h>
|
|
|
|
#include <libgnomeui/gnome-ui-init.h>
|
|
|
|
/* ---------------------------------- */
|
|
|
|
|
2007-04-30 16:55:29 +00:00
|
|
|
static AppearanceData *
|
2007-06-10 17:37:00 +00:00
|
|
|
init_appearance_data (int *argc, char ***argv)
|
2007-04-30 14:33:05 +00:00
|
|
|
{
|
2007-04-30 16:55:29 +00:00
|
|
|
AppearanceData *data = NULL;
|
|
|
|
gchar *gladefile;
|
|
|
|
GladeXML *ui;
|
2007-04-30 14:33:05 +00:00
|
|
|
|
2007-04-30 16:55:29 +00:00
|
|
|
g_thread_init (NULL);
|
2007-06-10 17:37:00 +00:00
|
|
|
theme_thumbnail_factory_init (*argc, *argv);
|
|
|
|
gtk_init (argc, argv);
|
2007-04-30 14:33:05 +00:00
|
|
|
gnome_vfs_init ();
|
|
|
|
activate_settings_daemon ();
|
|
|
|
|
|
|
|
/* set up the data */
|
2007-04-30 16:55:29 +00:00
|
|
|
gladefile = g_build_filename (GNOMECC_GLADE_DIR, "appearance.glade", NULL);
|
2007-05-13 15:20:18 +00:00
|
|
|
ui = glade_xml_new (gladefile, NULL, NULL);
|
2007-04-30 16:55:29 +00:00
|
|
|
g_free (gladefile);
|
|
|
|
|
|
|
|
if (ui) {
|
|
|
|
data = g_new (AppearanceData, 1);
|
2007-05-01 10:25:29 +00:00
|
|
|
data->client = gconf_client_get_default ();
|
2007-04-30 16:55:29 +00:00
|
|
|
data->xml = ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2007-06-04 20:23:47 +00:00
|
|
|
static void
|
|
|
|
main_window_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
AppearanceData *data)
|
|
|
|
{
|
|
|
|
if (response_id == GTK_RESPONSE_CLOSE ||
|
|
|
|
response_id == GTK_RESPONSE_DELETE_EVENT)
|
|
|
|
{
|
|
|
|
gtk_main_quit ();
|
|
|
|
|
|
|
|
themes_shutdown (data);
|
|
|
|
desktop_shutdown (data);
|
|
|
|
font_shutdown (data);
|
|
|
|
|
|
|
|
g_object_unref (data->client);
|
|
|
|
g_object_unref (data->xml);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-30 16:55:29 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
AppearanceData *data;
|
2007-06-04 20:23:47 +00:00
|
|
|
GtkWidget *win;
|
2007-04-30 16:55:29 +00:00
|
|
|
GnomeProgram *program;
|
|
|
|
|
|
|
|
/* init */
|
2007-06-10 17:37:00 +00:00
|
|
|
data = init_appearance_data (&argc, &argv);
|
2007-04-30 16:55:29 +00:00
|
|
|
if (!data)
|
|
|
|
return 1;
|
2007-04-30 14:33:05 +00:00
|
|
|
|
|
|
|
/* this appears to be required for gnome_wm_manager_init (), which is called
|
|
|
|
* inside gnome_meta_theme_set ();
|
|
|
|
* TODO: try to remove if possible
|
|
|
|
*/
|
|
|
|
program = gnome_program_init ("appearance", VERSION,
|
|
|
|
LIBGNOMEUI_MODULE, argc, argv,
|
|
|
|
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* init tabs */
|
|
|
|
themes_init (data);
|
2007-05-07 19:09:24 +00:00
|
|
|
style_init (data);
|
2007-05-02 14:04:53 +00:00
|
|
|
desktop_init (data);
|
2007-05-04 17:18:34 +00:00
|
|
|
font_init (data);
|
2007-05-01 13:02:29 +00:00
|
|
|
ui_init (data);
|
2007-04-30 14:33:05 +00:00
|
|
|
|
2007-04-30 17:50:37 +00:00
|
|
|
/* prepare the main window */
|
2007-06-04 20:23:47 +00:00
|
|
|
win = glade_xml_get_widget (data->xml, "appearance_window");
|
|
|
|
capplet_set_icon (win, "gnome-settings-theme");
|
|
|
|
gtk_widget_show_all (win);
|
2007-04-30 14:33:05 +00:00
|
|
|
|
2007-06-04 20:23:47 +00:00
|
|
|
g_signal_connect_after (G_OBJECT (win), "response",
|
|
|
|
G_CALLBACK (main_window_response), data);
|
2007-05-07 17:19:34 +00:00
|
|
|
|
2007-04-30 17:50:37 +00:00
|
|
|
/* start the mainloop */
|
2007-04-30 14:33:05 +00:00
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
/* free stuff */
|
|
|
|
g_free (data);
|
2007-04-30 16:55:29 +00:00
|
|
|
g_object_unref (program);
|
2007-04-30 14:33:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|