summaryrefslogtreecommitdiff
path: root/src/ui/theme-viewer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/theme-viewer.c')
-rw-r--r--src/ui/theme-viewer.c172
1 files changed, 86 insertions, 86 deletions
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index f8ed0d15..95858d2e 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -96,12 +96,12 @@ normal_contents (void)
GtkWidget *contents;
GtkWidget *sw;
GtkItemFactory *item_factory;
-
+
table = gtk_table_new (1, 4, FALSE);
-
+
/* Create the menubar
*/
-
+
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", NULL);
gtk_item_factory_set_translate_func(item_factory,
@@ -156,7 +156,7 @@ normal_contents (void)
handlebox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (handlebox), toolbar);
-
+
gtk_table_attach (GTK_TABLE (table),
handlebox,
/* X direction */ /* Y direction */
@@ -175,18 +175,18 @@ normal_contents (void)
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
-
+
gtk_table_attach (GTK_TABLE (table),
sw,
/* X direction */ /* Y direction */
0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
0, 0);
-
+
contents = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
PANGO_WRAP_WORD);
-
+
gtk_container_add (GTK_CONTAINER (sw),
contents);
@@ -223,19 +223,19 @@ dialog_contents (void)
GtkWidget *label;
GtkWidget *image;
GtkWidget *button;
-
+
vbox = gtk_vbox_new (FALSE, 0);
action_area = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area),
- GTK_BUTTONBOX_END);
+ GTK_BUTTONBOX_END);
button = gtk_button_new_from_stock (GTK_STOCK_OK);
gtk_box_pack_end (GTK_BOX (action_area),
button,
FALSE, TRUE, 0);
-
+
gtk_box_pack_end (GTK_BOX (vbox), action_area,
FALSE, TRUE, 0);
@@ -245,10 +245,10 @@ dialog_contents (void)
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO,
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-
+
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
-
+
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), image,
@@ -284,11 +284,11 @@ utility_contents (void)
char *str;
str = g_strdup_printf ("_%c", (char) ('A' + 4*i + j));
-
+
button = gtk_button_new_with_mnemonic (str);
g_free (str);
-
+
gtk_table_attach (GTK_TABLE (table),
button,
/* X direction */ /* Y direction */
@@ -303,7 +303,7 @@ utility_contents (void)
}
gtk_widget_show_all (table);
-
+
return table;
}
@@ -311,7 +311,7 @@ static GtkWidget*
menu_contents (void)
{
GtkWidget *vbox;
- GtkWidget *mi;
+ GtkWidget *mi;
int i;
GtkWidget *frame;
@@ -329,14 +329,14 @@ menu_contents (void)
gtk_misc_set_alignment (GTK_MISC (mi), 0.0, 0.5);
g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), mi, FALSE, FALSE, 0);
-
+
++i;
}
gtk_container_add (GTK_CONTAINER (frame), vbox);
-
+
gtk_widget_show_all (frame);
-
+
return frame;
}
@@ -354,19 +354,19 @@ border_only_contents (void)
color.green = 0;
color.blue = 40000;
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &color);
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
-
+
w = gtk_label_new (_("Border-only window"));
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
w = gtk_button_new_with_label (_("Bar"));
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (event_box), vbox);
-
+
gtk_widget_show_all (event_box);
-
+
return event_box;
}
@@ -399,7 +399,7 @@ get_window_contents (MetaFrameType type,
case META_FRAME_TYPE_BORDER:
*title = _("Border");
return border_only_contents ();
-
+
case META_FRAME_TYPE_LAST:
g_assert_not_reached ();
break;
@@ -422,7 +422,7 @@ get_window_flags (MetaFrameType type)
META_FRAME_HAS_FOCUS |
META_FRAME_ALLOWS_SHADE |
META_FRAME_ALLOWS_MOVE;
-
+
switch (type)
{
case META_FRAME_TYPE_NORMAL:
@@ -446,12 +446,12 @@ get_window_flags (MetaFrameType type)
case META_FRAME_TYPE_BORDER:
break;
-
+
case META_FRAME_TYPE_LAST:
g_assert_not_reached ();
break;
- }
-
+ }
+
return flags;
}
@@ -476,7 +476,7 @@ preview_collection (int font_size,
eventbox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (eventbox), box);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), eventbox);
desktop_color.red = 0x5144;
@@ -496,23 +496,23 @@ preview_collection (int font_size,
GtkWidget *preview;
PangoFontDescription *font_desc;
double scale;
-
+
eventbox2 = gtk_event_box_new ();
-
+
preview = meta_preview_new ();
-
+
gtk_container_add (GTK_CONTAINER (eventbox2), preview);
-
+
meta_preview_set_frame_type (META_PREVIEW (preview), i);
meta_preview_set_frame_flags (META_PREVIEW (preview),
get_window_flags (i));
-
+
meta_preview_set_theme (META_PREVIEW (preview), global_theme);
-
+
contents = get_window_contents (i, &title);
-
+
meta_preview_set_title (META_PREVIEW (preview), title);
-
+
gtk_container_add (GTK_CONTAINER (preview), contents);
if (i == META_FRAME_TYPE_MENU)
@@ -525,10 +525,10 @@ preview_collection (int font_size,
xalign = 0.5;
yalign = 0.5;
}
-
+
align = gtk_alignment_new (0.0, 0.0, xalign, yalign);
gtk_container_add (GTK_CONTAINER (align), eventbox2);
-
+
gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0);
switch (font_size)
@@ -547,17 +547,17 @@ preview_collection (int font_size,
if (scale != 1.0)
{
font_desc = pango_font_description_new ();
-
+
pango_font_description_set_size (font_desc,
MAX (pango_font_description_get_size (base_desc) * scale, 1));
-
+
gtk_widget_modify_font (preview, font_desc);
pango_font_description_free (font_desc);
}
-
+
previews[font_size*META_FRAME_TYPE_LAST + i] = preview;
-
+
++i;
}
@@ -586,13 +586,13 @@ init_layouts (void)
}
++i;
}
-
+
#ifndef ALLOW_DUPLICATE_BUTTONS
i = 0;
while (i <= MAX_BUTTONS_PER_CORNER)
{
int j;
-
+
j = 0;
while (j < i)
{
@@ -604,34 +604,34 @@ init_layouts (void)
different_layouts[i].left_buttons[j-i] = (MetaButtonFunction) j;
++j;
}
-
+
++i;
}
/* Special extra case for no buttons on either side */
different_layouts[i].left_buttons[0] = META_BUTTON_FUNCTION_LAST;
different_layouts[i].right_buttons[0] = META_BUTTON_FUNCTION_LAST;
-
+
#else
/* FIXME this code is if we allow duplicate buttons,
* which we currently do not
*/
int left;
int i;
-
+
left = 0;
i = 0;
while (left < MAX_BUTTONS_PER_CORNER)
{
int right;
-
+
right = 0;
-
+
while (right < MAX_BUTTONS_PER_CORNER)
{
int j;
-
+
static MetaButtonFunction left_functions[MAX_BUTTONS_PER_CORNER] = {
META_BUTTON_FUNCTION_MENU,
META_BUTTON_FUNCTION_MINIMIZE,
@@ -646,7 +646,7 @@ init_layouts (void)
};
g_assert (i < BUTTON_LAYOUT_COMBINATIONS);
-
+
j = 0;
while (j <= left)
{
@@ -660,12 +660,12 @@ init_layouts (void)
different_layouts[i].right_buttons[j] = right_functions[j];
++j;
}
-
+
++i;
-
+
++right;
}
-
+
++left;
}
#endif
@@ -681,13 +681,13 @@ previews_of_button_layouts (void)
GdkColor desktop_color;
int i;
GtkWidget *eventbox;
-
+
if (!initted)
{
init_layouts ();
initted = TRUE;
}
-
+
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -699,7 +699,7 @@ previews_of_button_layouts (void)
eventbox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (eventbox), box);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), eventbox);
desktop_color.red = 0x5144;
@@ -718,11 +718,11 @@ previews_of_button_layouts (void)
char *title;
eventbox2 = gtk_event_box_new ();
-
+
preview = meta_preview_new ();
-
- gtk_container_add (GTK_CONTAINER (eventbox2), preview);
-
+
+ gtk_container_add (GTK_CONTAINER (eventbox2), preview);
+
meta_preview_set_theme (META_PREVIEW (preview), global_theme);
title = g_strdup_printf (_("Button layout test %d"), i+1);
@@ -731,20 +731,20 @@ previews_of_button_layouts (void)
meta_preview_set_button_layout (META_PREVIEW (preview),
&different_layouts[i]);
-
+
xalign = 0.5;
yalign = 0.5;
-
+
align = gtk_alignment_new (0.0, 0.0, xalign, yalign);
gtk_container_add (GTK_CONTAINER (align), eventbox2);
-
+
gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0);
previews[META_FRAME_TYPE_LAST*FONT_SIZE_LAST + i] = preview;
-
+
++i;
}
-
+
return sw;
}
@@ -753,7 +753,7 @@ benchmark_summary (void)
{
char *msg;
GtkWidget *label;
-
+
msg = g_strdup_printf (_("%g milliseconds to draw one window frame"),
milliseconds_to_draw_frame);
label = gtk_label_new (msg);
@@ -771,7 +771,7 @@ main (int argc, char **argv)
clock_t start, end;
GtkWidget *notebook;
int i;
-
+
bindtextdomain (GETTEXT_PACKAGE, MARCO_LOCALEDIR);
textdomain(GETTEXT_PACKAGE);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
@@ -788,7 +788,7 @@ main (int argc, char **argv)
meta_set_debugging (TRUE);
meta_set_verbose (TRUE);
}
-
+
start = clock ();
err = NULL;
if (argc == 1)
@@ -815,7 +815,7 @@ main (int argc, char **argv)
(end - start) / (double) CLOCKS_PER_SEC);
run_theme_benchmark ();
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 350, 350);
@@ -835,7 +835,7 @@ main (int argc, char **argv)
title);
g_free (title);
- }
+ }
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
@@ -843,7 +843,7 @@ main (int argc, char **argv)
gtk_widget_realize (window);
g_assert (window->style);
g_assert (window->style->font_desc);
-
+
notebook = gtk_notebook_new ();
gtk_container_add (GTK_CONTAINER (window), notebook);
@@ -852,13 +852,13 @@ main (int argc, char **argv)
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Normal Title Font")));
-
+
collection = preview_collection (FONT_SIZE_SMALL,
window->style->font_desc);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Small Title Font")));
-
+
collection = preview_collection (FONT_SIZE_LARGE,
window->style->font_desc);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
@@ -874,7 +874,7 @@ main (int argc, char **argv)
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Benchmark")));
-
+
i = 0;
while (i < (int) G_N_ELEMENTS (previews))
{
@@ -885,7 +885,7 @@ main (int argc, char **argv)
++i;
}
-
+
gtk_widget_show_all (window);
gtk_main ();
@@ -948,10 +948,10 @@ run_theme_benchmark (void)
int client_width;
int client_height;
int inc;
-
+
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_realize (widget);
-
+
meta_theme_get_frame_borders (global_theme,
META_FRAME_TYPE_NORMAL,
get_text_height (widget),
@@ -960,9 +960,9 @@ run_theme_benchmark (void)
&bottom_height,
&left_width,
&right_width);
-
+
layout = create_title_layout (widget);
-
+
i = 0;
while (i < MAX_BUTTONS_PER_CORNER)
{
@@ -970,7 +970,7 @@ run_theme_benchmark (void)
button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
++i;
}
-
+
button_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU;
button_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
@@ -985,7 +985,7 @@ run_theme_benchmark (void)
inc = 1000 / ITERATIONS; /* Increment to grow width/height,
* eliminates caching effects.
*/
-
+
i = 0;
while (i < ITERATIONS)
{
@@ -1013,7 +1013,7 @@ run_theme_benchmark (void)
meta_preview_get_icon ());
g_object_unref (G_OBJECT (pixmap));
-
+
++i;
client_width += inc;
client_height += inc;
@@ -1023,7 +1023,7 @@ run_theme_benchmark (void)
g_timer_stop (timer);
milliseconds_to_draw_frame = (g_timer_elapsed (timer, NULL) / (double) ITERATIONS) * 1000;
-
+
g_print (_("Drew %d frames in %g client-side seconds (%g milliseconds per frame) and %g seconds wall clock time including X server resources (%g milliseconds per frame)\n"),
ITERATIONS,
((double)end - (double)start) / CLOCKS_PER_SEC,
@@ -1217,7 +1217,7 @@ run_position_expression_tests (void)
test->expr, test->expected_x, test->expected_y);
err = NULL;
-
+
env.rect = meta_rect (test->rect.x, test->rect.y,
test->rect.width, test->rect.height);
env.object_width = -1;