summaryrefslogtreecommitdiff
path: root/src/tools/marco-window-demo.c
diff options
context:
space:
mode:
authorJoaquín Ignacio Aramendía <[email protected]>2014-06-25 19:06:17 -0300
committerJoaquín Ignacio Aramendía <[email protected]>2014-06-26 20:03:32 -0300
commita65a66d49bd0d6ec6c94b8e3ecd551cb570cec95 (patch)
treeb451afa6025e587f0ee287601427e572712e3428 /src/tools/marco-window-demo.c
parent32050fd47713d9254e05344a6afd87202fa45d11 (diff)
downloadmarco-a65a66d49bd0d6ec6c94b8e3ecd551cb570cec95.tar.bz2
marco-a65a66d49bd0d6ec6c94b8e3ecd551cb570cec95.tar.xz
Remove all trailing whitespaces in the code tree
Just run: $ find -name '*.c' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i $ find -name '*.h' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i
Diffstat (limited to 'src/tools/marco-window-demo.c')
-rw-r--r--src/tools/marco-window-demo.c180
1 files changed, 90 insertions, 90 deletions
diff --git a/src/tools/marco-window-demo.c b/src/tools/marco-window-demo.c
index 5a7afa6f..7820b712 100644
--- a/src/tools/marco-window-demo.c
+++ b/src/tools/marco-window-demo.c
@@ -1,8 +1,8 @@
/* Marco window types/properties demo app */
-/*
+/*
* Copyright (C) 2002 Havoc Pennington
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
@@ -12,7 +12,7 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -40,7 +40,7 @@ set_gdk_window_struts (GdkWindow *window,
int bottom)
{
long vals[12];
-
+
vals[0] = left;
vals[1] = right;
vals[2] = top;
@@ -77,7 +77,7 @@ on_realize_set_struts (GtkWindow *window,
right = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-right"));
top = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-top"));
bottom = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "meta-strut-bottom"));
-
+
set_gdk_window_struts (gtk_widget_get_window (GTK_WIDGET (window)),
left, right, top, bottom);
}
@@ -97,11 +97,11 @@ set_gtk_window_struts (GtkWidget *window,
GINT_TO_POINTER (top));
g_object_set_data (G_OBJECT (window), "meta-strut-bottom",
GINT_TO_POINTER (bottom));
-
+
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
on_realize_set_struts,
NULL);
-
+
g_signal_connect_after (G_OBJECT (window),
"realize",
G_CALLBACK (on_realize_set_struts),
@@ -117,15 +117,15 @@ set_gdk_window_type (GdkWindow *window,
const char *type)
{
Atom atoms[2] = { None, None };
-
+
atoms[0] = XInternAtom (GDK_WINDOW_XDISPLAY (window),
type, False);
-
+
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window), "_NET_WM_WINDOW_TYPE", False),
XA_ATOM, 32, PropModeReplace,
- (guchar *)atoms,
+ (guchar *)atoms,
1);
}
@@ -140,7 +140,7 @@ on_realize_set_type (GtkWindow *window,
type = g_object_get_data (G_OBJECT (window), "meta-window-type");
g_return_if_fail (type != NULL);
-
+
set_gdk_window_type (gtk_widget_get_window (GTK_WIDGET (window)),
type);
}
@@ -154,7 +154,7 @@ set_gtk_window_type (GtkWindow *window,
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
on_realize_set_type,
NULL);
-
+
g_signal_connect_after (G_OBJECT (window),
"realize",
G_CALLBACK (on_realize_set_type),
@@ -176,7 +176,7 @@ on_realize_set_border_only (GtkWindow *window,
gpointer data)
{
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (window)));
-
+
set_gdk_window_border_only (gtk_widget_get_window (GTK_WIDGET (window)));
}
@@ -186,7 +186,7 @@ set_gtk_window_border_only (GtkWindow *window)
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
on_realize_set_border_only,
NULL);
-
+
g_signal_connect_after (G_OBJECT (window),
"realize",
G_CALLBACK (on_realize_set_border_only),
@@ -202,7 +202,7 @@ main (int argc, char **argv)
GList *list;
GdkPixbuf *pixbuf;
GError *err;
-
+
gtk_init (&argc, &argv);
err = NULL;
@@ -211,7 +211,7 @@ main (int argc, char **argv)
if (pixbuf)
{
list = g_list_prepend (NULL, pixbuf);
-
+
gtk_window_set_default_icon_list (list);
g_list_free (list);
g_object_unref (G_OBJECT (pixbuf));
@@ -221,11 +221,11 @@ main (int argc, char **argv)
g_printerr ("Could not load icon: %s\n", err->message);
g_error_free (err);
}
-
+
do_appwindow ();
gtk_main ();
-
+
return 0;
}
@@ -240,7 +240,7 @@ make_dialog (GtkWidget *parent,
{
GtkWidget *dialog;
char *str;
-
+
dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
@@ -252,11 +252,11 @@ make_dialog (GtkWidget *parent,
str = g_strdup_printf ("%d dialog", depth);
gtk_window_set_title (GTK_WINDOW (dialog), str);
g_free (str);
-
+
gtk_dialog_add_button (GTK_DIALOG (dialog),
"Open child dialog",
GTK_RESPONSE_ACCEPT);
-
+
/* Close dialog on user response */
g_signal_connect (G_OBJECT (dialog),
"response",
@@ -265,7 +265,7 @@ make_dialog (GtkWidget *parent,
g_object_set_data (G_OBJECT (dialog), "depth",
GINT_TO_POINTER (depth));
-
+
gtk_widget_show (dialog);
}
@@ -302,7 +302,7 @@ modal_dialog_cb (gpointer callback_data,
GtkWidget *widget)
{
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
@@ -310,7 +310,7 @@ modal_dialog_cb (gpointer callback_data,
"Here is a MODAL dialog");
set_gtk_window_type (GTK_WINDOW (dialog), "_NET_WM_WINDOW_TYPE_MODAL_DIALOG");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -332,13 +332,13 @@ utility_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *button;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_UTILITY");
gtk_window_set_title (GTK_WINDOW (window), "Utility");
-
+
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -354,7 +354,7 @@ utility_cb (gpointer callback_data,
button = gtk_button_new_with_mnemonic ("_D button");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
@@ -366,20 +366,20 @@ toolbar_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_TOOLBAR");
gtk_window_set_title (GTK_WINDOW (window), "Toolbar");
-
+
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("FIXME this needs a resize grip, etc.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
@@ -391,20 +391,20 @@ menu_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_MENU");
gtk_window_set_title (GTK_WINDOW (window), "Menu");
-
+
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("FIXME this isn't a menu.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
@@ -416,17 +416,17 @@ override_redirect_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
-
+
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_title (GTK_WINDOW (window), "Override Redirect");
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("This is an override\nredirect window\nand should not be managed");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
@@ -438,20 +438,20 @@ border_only_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_border_only (GTK_WINDOW (window));
gtk_window_set_title (GTK_WINDOW (window), "Border only");
-
+
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("This window is supposed to have a border but no titlebar.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
@@ -464,17 +464,17 @@ changing_icon_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Changing Icon");
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new ("This window has an icon that changes over time");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
+
gtk_widget_show_all (window);
}
#endif
@@ -504,7 +504,7 @@ focus_out_event_cb (GtkWidget *window,
widget = GTK_WIDGET (data);
gtk_label_set_text (GTK_LABEL (widget), "Not focused");
-
+
return TRUE;
}
@@ -512,7 +512,7 @@ static GtkWidget*
focus_label (GtkWidget *window)
{
GtkWidget *label;
-
+
label = gtk_label_new ("Not focused");
g_signal_connect (G_OBJECT (window), "focus_in_event",
@@ -520,7 +520,7 @@ focus_label (GtkWidget *window)
g_signal_connect (G_OBJECT (window), "focus_out_event",
G_CALLBACK (focus_out_event_cb), label);
-
+
return label;
}
@@ -532,20 +532,20 @@ splashscreen_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *image;
GtkWidget *vbox;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
gtk_window_set_title (GTK_WINDOW (window), "Splashscreen");
-
+
vbox = gtk_vbox_new (FALSE, 0);
-
+
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), focus_label (window), FALSE, FALSE, 0);
-
+ gtk_box_pack_start (GTK_BOX (vbox), focus_label (window), FALSE, FALSE, 0);
+
gtk_container_add (GTK_CONTAINER (window), vbox);
-
+
gtk_widget_show_all (window);
}
@@ -572,7 +572,7 @@ make_dock (int type)
switch (type)
{
case DOCK_LEFT:
- case DOCK_RIGHT:
+ case DOCK_RIGHT:
box = gtk_vbox_new (FALSE, 0);
break;
case DOCK_TOP:
@@ -585,18 +585,18 @@ make_dock (int type)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DOCK");
-
+
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (box), focus_label (window), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (box), focus_label (window), FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Close");
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy), window);
-
+
gtk_container_add (GTK_CONTAINER (window), box);
#define DOCK_SIZE 48
@@ -608,7 +608,7 @@ make_dock (int type)
set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "LeftDock");
break;
- case DOCK_RIGHT:
+ case DOCK_RIGHT:
gtk_widget_set_size_request (window, DOCK_SIZE, 400);
gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 200);
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
@@ -629,7 +629,7 @@ make_dock (int type)
case DOCK_ALL:
break;
}
-
+
gtk_widget_show_all (window);
}
@@ -678,24 +678,24 @@ desktop_cb (gpointer callback_data,
GtkWidget *window;
GtkWidget *label;
GdkColor desktop_color;
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP");
gtk_window_set_title (GTK_WINDOW (window), "Desktop");
gtk_widget_set_size_request (window,
gdk_screen_width (), gdk_screen_height ());
gtk_window_move (GTK_WINDOW (window), 0, 0);
-
+
desktop_color.red = 0x5144;
desktop_color.green = 0x75D6;
desktop_color.blue = 0xA699;
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &desktop_color);
-
+
label = focus_label (window);
-
+
gtk_container_add (GTK_CONTAINER (window), label);
-
+
gtk_widget_show_all (window);
}
@@ -724,7 +724,7 @@ static gchar ui_definition[] =
</menubar>\
</ui>";
-static GtkActionEntry entries[] =
+static GtkActionEntry entries[] =
{
/*
struct GtkActionEntry {
@@ -811,7 +811,7 @@ toggle_aspect_ratio (GtkWidget *button,
GTK_WIDGET (data),
&geom,
GDK_HINT_ASPECT);
-
+
}
static void
@@ -830,7 +830,7 @@ clicked_toolbar_cb (GtkWidget *button,
gpointer data)
{
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (data),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
@@ -842,7 +842,7 @@ clicked_toolbar_cb (GtkWidget *button,
"response",
G_CALLBACK (gtk_widget_destroy),
NULL);
-
+
gtk_widget_show (dialog);
}
@@ -854,7 +854,7 @@ update_statusbar (GtkTextBuffer *buffer,
gint row, col;
gint count;
GtkTextIter iter;
-
+
gtk_statusbar_pop (statusbar, 0); /* clear any previous message, underflow is allowed */
count = gtk_text_buffer_get_char_count (buffer);
@@ -909,11 +909,11 @@ do_appwindow (void)
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
#else
- GtkAccelGroup *accel_group;
+ GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
#endif
-
+
/* Create the toplevel window
*/
@@ -923,12 +923,12 @@ do_appwindow (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
-
+
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy_cb), NULL);
-
+
table = gtk_table_new (1, 4, FALSE);
-
+
gtk_container_add (GTK_CONTAINER (window), table);
#if GTK_CHECK_VERSION(3, 0, 0)
@@ -950,14 +950,14 @@ do_appwindow (void)
gtk_window_add_accel_group (GTK_WINDOW (window), gtk_ui_manager_get_accel_group (ui_manager));
#else
-
+
/* Create the menubar
*/
-
+
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
g_object_unref (accel_group);
-
+
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
/* Set up item factory to go away with the window */
@@ -994,7 +994,7 @@ do_appwindow (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 */
@@ -1004,11 +1004,11 @@ do_appwindow (void)
gtk_window_set_default_size (GTK_WINDOW (window),
200, 200);
-
+
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);
@@ -1026,8 +1026,8 @@ do_appwindow (void)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
newButton,
-1); /*-1 means append to end of toolbar*/
-
-
+
+
GtkToolItem *lockButton = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
gtk_tool_item_set_tooltip_text(lockButton,
"This is a demo button that locks up the demo");
@@ -1038,7 +1038,7 @@ do_appwindow (void)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar),
lockButton,
-1); /*-1 means append to end of toolbar*/
-
+
GtkToolItem *decoButton = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);
gtk_tool_item_set_tooltip_text(decoButton,
@@ -1076,7 +1076,7 @@ do_appwindow (void)
handlebox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (handlebox), toolbar);
-
+
gtk_table_attach (GTK_TABLE (table),
handlebox,
/* X direction */ /* Y direction */
@@ -1103,7 +1103,7 @@ do_appwindow (void)
"Be sure to tear off the menu and toolbar, those are also "
"a special kind of window.",
-1);
-
+
g_signal_connect_object (buffer,
"changed",
G_CALLBACK (update_statusbar),
@@ -1115,7 +1115,7 @@ do_appwindow (void)
G_CALLBACK (mark_set_callback),
statusbar,
0);
-
+
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
gtk_widget_show_all (window);