2001-02-12 06:16:48 +00:00
|
|
|
#include "test.h"
|
|
|
|
|
2001-04-04 00:07:15 +00:00
|
|
|
#include <eel/eel-wrap-table.h>
|
|
|
|
#include <eel/eel-labeled-image.h>
|
2008-09-01 10:24:12 +00:00
|
|
|
#include <eel/eel-vfs-extensions.h>
|
2001-05-04 03:14:43 +00:00
|
|
|
#include <libnautilus-private/nautilus-customization-data.h>
|
2007-11-30 14:51:10 +00:00
|
|
|
#include <libnautilus-private/nautilus-icon-info.h>
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char* argv[])
|
|
|
|
{
|
|
|
|
NautilusCustomizationData *customization_data;
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *emblems_table, *button, *scroller;
|
2008-09-01 10:24:12 +00:00
|
|
|
char *emblem_name, *stripped_name;
|
2001-02-12 06:16:48 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
char *label;
|
|
|
|
|
|
|
|
test_init (&argc, &argv);
|
|
|
|
|
|
|
|
window = test_window_new ("Wrap Table Test", 10);
|
|
|
|
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
|
|
|
|
|
|
|
/* The emblems wrapped table */
|
2001-04-04 00:07:15 +00:00
|
|
|
emblems_table = eel_wrap_table_new (TRUE);
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
gtk_widget_show (emblems_table);
|
2008-10-07 19:49:14 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (emblems_table), 8);
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
scroller = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
/* Viewport */
|
|
|
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller),
|
|
|
|
emblems_table);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), scroller);
|
|
|
|
|
|
|
|
gtk_widget_show (scroller);
|
|
|
|
|
2002-03-07 19:36:18 +00:00
|
|
|
#if 0
|
2001-02-12 06:16:48 +00:00
|
|
|
/* Get rid of default lowered shadow appearance.
|
|
|
|
* This must be done after the widget is realized, due to
|
|
|
|
* an apparent bug in gtk_viewport_set_shadow_type.
|
|
|
|
*/
|
2002-03-07 19:36:18 +00:00
|
|
|
g_signal_connect (GTK_BIN (scroller->child),
|
|
|
|
"realize",
|
|
|
|
remove_default_viewport_shadow,
|
|
|
|
NULL);
|
|
|
|
#endif
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Use nautilus_customization to make the emblem widgets */
|
2007-07-24 15:21:21 +00:00
|
|
|
customization_data = nautilus_customization_data_new ("emblems", TRUE,
|
2001-02-12 06:16:48 +00:00
|
|
|
NAUTILUS_ICON_SIZE_SMALL,
|
|
|
|
NAUTILUS_ICON_SIZE_SMALL);
|
|
|
|
|
|
|
|
while (nautilus_customization_data_get_next_element_for_display (customization_data,
|
|
|
|
&emblem_name,
|
|
|
|
&pixbuf,
|
2008-10-07 19:49:14 +00:00
|
|
|
&label)) {
|
2001-02-12 06:16:48 +00:00
|
|
|
|
2008-09-01 10:24:12 +00:00
|
|
|
stripped_name = eel_filename_strip_extension (emblem_name);
|
|
|
|
g_free (emblem_name);
|
2001-02-12 06:16:48 +00:00
|
|
|
|
2008-09-01 10:24:12 +00:00
|
|
|
if (strcmp (stripped_name, "erase") == 0) {
|
2001-12-07 00:55:34 +00:00
|
|
|
g_object_unref (pixbuf);
|
2001-02-12 06:16:48 +00:00
|
|
|
g_free (label);
|
2008-09-01 10:24:12 +00:00
|
|
|
g_free (stripped_name);
|
2001-02-12 06:16:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-09-01 10:24:12 +00:00
|
|
|
|
2001-04-04 00:07:15 +00:00
|
|
|
button = eel_labeled_image_check_button_new (label, pixbuf);
|
2001-02-12 06:16:48 +00:00
|
|
|
g_free (label);
|
2001-12-07 00:55:34 +00:00
|
|
|
g_object_unref (pixbuf);
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
/* Attach parameters and signal handler. */
|
2001-11-21 08:34:57 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (button),
|
|
|
|
"nautilus_property_name",
|
2008-09-01 10:24:12 +00:00
|
|
|
stripped_name,
|
2001-11-21 08:34:57 +00:00
|
|
|
(GDestroyNotify) g_free);
|
2001-02-12 06:16:48 +00:00
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (emblems_table), button);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show_all (emblems_table);
|
|
|
|
|
|
|
|
gtk_widget_show (window);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|