also show a missing theme engine in the GTK themes list and offer to
2008-05-08 Jens Granseuer <jensgr@gmx.net> * appearance-style.c: (style_message_area_response_cb), (update_message_area), (gtk_theme_changed), (style_init): * appearance.h: * data/appearance.glade: also show a missing theme engine in the GTK themes list and offer to install it via packagekit svn path=/trunk/; revision=8698
This commit is contained in:
parent
a854fc712c
commit
33afa2a334
4 changed files with 122 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-05-08 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* appearance-style.c: (style_message_area_response_cb),
|
||||
(update_message_area), (gtk_theme_changed), (style_init):
|
||||
* appearance.h:
|
||||
* data/appearance.glade: also show a missing theme engine in the
|
||||
GTK themes list and offer to install it via packagekit
|
||||
|
||||
2008-05-07 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
Add support for installing missing GTK+ theme engines via
|
||||
|
|
|
@ -26,12 +26,15 @@
|
|||
#include "gtkrc-utils.h"
|
||||
#include "gconf-property-editor.h"
|
||||
#include "theme-thumbnail.h"
|
||||
#include "gedit-message-area.h"
|
||||
|
||||
typedef void (* ThumbnailGenFunc) (void *type,
|
||||
ThemeThumbnailFunc theme,
|
||||
AppearanceData *data,
|
||||
GDestroyNotify *destroy);
|
||||
|
||||
static void update_message_area (AppearanceData *data);
|
||||
|
||||
static const gchar *symbolic_names[NUM_SYMBOLIC_COLORS] = {
|
||||
"fg_color", "bg_color",
|
||||
"text_color", "base_color",
|
||||
|
@ -168,6 +171,91 @@ cursor_theme_sort_func (GtkTreeModel *model,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
style_message_area_response_cb (GtkWidget *w,
|
||||
gint response_id,
|
||||
AppearanceData *data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
gchar *theme;
|
||||
gchar *engine_path;
|
||||
|
||||
g_object_get (settings, "gtk-theme-name", &theme, NULL);
|
||||
engine_path = gtk_theme_info_missing_engine (theme, FALSE);
|
||||
g_free (theme);
|
||||
|
||||
if (engine_path != NULL) {
|
||||
theme_install_file (GTK_WINDOW (gtk_widget_get_toplevel (data->style_message_area)),
|
||||
engine_path);
|
||||
g_free (engine_path);
|
||||
}
|
||||
update_message_area (data);
|
||||
}
|
||||
|
||||
static void
|
||||
update_message_area (AppearanceData *data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
gchar *theme = NULL;
|
||||
gchar *engine;
|
||||
|
||||
g_object_get (settings, "gtk-theme-name", &theme, NULL);
|
||||
engine = gtk_theme_info_missing_engine (theme, TRUE);
|
||||
g_free (theme);
|
||||
|
||||
if (data->style_message_area == NULL) {
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *parent;
|
||||
GtkWidget *icon;
|
||||
|
||||
if (engine == NULL)
|
||||
return;
|
||||
|
||||
data->style_message_area = gedit_message_area_new ();
|
||||
|
||||
g_signal_connect (data->style_message_area, "response",
|
||||
(GCallback) style_message_area_response_cb, data);
|
||||
|
||||
data->style_install_button = gedit_message_area_add_button (
|
||||
GEDIT_MESSAGE_AREA (data->style_message_area),
|
||||
_("Install"), GTK_RESPONSE_APPLY);
|
||||
|
||||
data->style_message_label = gtk_label_new (NULL);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (data->style_message_label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (data->style_message_label), 0.0, 0.5);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 9);
|
||||
icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), data->style_message_label, TRUE, TRUE, 0);
|
||||
gedit_message_area_set_contents (GEDIT_MESSAGE_AREA (data->style_message_area), hbox);
|
||||
gtk_widget_show_all (data->style_message_area);
|
||||
gtk_widget_set_no_show_all (data->style_message_area, TRUE);
|
||||
|
||||
parent = glade_xml_get_widget (data->xml, "gtk_themes_vbox");
|
||||
gtk_box_pack_start (GTK_BOX (parent), data->style_message_area, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
if (engine != NULL) {
|
||||
gchar *message = g_strdup_printf (_("This theme will not look as intended because the required GTK+ theme engine '%s' is not installed."),
|
||||
engine);
|
||||
gtk_label_set_text (GTK_LABEL (data->style_message_label), message);
|
||||
g_free (message);
|
||||
g_free (engine);
|
||||
|
||||
if (packagekit_available ())
|
||||
gtk_widget_show (data->style_install_button);
|
||||
else
|
||||
gtk_widget_hide (data->style_install_button);
|
||||
|
||||
gtk_widget_show (data->style_message_area);
|
||||
gtk_widget_queue_draw (data->style_message_area);
|
||||
} else {
|
||||
gtk_widget_hide (data->style_message_area);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_color_buttons_from_string (const gchar *color_scheme, AppearanceData *data)
|
||||
{
|
||||
|
@ -318,8 +406,10 @@ gtk_theme_changed (GConfPropertyEditor *peditor,
|
|||
* info for the color scheme updates already. */
|
||||
g_object_get (settings, "gtk-theme-name", ¤t, NULL);
|
||||
|
||||
if (strcmp (current, name) != 0)
|
||||
if (strcmp (current, name) != 0) {
|
||||
g_object_set (settings, "gtk-theme-name", name, NULL);
|
||||
update_message_area (data);
|
||||
}
|
||||
|
||||
g_free (current);
|
||||
|
||||
|
@ -855,6 +945,9 @@ style_init (AppearanceData *data)
|
|||
data->gtk_theme_icon = gdk_pixbuf_new_from_file (GNOMECC_PIXMAP_DIR "/gtk-theme-thumbnailing.png", NULL);
|
||||
data->window_theme_icon = gdk_pixbuf_new_from_file (GNOMECC_PIXMAP_DIR "/window-theme-thumbnailing.png", NULL);
|
||||
data->icon_theme_icon = gdk_pixbuf_new_from_file (GNOMECC_PIXMAP_DIR "/icon-theme-thumbnailing.png", NULL);
|
||||
data->style_message_area = NULL;
|
||||
data->style_message_label = NULL;
|
||||
data->style_install_button = NULL;
|
||||
|
||||
w = glade_xml_get_widget (data->xml, "theme_details");
|
||||
g_signal_connect (w, "response", (GCallback) style_response_cb, NULL);
|
||||
|
@ -910,6 +1003,7 @@ style_init (AppearanceData *data)
|
|||
g_signal_connect (glade_xml_get_widget (data->xml, "icon_themes_delete"), "clicked", (GCallback) icon_theme_delete_cb, data);
|
||||
g_signal_connect (glade_xml_get_widget (data->xml, "cursor_themes_delete"), "clicked", (GCallback) cursor_theme_delete_cb, data);
|
||||
|
||||
update_message_area (data);
|
||||
gnome_theme_info_register_theme_change ((ThemeChangedCallback) changed_on_disk_cb, data);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,4 +75,7 @@ typedef struct {
|
|||
GdkPixbuf *gtk_theme_icon;
|
||||
GdkPixbuf *window_theme_icon;
|
||||
GdkPixbuf *icon_theme_icon;
|
||||
GtkWidget *style_message_area;
|
||||
GtkWidget *style_message_label;
|
||||
GtkWidget *style_install_button;
|
||||
} AppearanceData;
|
||||
|
|
|
@ -1893,21 +1893,28 @@ Text only</property>
|
|||
<property name="border_width">12</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow3">
|
||||
<widget class="GtkVBox" id="gtk_themes_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="gtk_themes_list">
|
||||
<property name="height_request">300</property>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="gtk_themes_list">
|
||||
<property name="height_request">300</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue