commit snapshot to leave the theme-switcher usable
This commit is contained in:
parent
6b994aa468
commit
eea6c7e6c1
2 changed files with 213 additions and 93 deletions
|
@ -72,6 +72,108 @@ create_dialog (void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
load_meta_themes (GtkTreeView *tree_view,
|
||||
GList *meta_theme_list,
|
||||
char *current_theme,
|
||||
char *default_theme)
|
||||
{
|
||||
GList *list;
|
||||
GtkTreeModel *model;
|
||||
GtkWidget *swindow;
|
||||
gint i = 0;
|
||||
gboolean current_theme_found = FALSE;
|
||||
GtkTreeRowReference *row_ref = NULL;
|
||||
|
||||
swindow = GTK_WIDGET (tree_view)->parent;
|
||||
model = gtk_tree_view_get_model (tree_view);
|
||||
|
||||
setting_model = TRUE;
|
||||
gtk_list_store_clear (GTK_LIST_STORE (model));
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
|
||||
gtk_widget_set_usize (swindow, -1, -1);
|
||||
|
||||
for (list = meta_theme_list; list; list = list->next)
|
||||
{
|
||||
GnomeThemeMetaInfo *meta_theme_info = list->data;
|
||||
gchar *blurb;
|
||||
GtkTreeIter iter;
|
||||
gboolean is_default;
|
||||
|
||||
gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
|
||||
|
||||
if (strcmp (default_theme, meta_theme_info->name) == 0)
|
||||
is_default = TRUE;
|
||||
else
|
||||
is_default = FALSE;
|
||||
|
||||
if (strcmp (current_theme, meta_theme_info->name) == 0)
|
||||
{
|
||||
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
|
||||
row_ref = gtk_tree_row_reference_new (model, path);
|
||||
gtk_tree_path_free (path);
|
||||
current_theme_found = TRUE;
|
||||
}
|
||||
blurb = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s", meta_theme_info->name, meta_theme_info->comment);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
THEME_NAME_COLUMN, blurb,
|
||||
DEFAULT_THEME_COLUMN, is_default,
|
||||
-1);
|
||||
g_free (blurb);
|
||||
|
||||
if (i == MAX_ELEMENTS_BEFORE_SCROLLING)
|
||||
{
|
||||
GtkRequisition rectangle;
|
||||
gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
|
||||
gtk_widget_set_usize (swindow, -1, rectangle.height);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (! current_theme_found)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
gboolean is_default;
|
||||
|
||||
if (strcmp (default_theme, current_theme) == 0)
|
||||
is_default = TRUE;
|
||||
else
|
||||
is_default = FALSE;
|
||||
gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
THEME_NAME_COLUMN, current_theme,
|
||||
DEFAULT_THEME_COLUMN, is_default,
|
||||
-1);
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
row_ref = gtk_tree_row_reference_new (model, path);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
if (row_ref)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_row_reference_get_path (row_ref);
|
||||
gtk_tree_view_set_cursor (tree_view,path, NULL, FALSE);
|
||||
|
||||
if (initial_scroll)
|
||||
{
|
||||
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.0);
|
||||
initial_scroll = FALSE;
|
||||
}
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
gtk_tree_row_reference_free (row_ref);
|
||||
}
|
||||
setting_model = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
load_theme_names (GtkTreeView *tree_view,
|
||||
GList *theme_list,
|
||||
|
@ -221,6 +323,7 @@ static void
|
|||
meta_theme_setup_info (GnomeThemeMetaInfo *meta_theme_info,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
return;
|
||||
if (meta_theme_info == NULL)
|
||||
{
|
||||
gtk_widget_hide (WID ("meta_theme_extras_vbox"));
|
||||
|
@ -518,7 +621,7 @@ read_themes (GladeXML *dialog)
|
|||
{
|
||||
current_meta_theme = g_strdup (info->name);
|
||||
}
|
||||
string_list = g_list_prepend (string_list, info->name);
|
||||
string_list = g_list_prepend (string_list, info);
|
||||
}
|
||||
|
||||
if (string_list == NULL)
|
||||
|
@ -532,7 +635,7 @@ read_themes (GladeXML *dialog)
|
|||
gtk_widget_show (WID ("meta_theme_hbox"));
|
||||
if (current_meta_theme == NULL)
|
||||
current_meta_theme = g_strdup (_("Current modified"));
|
||||
load_theme_names (GTK_TREE_VIEW (WID ("meta_theme_treeview")), string_list, current_meta_theme, META_THEME_DEFAULT_NAME);
|
||||
load_meta_themes (GTK_TREE_VIEW (WID ("meta_theme_treeview")), string_list, current_meta_theme, META_THEME_DEFAULT_NAME);
|
||||
g_list_free (string_list);
|
||||
}
|
||||
g_list_free (theme_list);
|
||||
|
@ -760,7 +863,7 @@ setup_tree_view (GtkTreeView *tree_view,
|
|||
gtk_tree_view_insert_column_with_attributes (tree_view,
|
||||
-1, NULL,
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", THEME_NAME_COLUMN,
|
||||
"markup", THEME_NAME_COLUMN,
|
||||
NULL);
|
||||
|
||||
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
||||
|
|
|
@ -106,73 +106,59 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox7">
|
||||
<widget class="GtkVBox" id="vbox11">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">9</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<widget class="GtkVBox" id="vbox11">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">4</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="meta_theme_image">
|
||||
<property name="width_request">320</property>
|
||||
<property name="height_request">240</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
<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>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Save 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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="meta_theme_description_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="meta_theme_extras_vbox">
|
||||
<widget class="GtkVBox" id="vbox12">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">3</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
|
@ -186,66 +172,97 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="meta_theme_info_label">
|
||||
<widget class="GtkNotebook" id="meta_theme_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="tab_hborder">2</property>
|
||||
<property name="tab_vborder">2</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="meta_theme_background_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Apply _Background</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
</widget>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="meta_theme_font_button">
|
||||
<widget class="GtkLabel" id="label19">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Apply _Font</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="label" translatable="yes">label19</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</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="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label20">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">label20</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</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="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label21">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">label21</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</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="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue