static void
caja_emblem_sidebar_leave_notify_cb (GtkWidget *widget,
                                     CajaEmblemSidebar *emblem_sidebar)
{
    GdkPixbuf *pixbuf;
    EelLabeledImage *image;

    pixbuf = g_object_get_data (G_OBJECT (widget), "original-pixbuf");
    image = g_object_get_data (G_OBJECT (widget), "labeled-image");

    eel_labeled_image_set_pixbuf (EEL_LABELED_IMAGE (image), pixbuf);
}
static void
nautilus_emblem_sidebar_enter_notify_cb (GtkWidget *widget,
					 NautilusEmblemSidebar *emblem_sidebar)
{
	GdkPixbuf *pixbuf;
	EelLabeledImage *image;

	pixbuf = g_object_get_data (G_OBJECT (widget), "prelight-pixbuf");
	image = g_object_get_data (G_OBJECT (widget), "labeled-image");

	eel_labeled_image_set_pixbuf (EEL_LABELED_IMAGE (image), pixbuf);
}
static void
image_table_child_clicked_callback (GtkWidget *image_table,
				 GtkWidget *item,
				 gpointer callback_data)
{
	char *text;

	g_return_if_fail (EEL_IS_IMAGE_TABLE (image_table));
	g_return_if_fail (EEL_IS_LABELED_IMAGE (item));

	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));

	g_print ("%s(%s)\n", G_STRFUNC, text);
}
Beispiel #4
0
static GtkWidget *
labeled_image_button_window_new (const char *title,
				 GdkPixbuf *pixbuf)
{
	GtkWidget *window;
	GtkWidget *vbox;
	GtkWidget *button;
	GtkWidget *toggle_button;
	GtkWidget *check_button;
	GtkWidget *plain;

	window = test_window_new (title, 20);
	vbox = gtk_vbox_new (FALSE, 10);
	gtk_container_add (GTK_CONTAINER (window), vbox);

	if (1) button = eel_labeled_image_button_new ("GtkButton with LabeledImage", pixbuf);
	if (1) toggle_button = eel_labeled_image_toggle_button_new ("GtkToggleButton with LabeledImage", pixbuf);
	if (1) check_button = eel_labeled_image_check_button_new ("GtkCheckButton with LabeledImage", pixbuf);
	if (1) {
		plain = eel_labeled_image_new ("Plain LabeledImage", pixbuf);
		eel_labeled_image_set_can_focus (EEL_LABELED_IMAGE (plain), TRUE);
	}

	if (button) gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
	if (toggle_button) gtk_box_pack_start (GTK_BOX (vbox), toggle_button, TRUE, TRUE, 0);
	if (check_button) gtk_box_pack_start (GTK_BOX (vbox), check_button, TRUE, TRUE, 0);
	if (plain) gtk_box_pack_start (GTK_BOX (vbox), plain, TRUE, TRUE, 0);

	if (button) {
		g_signal_connect (button, "enter", G_CALLBACK (button_callback), "enter");
		g_signal_connect (button, "leave", G_CALLBACK (button_callback), "leave");
		g_signal_connect (button, "pressed", G_CALLBACK (button_callback), "pressed");
		g_signal_connect (button, "released", G_CALLBACK (button_callback), "released");
		g_signal_connect (button, "clicked", G_CALLBACK (button_callback), "clicked");
	}

	gtk_widget_show_all (vbox);
	
	return window;
}
static GtkWidget *
create_emblem_widget_with_pixbuf (CajaEmblemSidebar *emblem_sidebar,
                                  const char *keyword,
                                  const char *display_name,
                                  GdkPixbuf *pixbuf)
{
    GtkWidget *image, *event_box;
    GdkPixbuf *prelight_pixbuf;


    image = eel_labeled_image_new (display_name, pixbuf);

    eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (image),
            STANDARD_EMBLEM_HEIGHT);
    eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (image),
                                   EMBLEM_LABEL_SPACING);
    event_box = gtk_event_box_new ();
    gtk_container_add (GTK_CONTAINER (event_box), image);

    prelight_pixbuf = eel_create_spotlight_pixbuf (pixbuf);


    gtk_drag_source_set (event_box, GDK_BUTTON1_MASK, drag_types,
                         G_N_ELEMENTS (drag_types),
                         GDK_ACTION_COPY | GDK_ACTION_MOVE);

    gtk_drag_source_set_icon_pixbuf (event_box, pixbuf);



    g_signal_connect (event_box, "button_press_event",
                      G_CALLBACK (caja_emblem_sidebar_button_press_cb),
                      emblem_sidebar);
    g_signal_connect (event_box, "drag-data-get",
                      G_CALLBACK (caja_emblem_sidebar_drag_data_get_cb),
                      emblem_sidebar);
    g_signal_connect (event_box, "enter-notify-event",
                      G_CALLBACK (caja_emblem_sidebar_enter_notify_cb),
                      emblem_sidebar);
    g_signal_connect (event_box, "leave-notify-event",
                      G_CALLBACK (caja_emblem_sidebar_leave_notify_cb),
                      emblem_sidebar);

    g_object_set_data_full (G_OBJECT (event_box),
                            "emblem-keyword",
                            g_strdup (keyword), g_free);
    g_object_set_data_full (G_OBJECT (event_box),
                            "emblem-display-name",
                            g_strdup (display_name), g_free);
    g_object_set_data_full (G_OBJECT (event_box),
                            "original-pixbuf",
                            pixbuf, g_object_unref);
    g_object_set_data_full (G_OBJECT (event_box),
                            "prelight-pixbuf",
                            prelight_pixbuf, g_object_unref);
    g_object_set_data (G_OBJECT (event_box),
                       "labeled-image", image);

    return event_box;

}