gtk3-ui: Use CSS styling

This commit is contained in:
Jussi Kukkonen 2011-11-22 15:49:14 +02:00 committed by Patrick Ohly
parent aceb1e5df2
commit f5b72fbe2c
5 changed files with 66 additions and 58 deletions

View file

@ -31,7 +31,7 @@ dist_src_gtk3_ui_icon_DATA = src/gtk3-ui/sync.png
src_gtk3_ui_themercfiles = \
src/gtk3-ui/sync-generic.png \
src/gtk3-ui/sync-spinner.gif \
src/gtk3-ui/sync-ui.rc
src/gtk3-ui/sync-ui.css
src_gtk3_ui_themercdir = $(datadir)/syncevolution/
dist_src_gtk3_ui_themerc_DATA = $(src_gtk3_ui_themercfiles)

View file

@ -1242,9 +1242,8 @@ init_ui (app_data *data)
GError *error = NULL;
GtkWidget *frame, * service_error_box, *btn;
GtkAdjustment *adj;
gtk_rc_parse (THEMEDIR "sync-ui.rc");
GtkCssProvider *provider;
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, GLADEDIR "ui.xml", &error);
if (error) {
@ -1366,6 +1365,21 @@ init_ui (app_data *data)
init_bluetooth_ui (data);
/* custom styling */
provider = gtk_css_provider_new ();
if (gtk_css_provider_load_from_path (provider, THEMEDIR "sync-ui.css", &error)) {
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
} else {
g_printerr ("Failed to load styles from %s: %s\n",
THEMEDIR "sync-ui.css",
error->message);
g_error_free (error);
error = NULL;
}
g_object_unref (builder);
return TRUE;

43
src/gtk3-ui/sync-ui.css Normal file
View file

@ -0,0 +1,43 @@
# generic rules for MuxWidgets
MuxFrame {
background-color : #ffffff;
-MuxFrame-border-color : #dee2e5;
-MuxFrame-bullet-color : #aaaaaa;
-MuxFrame-title-font : Bold 12;
}
MuxFrame:insensitive {
background-color : #ffffff;
}
# sync-ui specific rules
GtkWindow#meego_win {
background-color : #4a535a;
}
GtkEventBox#sync_data_and_type_box,
GtkEventBox#sync_data_and_type_box:insensitive {
background-color : #ececec;
}
GtkFrame#log_frame:insensitive,
GtkFrame#backup_frame:insensitive,
GtkFrame#services_frame:insensitive {
background-color : #d2d6d9;
}
GtkLabel#sync_service_label,
GtkLabel#sync_status_label,
GtkLabel#no_server_label,
GtkLabel#sync_failure_label {
font : Bold 11;
}
GtkButton#sync_btn {
-GtkButton-inner-border : 10 10 10 10;
font : Bold 11;
}

View file

@ -1,49 +0,0 @@
# generic rules for MuxWidgets
style "mux-frame" {
bg[NORMAL] = "#ffffff"
bg[INSENSITIVE] = "#ffffff"
MuxFrame::border-color = "#dee2e5"
MuxFrame::bullet-color = "#aaaaaa"
MuxFrame::title-font = "Bold 12"
}
class "MuxFrame" style "mux-frame"
# sync-ui specific rules
style "meego-win" {
bg[NORMAL] = "#4a535a"
}
widget "meego_win" style "meego-win"
style "data-box" {
bg[NORMAL] = "#ececec"
bg[INSENSITIVE] = "#ececec"
}
widget "*.sync_data_and_type_box" style "data-box"
style "insensitive-frame" {
bg[INSENSITIVE] = "#d2d6d9"
}
widget "*.log_frame*" style "insensitive-frame"
widget "*.backup_frame*" style "insensitive-frame"
widget "*.services_frame*" style "insensitive-frame"
style "service-title" {
font_name = "Bold 14"
}
widget "*.sync_service_label" style "service-title"
widget "*.sync_status_label" style "service-title"
widget "*.no_server_label" style "service-title"
widget "*.sync_failure_label" style "service-title"
style "big-button" {
GtkButton::inner-border = { 10,10,10,10 }
font_name = "Bold 11"
}
widget "*.sync_btn*" style "big-button"
style "bread-crumb-button" {
GtkButton::inner-border = { 5,5,0,0 }
}
widget "*.mux_window_bread_crumbs.*GtkButton*" style "bread-crumb-button"

View file

@ -1489,22 +1489,22 @@ emergency</property>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>