Merge in changes from RedHat
This commit is contained in:
parent
ded4768f61
commit
3c03dd586d
2 changed files with 210 additions and 89 deletions
|
@ -21,10 +21,8 @@
|
||||||
|
|
||||||
<child internal-child="action_area">
|
<child internal-child="action_area">
|
||||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
<property name="border_width">5</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
<property name="spacing">10</property>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="helpbutton1">
|
<widget class="GtkButton" id="helpbutton1">
|
||||||
|
@ -178,6 +176,7 @@
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox5">
|
<widget class="GtkHBox" id="hbox5">
|
||||||
|
<property name="border_width">8</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">8</property>
|
<property name="spacing">8</property>
|
||||||
|
@ -222,7 +221,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -298,6 +297,21 @@
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">8</property>
|
<property name="spacing">8</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="window_install_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Install New Theme...</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="window_manage_button">
|
<widget class="GtkButton" id="window_manage_button">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -326,6 +340,57 @@
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="image2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-dialog-info</property>
|
||||||
|
<property name="icon_size">6</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label13">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">New themes can also be installed by dragging them into the window.</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="tab_expand">False</property>
|
<property name="tab_expand">False</property>
|
||||||
|
|
|
@ -19,11 +19,19 @@
|
||||||
#include "gconf-property-editor.h"
|
#include "gconf-property-editor.h"
|
||||||
#include "file-transfer-dialog.h"
|
#include "file-transfer-dialog.h"
|
||||||
|
|
||||||
|
/* FIXME: This shouldn't be hardcoded
|
||||||
|
*/
|
||||||
|
#define METACITY_THEME_LOCATION "/usr/share/themes"
|
||||||
|
|
||||||
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
|
||||||
#define WINDOW_THEME_KEY "/desktop/gnome/applications/window_manager/theme"
|
#define WINDOW_THEME_KEY "/desktop/gnome/applications/window_manager/theme"
|
||||||
|
#define METACITY_THEME_DIR "/apps/metacity/general"
|
||||||
|
#define METACITY_THEME_KEY METACITY_THEME_DIR "/theme"
|
||||||
|
|
||||||
#define MAX_ELEMENTS_BEFORE_SCROLLING 8
|
#define MAX_ELEMENTS_BEFORE_SCROLLING 8
|
||||||
|
|
||||||
|
static void read_themes (GladeXML *dialog);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
THEME_NAME_COLUMN,
|
THEME_NAME_COLUMN,
|
||||||
|
@ -48,6 +56,7 @@ static gboolean setting_model = FALSE;
|
||||||
static gboolean initial_scroll = TRUE;
|
static gboolean initial_scroll = TRUE;
|
||||||
static gboolean window_setting_model = FALSE;
|
static gboolean window_setting_model = FALSE;
|
||||||
static gboolean window_initial_scroll = TRUE;
|
static gboolean window_initial_scroll = TRUE;
|
||||||
|
static gboolean running_theme_install = FALSE;
|
||||||
|
|
||||||
static GladeXML *
|
static GladeXML *
|
||||||
create_dialog (void)
|
create_dialog (void)
|
||||||
|
@ -61,7 +70,7 @@ create_dialog (void)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
theme_selection_changed (GtkTreeSelection *selection,
|
theme_selection_changed (GtkTreeSelection *selection,
|
||||||
gpointer data)
|
const gchar *gconf_key)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
gchar *new_key;
|
gchar *new_key;
|
||||||
|
@ -89,107 +98,68 @@ theme_selection_changed (GtkTreeSelection *selection,
|
||||||
{
|
{
|
||||||
gchar *old_key;
|
gchar *old_key;
|
||||||
|
|
||||||
old_key = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
|
old_key = gconf_client_get_string (client, gconf_key, NULL);
|
||||||
if (old_key && strcmp (old_key, new_key))
|
if (old_key && strcmp (old_key, new_key))
|
||||||
{
|
{
|
||||||
gconf_client_set_string (client, GTK_THEME_KEY, new_key, NULL);
|
gconf_client_set_string (client, gconf_key, new_key, NULL);
|
||||||
}
|
}
|
||||||
g_free (old_key);
|
g_free (old_key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gconf_client_unset (client, GTK_THEME_KEY, NULL);
|
gconf_client_unset (client, gconf_key, NULL);
|
||||||
}
|
}
|
||||||
g_free (new_key);
|
g_free (new_key);
|
||||||
|
g_object_unref (client);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_theme_selection_changed (GtkTreeSelection *selection,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
theme_selection_changed (selection, GTK_THEME_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_theme_selection_changed (GtkTreeSelection *selection,
|
window_theme_selection_changed (GtkTreeSelection *selection,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
theme_selection_changed (selection, METACITY_THEME_KEY);
|
||||||
gchar *new_key;
|
|
||||||
GConfClient *client;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
if (window_setting_model)
|
|
||||||
return;
|
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
||||||
{
|
|
||||||
gtk_tree_model_get (model, &iter,
|
|
||||||
THEME_NAME_COLUMN, &new_key,
|
|
||||||
-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
/* This shouldn't happen */
|
|
||||||
{
|
|
||||||
new_key = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_key != NULL)
|
|
||||||
{
|
|
||||||
gchar *old_key;
|
|
||||||
|
|
||||||
old_key = gconf_client_get_string (client, WINDOW_THEME_KEY, NULL);
|
|
||||||
if (old_key && strcmp (old_key, new_key))
|
|
||||||
{
|
|
||||||
gconf_client_set_string (client, WINDOW_THEME_KEY, new_key, NULL);
|
|
||||||
}
|
|
||||||
g_free (old_key);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gconf_client_unset (client, WINDOW_THEME_KEY, NULL);
|
|
||||||
}
|
|
||||||
g_free (new_key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_themes (GladeXML *dialog)
|
load_theme_names (GtkTreeView *tree_view,
|
||||||
|
GList *theme_list,
|
||||||
|
char *current_theme)
|
||||||
{
|
{
|
||||||
GConfClient *client;
|
|
||||||
GList *gtk_theme_list;
|
|
||||||
GList *list;
|
GList *list;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeView *tree_view;
|
GtkWidget *swindow;
|
||||||
gchar *current_theme;
|
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
gboolean current_theme_found = FALSE;
|
gboolean current_theme_found = FALSE;
|
||||||
GtkTreeRowReference *row_ref = NULL;
|
GtkTreeRowReference *row_ref = NULL;
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
swindow = GTK_WIDGET (tree_view)->parent;
|
||||||
|
|
||||||
gtk_theme_list = theme_common_get_list ();
|
|
||||||
tree_view = GTK_TREE_VIEW (WID ("theme_treeview"));
|
|
||||||
model = gtk_tree_view_get_model (tree_view);
|
model = gtk_tree_view_get_model (tree_view);
|
||||||
|
|
||||||
setting_model = TRUE;
|
setting_model = TRUE;
|
||||||
gtk_list_store_clear (GTK_LIST_STORE (model));
|
gtk_list_store_clear (GTK_LIST_STORE (model));
|
||||||
|
|
||||||
current_theme = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
|
||||||
if (current_theme == NULL)
|
|
||||||
current_theme = g_strdup ("Default");
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (WID ("theme_swindow")),
|
|
||||||
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
|
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
|
||||||
gtk_widget_set_usize (WID ("theme_swindow"), -1, -1);
|
gtk_widget_set_usize (swindow, -1, -1);
|
||||||
|
|
||||||
for (list = gtk_theme_list; list; list = list->next)
|
for (list = theme_list; list; list = list->next)
|
||||||
{
|
{
|
||||||
ThemeInfo *info = list->data;
|
const char *name = list->data;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if (! info->has_gtk)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
|
gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
|
||||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||||
THEME_NAME_COLUMN, info->name,
|
THEME_NAME_COLUMN, name,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (strcmp (current_theme, info->name) == 0)
|
if (strcmp (current_theme, name) == 0)
|
||||||
{
|
{
|
||||||
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
|
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
|
||||||
row_ref = gtk_tree_row_reference_new (model, path);
|
row_ref = gtk_tree_row_reference_new (model, path);
|
||||||
|
@ -201,8 +171,8 @@ read_themes (GladeXML *dialog)
|
||||||
{
|
{
|
||||||
GtkRequisition rectangle;
|
GtkRequisition rectangle;
|
||||||
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
||||||
gtk_widget_set_usize (WID ("theme_swindow"), -1, rectangle.height);
|
gtk_widget_set_usize (swindow, -1, rectangle.height);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (WID ("theme_swindow")),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
|
||||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -244,6 +214,49 @@ read_themes (GladeXML *dialog)
|
||||||
g_free (current_theme);
|
g_free (current_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
read_themes (GladeXML *dialog)
|
||||||
|
{
|
||||||
|
GList *theme_list, *gtk_theme_list, *metacity_theme_list;
|
||||||
|
GList *list;
|
||||||
|
GConfClient *client;
|
||||||
|
char *current_theme;
|
||||||
|
|
||||||
|
client = gconf_client_get_default ();
|
||||||
|
|
||||||
|
/* Read in themes
|
||||||
|
*/
|
||||||
|
theme_list = theme_common_get_list ();
|
||||||
|
|
||||||
|
gtk_theme_list = NULL;
|
||||||
|
metacity_theme_list = NULL;
|
||||||
|
for (list = theme_list; list; list = list->next)
|
||||||
|
{
|
||||||
|
ThemeInfo *info = list->data;
|
||||||
|
|
||||||
|
if (info->has_gtk)
|
||||||
|
gtk_theme_list = g_list_prepend (gtk_theme_list, info->name);
|
||||||
|
if (info->has_metacity){
|
||||||
|
metacity_theme_list = g_list_prepend (metacity_theme_list, info->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
current_theme = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
|
||||||
|
if (current_theme == NULL)
|
||||||
|
current_theme = g_strdup ("Default");
|
||||||
|
|
||||||
|
load_theme_names (GTK_TREE_VIEW (WID ("theme_treeview")), gtk_theme_list, current_theme);
|
||||||
|
|
||||||
|
current_theme = gconf_client_get_string (client, METACITY_THEME_KEY, NULL);
|
||||||
|
if (current_theme == NULL)
|
||||||
|
current_theme = g_strdup ("Default");
|
||||||
|
|
||||||
|
load_theme_names (GTK_TREE_VIEW (WID ("window_theme_treeview")), metacity_theme_list, current_theme);
|
||||||
|
|
||||||
|
g_list_free (gtk_theme_list);
|
||||||
|
g_list_free (metacity_theme_list);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_read_themes (GladeXML *dialog)
|
window_read_themes (GladeXML *dialog)
|
||||||
{
|
{
|
||||||
|
@ -365,6 +378,18 @@ theme_key_changed (GConfClient *client,
|
||||||
read_themes ((GladeXML *)user_data);
|
read_themes ((GladeXML *)user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
metacity_key_changed (GConfClient *client,
|
||||||
|
guint cnxn_id,
|
||||||
|
GConfEntry *entry,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
if (strcmp (entry->key, METACITY_THEME_KEY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
read_themes ((GladeXML *)user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_theme_key_changed (GConfClient *client,
|
window_theme_key_changed (GConfClient *client,
|
||||||
guint cnxn_id,
|
guint cnxn_id,
|
||||||
|
@ -536,23 +561,40 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_install_dialog (GtkWidget *button, gpointer parent)
|
real_show_install_dialog (gpointer parent, gchar *filename)
|
||||||
{
|
{
|
||||||
GladeXML *dialog = glade_xml_new (GLADEDIR "/theme-install.glade", NULL, NULL);
|
GladeXML *dialog;
|
||||||
GtkWidget *widget = WID ("install_dialog");
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
if (running_theme_install)
|
||||||
|
return;
|
||||||
|
|
||||||
|
running_theme_install = TRUE;
|
||||||
|
|
||||||
|
dialog = glade_xml_new (GLADEDIR "/theme-install.glade", NULL, NULL);
|
||||||
|
widget = WID ("install_dialog");
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (widget), "response",
|
g_signal_connect (G_OBJECT (widget), "response",
|
||||||
G_CALLBACK (install_dialog_response), dialog);
|
G_CALLBACK (install_dialog_response), dialog);
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (widget), parent);
|
gtk_window_set_transient_for (GTK_WINDOW (widget), parent);
|
||||||
gtk_window_set_position (GTK_WINDOW (widget), GTK_WIN_POS_CENTER_ON_PARENT);
|
gtk_window_set_position (GTK_WINDOW (widget), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||||
|
if (filename)
|
||||||
|
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("install_theme_picker")), filename);
|
||||||
|
|
||||||
while (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_HELP)
|
while (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_HELP)
|
||||||
;
|
;
|
||||||
|
|
||||||
gtk_widget_destroy (widget);
|
gtk_widget_destroy (widget);
|
||||||
g_object_unref (G_OBJECT (dialog));
|
g_object_unref (G_OBJECT (dialog));
|
||||||
|
|
||||||
|
running_theme_install = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_install_dialog (GtkWidget *button, gpointer parent)
|
||||||
|
{
|
||||||
|
real_show_install_dialog (parent, NULL);
|
||||||
|
}
|
||||||
/* Callback issued during drag movements */
|
/* Callback issued during drag movements */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -579,7 +621,6 @@ drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
|
||||||
guint info, guint time, gpointer data)
|
guint info, guint time, gpointer data)
|
||||||
{
|
{
|
||||||
GList *uris;
|
GList *uris;
|
||||||
GladeXML *dialog = data;
|
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
|
||||||
if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
|
if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
|
||||||
|
@ -593,11 +634,10 @@ drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
filename = gnome_vfs_uri_to_string (uris->data, GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD);
|
filename = gnome_vfs_uri_to_string (uris->data, GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD);
|
||||||
}
|
}
|
||||||
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("install_theme_picker")), filename);
|
|
||||||
g_free (filename);
|
|
||||||
gnome_vfs_uri_list_unref (uris);
|
gnome_vfs_uri_list_unref (uris);
|
||||||
|
|
||||||
show_install_dialog (NULL, widget);
|
real_show_install_dialog (widget, filename);
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -633,17 +673,18 @@ cb_dialog_response (GtkDialog *dialog, gint response_id)
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
setup_theme_tree (GtkTreeView *tree_view, GCallback theme_selection_changed_cb)
|
setup_tree_view (GtkTreeView *tree_view,
|
||||||
|
GCallback changed_callback)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
gtk_tree_view_insert_column_with_attributes (tree_view,
|
gtk_tree_view_insert_column_with_attributes (tree_view,
|
||||||
-1, NULL,
|
-1, NULL,
|
||||||
gtk_cell_renderer_text_new (),
|
gtk_cell_renderer_text_new (),
|
||||||
"text", THEME_NAME_COLUMN,
|
"text", THEME_NAME_COLUMN,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
|
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
|
||||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model), 0, sort_func, NULL, NULL);
|
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model), 0, sort_func, NULL, NULL);
|
||||||
|
@ -651,24 +692,28 @@ setup_theme_tree (GtkTreeView *tree_view, GCallback theme_selection_changed_cb)
|
||||||
gtk_tree_view_set_model (tree_view, model);
|
gtk_tree_view_set_model (tree_view, model);
|
||||||
selection = gtk_tree_view_get_selection (tree_view);
|
selection = gtk_tree_view_get_selection (tree_view);
|
||||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
||||||
g_signal_connect (G_OBJECT (selection), "changed", (GCallback) theme_selection_changed_cb, NULL);}
|
g_signal_connect (G_OBJECT (selection), "changed", changed_callback, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_dialog (GladeXML *dialog)
|
setup_dialog (GladeXML *dialog)
|
||||||
{
|
{
|
||||||
GConfClient *client;
|
GConfClient *client;
|
||||||
GtkWidget *widget, *parent;
|
GtkWidget *parent, *widget;
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
parent = WID ("theme_dialog");
|
parent = WID ("theme_dialog");
|
||||||
|
|
||||||
setup_theme_tree (GTK_TREE_VIEW (WID ("theme_treeview")), (GCallback)theme_selection_changed);
|
setup_tree_view (GTK_TREE_VIEW (WID ("theme_treeview")),
|
||||||
setup_theme_tree (GTK_TREE_VIEW (WID ("window_theme_treeview")), (GCallback)window_theme_selection_changed);
|
(GCallback)gtk_theme_selection_changed);
|
||||||
|
setup_tree_view (GTK_TREE_VIEW (WID ("window_theme_treeview")),
|
||||||
|
(GCallback)window_theme_selection_changed);
|
||||||
|
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/applications/window_manager",
|
gconf_client_add_dir (client, "/desktop/gnome/applications/window_manager",
|
||||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
gconf_client_add_dir (client, METACITY_THEME_DIR,
|
||||||
|
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
|
||||||
gconf_client_notify_add (client,
|
gconf_client_notify_add (client,
|
||||||
GTK_THEME_KEY,
|
GTK_THEME_KEY,
|
||||||
|
@ -678,19 +723,30 @@ setup_dialog (GladeXML *dialog)
|
||||||
WINDOW_THEME_KEY,
|
WINDOW_THEME_KEY,
|
||||||
(GConfClientNotifyFunc) &window_theme_key_changed,
|
(GConfClientNotifyFunc) &window_theme_key_changed,
|
||||||
dialog, NULL, NULL);
|
dialog, NULL, NULL);
|
||||||
|
gconf_client_notify_add (client,
|
||||||
|
METACITY_THEME_KEY,
|
||||||
|
(GConfClientNotifyFunc) &metacity_key_changed,
|
||||||
|
dialog, NULL, NULL);
|
||||||
|
|
||||||
read_themes (dialog);
|
read_themes (dialog);
|
||||||
window_read_themes (dialog);
|
window_read_themes (dialog);
|
||||||
|
|
||||||
theme_common_register_theme_change (theme_changed_func, dialog);
|
theme_common_register_theme_change (theme_changed_func, dialog);
|
||||||
|
|
||||||
|
/* app themes */
|
||||||
widget = WID ("install_button");
|
widget = WID ("install_button");
|
||||||
g_signal_connect (G_OBJECT (widget), "clicked",
|
g_signal_connect (G_OBJECT (widget), "clicked",
|
||||||
G_CALLBACK (show_install_dialog), parent);
|
G_CALLBACK (show_install_dialog), parent);
|
||||||
widget = WID ("manage_button");
|
widget = WID ("manage_button");
|
||||||
g_signal_connect (G_OBJECT (widget), "clicked",
|
g_signal_connect (G_OBJECT (widget), "clicked",
|
||||||
G_CALLBACK (show_manage_themes), dialog);
|
G_CALLBACK (show_manage_themes), dialog);
|
||||||
g_signal_connect (G_OBJECT (WID ("window_manage_button")), "clicked",
|
|
||||||
|
/* window manager themes */
|
||||||
|
widget = WID ("window_install_button");
|
||||||
|
g_signal_connect (G_OBJECT (widget), "clicked",
|
||||||
|
G_CALLBACK (show_install_dialog), parent);
|
||||||
|
widget = WID ("window_manage_button");
|
||||||
|
g_signal_connect (G_OBJECT (widget), "clicked",
|
||||||
G_CALLBACK (window_show_manage_themes), dialog);
|
G_CALLBACK (window_show_manage_themes), dialog);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue