mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Add unref/ref functions for gcs that take NULL.
* libnautilus-extensions/nautilus-buffered-widget.c: (nautilus_buffered_widget_initialize), (nautilus_buffered_widget_destroy), (buffered_widget_update_pixbuf), (create_background_pixbuf_from_none), (create_background_pixbuf_from_solid), (create_background_pixbuf_from_ancestor), (create_background_pixbuf), (nautilus_buffered_widget_get_vertical_offset), (nautilus_buffered_widget_set_background_type), (nautilus_buffered_widget_get_background_type), (nautilus_buffered_widget_set_background_color), (nautilus_buffered_widget_get_background_color): * libnautilus-extensions/nautilus-buffered-widget.h: * libnautilus-extensions/nautilus-gdk-extensions.c: (nautilus_gdk_gc_ref_if_not_null), (nautilus_gdk_gc_unref_if_not_null): * libnautilus-extensions/nautilus-gdk-extensions.h: Add unref/ref functions for gcs that take NULL. * libnautilus-extensions/nautilus-label.c: (nautilus_label_new): * libnautilus-extensions/nautilus-label.h: Make the constructor work just like GtkLabel by accepting a string. * components/music/nautilus-music-view.c: (nautilus_music_view_initialize), (add_play_controls): Use the new NautilusLabel constructor. * components/services/nautilus-dependent-shared/shared-service-widg ets.c: (create_label_widget): Use the new NautilusLabel constructor. * src/nautilus-first-time-druid.c: (make_anti_aliased_label), (set_up_update_feedback_page): Use the new NautilusLabel constructor. * src/nautilus-property-browser.c: (nautilus_property_browser_initialize), (make_properties_from_directory_path), (make_properties_from_xml_node), (make_category_link): Use the new NautilusLabel constructor. Fix the tile names to be antialises by using the new buffered widget SOLID background mode. * src/nautilus-sidebar-title.c: (sidebar_create_smooth_components_if_needed): Use the new NautilusLabel constructor. * src/nautilus-theme-selector.c: (nautilus_theme_selector_initialize): Use the new NautilusLabel constructor. * test/test-nautilus-image.c: (main): * test/test-nautilus-label.c: (main): Use the new NautilusLabel constructor.
This commit is contained in:
parent
b23f4b14cc
commit
f7276747ab
59
ChangeLog
59
ChangeLog
|
@ -1,3 +1,62 @@
|
|||
2000-08-28 Ramiro Estrugo <ramiro@eazel.com>
|
||||
|
||||
* libnautilus-extensions/nautilus-buffered-widget.c:
|
||||
(nautilus_buffered_widget_initialize),
|
||||
(nautilus_buffered_widget_destroy),
|
||||
(buffered_widget_update_pixbuf),
|
||||
(create_background_pixbuf_from_none),
|
||||
(create_background_pixbuf_from_solid),
|
||||
(create_background_pixbuf_from_ancestor),
|
||||
(create_background_pixbuf),
|
||||
(nautilus_buffered_widget_get_vertical_offset),
|
||||
(nautilus_buffered_widget_set_background_type),
|
||||
(nautilus_buffered_widget_get_background_type),
|
||||
(nautilus_buffered_widget_set_background_color),
|
||||
(nautilus_buffered_widget_get_background_color):
|
||||
* libnautilus-extensions/nautilus-buffered-widget.h:
|
||||
|
||||
* libnautilus-extensions/nautilus-gdk-extensions.c:
|
||||
(nautilus_gdk_gc_ref_if_not_null),
|
||||
(nautilus_gdk_gc_unref_if_not_null):
|
||||
* libnautilus-extensions/nautilus-gdk-extensions.h:
|
||||
Add unref/ref functions for gcs that take NULL.
|
||||
|
||||
* libnautilus-extensions/nautilus-label.c: (nautilus_label_new):
|
||||
* libnautilus-extensions/nautilus-label.h:
|
||||
Make the constructor work just like GtkLabel by accepting a string.
|
||||
|
||||
* components/music/nautilus-music-view.c:
|
||||
(nautilus_music_view_initialize), (add_play_controls):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
* components/services/nautilus-dependent-shared/shared-service-widg
|
||||
ets.c: (create_label_widget):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
* src/nautilus-first-time-druid.c: (make_anti_aliased_label),
|
||||
(set_up_update_feedback_page):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
* src/nautilus-property-browser.c:
|
||||
(nautilus_property_browser_initialize),
|
||||
(make_properties_from_directory_path),
|
||||
(make_properties_from_xml_node), (make_category_link):
|
||||
Use the new NautilusLabel constructor.
|
||||
Fix the tile names to be antialises by using the new buffered
|
||||
widget SOLID background mode.
|
||||
|
||||
* src/nautilus-sidebar-title.c:
|
||||
(sidebar_create_smooth_components_if_needed):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
* src/nautilus-theme-selector.c:
|
||||
(nautilus_theme_selector_initialize):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
* test/test-nautilus-image.c: (main):
|
||||
* test/test-nautilus-label.c: (main):
|
||||
Use the new NautilusLabel constructor.
|
||||
|
||||
2000-08-28 Andy Hertzfeld <andy@eazel.com>
|
||||
|
||||
* src/nautilus-window-menus.c: (get_static_bookmarks_file_path):
|
||||
|
|
|
@ -220,7 +220,7 @@ nautilus_music_view_initialize (NautilusMusicView *music_view)
|
|||
|
||||
/* allocate a widget for the album title */
|
||||
|
||||
music_view->details->album_title = nautilus_label_new ();
|
||||
music_view->details->album_title = nautilus_label_new ("");
|
||||
nautilus_label_set_font_from_components (NAUTILUS_LABEL (music_view->details->album_title),
|
||||
"helvetica", "medium", NULL, NULL);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (music_view->details->album_title), 20);
|
||||
|
@ -1075,7 +1075,7 @@ add_play_controls (NautilusMusicView *music_view)
|
|||
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 1);
|
||||
|
||||
music_view->details->song_label = nautilus_label_new ();
|
||||
music_view->details->song_label = nautilus_label_new ("");
|
||||
nautilus_label_set_font_from_components (NAUTILUS_LABEL (music_view->details->song_label),
|
||||
"helvetica", "medium", NULL, NULL);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (music_view->details->song_label), 14);
|
||||
|
|
|
@ -105,9 +105,8 @@ create_label_widget (const char *text,
|
|||
g_return_val_if_fail (text != NULL, NULL);
|
||||
g_return_val_if_fail (font_size > 0, NULL);
|
||||
|
||||
label = nautilus_label_new ();
|
||||
label = nautilus_label_new (text);
|
||||
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), text);
|
||||
nautilus_label_set_font_from_components (NAUTILUS_LABEL (label), "helvetica", NULL, NULL, NULL);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (label), font_size);
|
||||
nautilus_label_set_text_color (NAUTILUS_LABEL (label), NAUTILUS_RGB_COLOR_WHITE);
|
||||
|
|
|
@ -61,74 +61,55 @@ enum
|
|||
/* Detail member struct */
|
||||
struct _NautilusBufferedWidgetDetail
|
||||
{
|
||||
GdkGC *copy_area_gc;
|
||||
GdkPixbuf *buffer_pixbuf;
|
||||
GdkPixbuf *tile_pixbuf;
|
||||
int horizontal_offset;
|
||||
int vertical_offset;
|
||||
guint background_appearance_changed_connection;
|
||||
GdkGC *copy_area_gc;
|
||||
GdkPixbuf *buffer_pixbuf;
|
||||
GdkPixbuf *tile_pixbuf;
|
||||
int horizontal_offset;
|
||||
int vertical_offset;
|
||||
guint background_appearance_changed_connection;
|
||||
NautilusBackgroundType background_type;
|
||||
guint32 background_color;
|
||||
};
|
||||
|
||||
/* GdkGC refcounting macros */ \
|
||||
#define NAUTILUS_GDK_GC_UNREF_IF(_gc) \
|
||||
NAUTILUS_MACRO_BEGIN \
|
||||
if ((_gc) != NULL) { \
|
||||
gdk_gc_unref (_gc); \
|
||||
(_gc) = NULL; \
|
||||
} \
|
||||
NAUTILUS_MACRO_END
|
||||
|
||||
#define NAUTILUS_GDK_GC_REF_IF(_gc) \
|
||||
NAUTILUS_MACRO_BEGIN \
|
||||
if ((_gc) != NULL) { \
|
||||
gdk_gc_ref (_gc); \
|
||||
} \
|
||||
NAUTILUS_MACRO_END
|
||||
|
||||
/* GtkObjectClass methods */
|
||||
static void nautilus_buffered_widget_initialize_class (NautilusBufferedWidgetClass *buffered_widget_class);
|
||||
static void nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget);
|
||||
static void nautilus_buffered_widget_destroy (GtkObject *object);
|
||||
static void nautilus_buffered_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_buffered_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
|
||||
|
||||
static void nautilus_buffered_widget_initialize_class (NautilusBufferedWidgetClass *buffered_widget_class);
|
||||
static void nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget);
|
||||
static void nautilus_buffered_widget_destroy (GtkObject *object);
|
||||
static void nautilus_buffered_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_buffered_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
|
||||
/* GtkWidgetClass methods */
|
||||
static void nautilus_buffered_widget_realize (GtkWidget *widget);
|
||||
static void nautilus_buffered_widget_draw (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void nautilus_buffered_widget_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
|
||||
static void nautilus_buffered_widget_realize (GtkWidget *widget);
|
||||
static void nautilus_buffered_widget_draw (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void nautilus_buffered_widget_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
/* GtkWidgetClass event methods */
|
||||
static gint nautilus_buffered_widget_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
|
||||
static gint nautilus_buffered_widget_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
/* Private NautilusBufferedWidget things */
|
||||
static void background_appearance_changed_callback (NautilusBackground *background,
|
||||
gpointer callback_data);
|
||||
static GdkPixbuf* buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buffered_widget,
|
||||
GdkGC *gc);
|
||||
static void buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget);
|
||||
static GtkWidget *nautilus_gtk_widget_find_background_ancestor (GtkWidget *widget);
|
||||
static void nautilus_gdk_pixbuf_tile_alpha (GdkPixbuf *pixbuf,
|
||||
const GdkPixbuf *tile_pixbuf,
|
||||
guint tile_width,
|
||||
guint tile_height,
|
||||
gint tile_origin_x,
|
||||
gint tile_origin_y,
|
||||
GdkInterpType interpolation_mode,
|
||||
guchar overall_alpha);
|
||||
static void connect_to_background_if_needed (NautilusBufferedWidget *buffered_widget);
|
||||
|
||||
static void background_appearance_changed_callback (NautilusBackground *background,
|
||||
gpointer callback_data);
|
||||
static GdkPixbuf* create_background_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_none (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_solid (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_ancestor (const NautilusBufferedWidget *buffered_widget);
|
||||
static void buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget);
|
||||
static GtkWidget *nautilus_gtk_widget_find_background_ancestor (GtkWidget *widget);
|
||||
static void nautilus_gdk_pixbuf_tile_alpha (GdkPixbuf *pixbuf,
|
||||
const GdkPixbuf *tile_pixbuf,
|
||||
guint tile_width,
|
||||
guint tile_height,
|
||||
gint tile_origin_x,
|
||||
gint tile_origin_y,
|
||||
GdkInterpType interpolation_mode,
|
||||
guchar overall_alpha);
|
||||
static void connect_to_background_if_needed (NautilusBufferedWidget *buffered_widget);
|
||||
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBufferedWidget, nautilus_buffered_widget, GTK_TYPE_MISC)
|
||||
|
@ -170,6 +151,8 @@ nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget)
|
|||
buffered_widget->detail->horizontal_offset = 0;
|
||||
buffered_widget->detail->vertical_offset = 0;
|
||||
buffered_widget->detail->background_appearance_changed_connection = 0;
|
||||
buffered_widget->detail->background_type = NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE;
|
||||
buffered_widget->detail->background_color = NAUTILUS_RGB_COLOR_WHITE;
|
||||
}
|
||||
|
||||
/* GtkObjectClass methods */
|
||||
|
@ -183,12 +166,12 @@ nautilus_buffered_widget_destroy (GtkObject *object)
|
|||
|
||||
buffered_widget = NAUTILUS_BUFFERED_WIDGET (object);
|
||||
|
||||
NAUTILUS_GDK_GC_UNREF_IF (buffered_widget->detail->copy_area_gc);
|
||||
nautilus_gdk_gc_unref_if_not_null (buffered_widget->detail->copy_area_gc);
|
||||
buffered_widget->detail->copy_area_gc = NULL;
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->buffer_pixbuf);
|
||||
buffered_widget->detail->buffer_pixbuf = NULL;
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->tile_pixbuf);
|
||||
buffered_widget->detail->tile_pixbuf = NULL;
|
||||
NAUTILUS_GDK_GC_UNREF_IF (buffered_widget->detail->copy_area_gc);
|
||||
|
||||
g_free (buffered_widget->detail);
|
||||
|
||||
|
@ -447,10 +430,9 @@ static void
|
|||
buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf_without_alpha;
|
||||
GdkPixbuf *background_pixbuf;
|
||||
ArtIRect clip_rect;
|
||||
GdkPoint destination_point;
|
||||
NautilusBufferedWidgetClass *buffered_widget_class;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
|
@ -458,11 +440,17 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->buffer_pixbuf);
|
||||
|
||||
pixbuf_without_alpha = buffered_widget_create_pixbuf_from_background (buffered_widget,
|
||||
buffered_widget->detail->copy_area_gc);
|
||||
buffered_widget->detail->buffer_pixbuf = gdk_pixbuf_add_alpha (pixbuf_without_alpha, FALSE, 0, 0, 0);
|
||||
background_pixbuf = create_background_pixbuf (buffered_widget);
|
||||
g_assert (background_pixbuf != NULL);
|
||||
|
||||
gdk_pixbuf_unref (pixbuf_without_alpha);
|
||||
// if (!gdk_pixbuf_get_has_alpha (background_pixbuf)) {
|
||||
buffered_widget->detail->buffer_pixbuf = gdk_pixbuf_add_alpha (background_pixbuf, FALSE, 0, 0, 0);
|
||||
|
||||
gdk_pixbuf_unref (background_pixbuf);
|
||||
// }
|
||||
// else {
|
||||
// buffered_widget->detail->buffer_pixbuf = background_pixbuf;
|
||||
// }
|
||||
|
||||
g_assert (buffered_widget->detail->buffer_pixbuf != NULL);
|
||||
|
||||
|
@ -475,10 +463,6 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
destination_point.x = 0;
|
||||
destination_point.y = 0;
|
||||
|
||||
buffered_widget_class = NAUTILUS_BUFFERED_WIDGET_CLASS (NAUTILUS_CLASS (buffered_widget));
|
||||
g_assert (buffered_widget_class != NULL);
|
||||
g_assert (buffered_widget_class->render_buffer_pixbuf != NULL);
|
||||
|
||||
if (buffered_widget->detail->tile_pixbuf != NULL) {
|
||||
nautilus_gdk_pixbuf_tile_alpha (buffered_widget->detail->buffer_pixbuf,
|
||||
buffered_widget->detail->tile_pixbuf,
|
||||
|
@ -498,25 +482,82 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buffered_widget,
|
||||
GdkGC *gc)
|
||||
create_background_pixbuf_from_none (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
|
||||
|
||||
gtk_paint_flat_box (widget->style,
|
||||
pixmap,
|
||||
widget->state,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL,
|
||||
widget,
|
||||
"eventbox",
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
gdk_rgb_get_cmap (),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf_from_solid (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, widget->allocation.width, widget->allocation.height);
|
||||
|
||||
nautilus_gdk_pixbuf_fill_rectangle_with_color (pixbuf, NULL, buffered_widget->detail->background_color);
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf_from_ancestor (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GtkWidget *background_ancestor;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
g_return_val_if_fail (gc != NULL, NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
background_ancestor = nautilus_gtk_widget_find_background_ancestor (widget);
|
||||
|
||||
|
||||
if (background_ancestor != NULL) {
|
||||
NautilusBackground *background;
|
||||
GdkPixmap *pixmap;
|
||||
GdkRectangle background_area;
|
||||
|
||||
|
||||
background = nautilus_get_widget_background (background_ancestor);
|
||||
g_assert (NAUTILUS_IS_BACKGROUND (background));
|
||||
|
||||
|
@ -527,7 +568,7 @@ buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buf
|
|||
|
||||
pixmap = gdk_pixmap_new (widget->window, background_area.width, background_area.height, -1);
|
||||
|
||||
nautilus_background_draw (background, pixmap, gc, &background_area, 0, 0);
|
||||
nautilus_background_draw (background, pixmap, buffered_widget->detail->copy_area_gc, &background_area, 0, 0);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
|
@ -538,37 +579,40 @@ buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buf
|
|||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
gdk_pixmap_unref (pixmap);
|
||||
}
|
||||
else {
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
|
||||
|
||||
gtk_paint_flat_box (widget->style,
|
||||
pixmap,
|
||||
widget->state,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL,
|
||||
widget,
|
||||
"eventbox",
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
gdk_rgb_get_cmap (),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
}
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
switch (buffered_widget->detail->background_type) {
|
||||
case NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE:
|
||||
pixbuf = create_background_pixbuf_from_ancestor (buffered_widget);
|
||||
if (!pixbuf) {
|
||||
pixbuf = create_background_pixbuf_from_none (buffered_widget);
|
||||
}
|
||||
break;
|
||||
|
||||
case NAUTILUS_BACKGROUND_SOLID:
|
||||
pixbuf = create_background_pixbuf_from_solid (buffered_widget);
|
||||
break;
|
||||
|
||||
default:
|
||||
case NAUTILUS_BACKGROUND_NONE:
|
||||
pixbuf = create_background_pixbuf_from_none (buffered_widget);
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
|
@ -789,3 +833,101 @@ nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buff
|
|||
|
||||
return buffered_widget->detail->vertical_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_set_background_type:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
* @background_type: The new background type
|
||||
*
|
||||
* Change the background type for the widget as follows:
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE:
|
||||
*
|
||||
* Look for the closest ancestor widget that has an attatched
|
||||
* NautilusBackground and use that. If that fails, then use
|
||||
* the widget's background as specified by its attachted GtkStyle.
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_NONE:
|
||||
*
|
||||
* Use the widget's background as specified by its attachted GtkStyle.
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_SOLID:
|
||||
*
|
||||
* Use a solid color for the background. This solid color can be
|
||||
* changed with nautilus_buffered_widget_set_background_color()
|
||||
*/
|
||||
void
|
||||
nautilus_buffered_widget_set_background_type (NautilusBufferedWidget *buffered_widget,
|
||||
NautilusBackgroundType background_type)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
g_return_if_fail (background_type >= NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE);
|
||||
g_return_if_fail (background_type <= NAUTILUS_BACKGROUND_SOLID);
|
||||
|
||||
if (background_type != buffered_widget->detail->background_type)
|
||||
{
|
||||
buffered_widget->detail->background_type = background_type;
|
||||
|
||||
nautilus_buffered_widget_clear_buffer (NAUTILUS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (buffered_widget));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_get_background_type:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
*
|
||||
* Return value: The current background type.
|
||||
*/
|
||||
NautilusBackgroundType
|
||||
nautilus_buffered_widget_get_background_type (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), 0);
|
||||
|
||||
return buffered_widget->detail->background_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_set_background_color:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
* @background_color: The new background color
|
||||
*
|
||||
* Set the background color to use for when the widget's background_type is
|
||||
* NAUTILUS_BACKGROUND_SOLID.
|
||||
*/
|
||||
void
|
||||
nautilus_buffered_widget_set_background_color (NautilusBufferedWidget *buffered_widget,
|
||||
guint32 background_color)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
if (background_color != buffered_widget->detail->background_color)
|
||||
{
|
||||
buffered_widget->detail->background_color = background_color;
|
||||
|
||||
if (buffered_widget->detail->background_type == NAUTILUS_BACKGROUND_SOLID) {
|
||||
nautilus_buffered_widget_clear_buffer (NAUTILUS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (buffered_widget));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_get_background_color:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
*
|
||||
* Return value: The current background color.
|
||||
*/
|
||||
guint32
|
||||
nautilus_buffered_widget_get_background_color (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), 0);
|
||||
|
||||
return buffered_widget->detail->background_color;
|
||||
}
|
||||
|
|
|
@ -83,19 +83,31 @@ typedef struct
|
|||
guint height;
|
||||
} NautilusPixbufSize;
|
||||
|
||||
GtkType nautilus_buffered_widget_get_type (void);
|
||||
void nautilus_buffered_widget_clear_buffer (NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_tile_pixbuf (NautilusBufferedWidget *buffered_widget,
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf* nautilus_buffered_widget_get_tile_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
NautilusPixbufSize nautilus_buffered_get_tile_pixbuf_size (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_vertical_offset (NautilusBufferedWidget *image,
|
||||
int vertical_offset);
|
||||
int nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_horizontal_offset (NautilusBufferedWidget *image,
|
||||
int horizontal_offset);
|
||||
int nautilus_buffered_widget_get_horizontal_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
typedef enum
|
||||
{
|
||||
NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE,
|
||||
NAUTILUS_BACKGROUND_NONE,
|
||||
NAUTILUS_BACKGROUND_SOLID
|
||||
} NautilusBackgroundType;
|
||||
|
||||
GtkType nautilus_buffered_widget_get_type (void);
|
||||
void nautilus_buffered_widget_clear_buffer (NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_tile_pixbuf (NautilusBufferedWidget *buffered_widget,
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf* nautilus_buffered_widget_get_tile_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
NautilusPixbufSize nautilus_buffered_get_tile_pixbuf_size (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_vertical_offset (NautilusBufferedWidget *image,
|
||||
int vertical_offset);
|
||||
int nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_horizontal_offset (NautilusBufferedWidget *image,
|
||||
int horizontal_offset);
|
||||
int nautilus_buffered_widget_get_horizontal_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_background_type (NautilusBufferedWidget *image,
|
||||
NautilusBackgroundType background_type);
|
||||
NautilusBackgroundType nautilus_buffered_widget_get_background_type (const NautilusBufferedWidget *image);
|
||||
void nautilus_buffered_widget_set_background_color (NautilusBufferedWidget *image,
|
||||
guint32 background_color);
|
||||
guint32 nautilus_buffered_widget_get_background_color (const NautilusBufferedWidget *image);
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
|
|
|
@ -764,6 +764,22 @@ nautilus_gdk_create_copy_area_gc (GdkWindow *window)
|
|||
return copy_area_gc;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_gdk_gc_ref_if_not_null (GdkGC *gc_or_null)
|
||||
{
|
||||
if (gc_or_null != NULL) {
|
||||
gdk_gc_ref (gc_or_null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_gdk_gc_unref_if_not_null (GdkGC *gc_or_null)
|
||||
{
|
||||
if (gc_or_null != NULL) {
|
||||
gdk_gc_unref (gc_or_null);
|
||||
}
|
||||
}
|
||||
|
||||
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
|
||||
|
||||
static char *
|
||||
|
|
|
@ -68,6 +68,7 @@ char * nautilus_gradient_set_right_color_spec (const char *grad
|
|||
char * nautilus_gradient_set_bottom_color_spec (const char *gradient_spec,
|
||||
const char *bottom_color);
|
||||
|
||||
|
||||
/* A version of parse_color that substitutes a default color instead of returning
|
||||
a boolean to indicate it cannot be parsed.
|
||||
*/
|
||||
|
@ -79,10 +80,11 @@ void nautilus_gdk_color_parse_with_white_default (const char *colo
|
|||
guint32 nautilus_parse_rgb_with_default (const char *color_spec,
|
||||
guint32 default_rgb);
|
||||
guint32 nautilus_parse_rgb_with_white_default (const char *color_spec);
|
||||
guint32 nautilus_rgb_shift_color (guint32 color,
|
||||
float shift_by);
|
||||
guint32 nautilus_gdk_color_to_rgb (const GdkColor *color);
|
||||
guint32 nautilus_rgb_shift_color (guint32 color,
|
||||
float shift_by);
|
||||
guint32 nautilus_gdk_color_to_rgb (const GdkColor *color);
|
||||
GdkColor * nautilus_gdk_rgb_to_color (const guint32 color);
|
||||
|
||||
/* Fill routines that take GdkRectangle parameters instead of four integers. */
|
||||
void nautilus_fill_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
|
@ -97,9 +99,11 @@ void nautilus_fill_rectangle_with_gradient (GdkDrawable *draw
|
|||
guint32 start_rgb,
|
||||
guint32 end_rgb,
|
||||
gboolean horizontal_gradient);
|
||||
|
||||
/* A routine to get a 50% gray stippled bitmap for use in some types of highlighting. */
|
||||
GdkBitmap *nautilus_stipple_bitmap (void);
|
||||
|
||||
|
||||
/* Misc GdkRectangle helper functions */
|
||||
gboolean nautilus_rectangle_contains (const GdkRectangle *rectangle,
|
||||
int x,
|
||||
|
@ -108,27 +112,33 @@ void nautilus_rectangle_inset (GdkRectangle *rect
|
|||
int x,
|
||||
int y);
|
||||
|
||||
|
||||
/* A basic operation we use for drawing gradients is interpolating two colors.*/
|
||||
guint32 nautilus_interpolate_color (gdouble ratio,
|
||||
guint32 start_rgb,
|
||||
guint32 end_rgb);
|
||||
|
||||
|
||||
/* Misc GdkFont helper functions */
|
||||
gboolean nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
|
||||
GdkFont *font_b_null_allowed);
|
||||
GdkFont * nautilus_get_largest_fitting_font (const char *text_to_format,
|
||||
int width,
|
||||
const char *font_format);
|
||||
GdkFont * nautilus_gdk_font_get_bold (const GdkFont *plain);
|
||||
GdkFont * nautilus_gdk_font_get_bold (const GdkFont *plain);
|
||||
|
||||
|
||||
|
||||
/* Misc GdkWindow helper functions */
|
||||
void nautilus_gdk_window_bring_to_front (GdkWindow *window);
|
||||
|
||||
|
||||
/* In GNOME 2.0 this function will be in the libraries */
|
||||
void nautilus_set_mini_icon (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
GdkGC * nautilus_gdk_create_copy_area_gc (GdkWindow *window);
|
||||
GdkGC * nautilus_gdk_create_copy_area_gc (GdkWindow *window);
|
||||
void nautilus_gdk_gc_ref_if_not_null (GdkGC *gc_or_null);
|
||||
void nautilus_gdk_gc_unref_if_not_null (GdkGC *gc_or_null);
|
||||
|
||||
#endif /* NAUTILUS_GDK_EXTENSIONS_H */
|
||||
|
|
|
@ -432,9 +432,15 @@ label_recompute_line_geometries (NautilusLabel *label)
|
|||
|
||||
/* Public NautilusLabel */
|
||||
GtkWidget*
|
||||
nautilus_label_new (void)
|
||||
nautilus_label_new (const char *text)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (nautilus_label_get_type ()));
|
||||
NautilusLabel *label;
|
||||
|
||||
label = NAUTILUS_LABEL (gtk_type_new (nautilus_label_get_type ()));
|
||||
|
||||
nautilus_label_set_text (label, text);
|
||||
|
||||
return GTK_WIDGET (label);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -71,7 +71,7 @@ struct _NautilusLabelClass
|
|||
};
|
||||
|
||||
GtkType nautilus_label_get_type (void);
|
||||
GtkWidget * nautilus_label_new (void);
|
||||
GtkWidget * nautilus_label_new (const char *text);
|
||||
void nautilus_label_set_text (NautilusLabel *label,
|
||||
const char *text);
|
||||
char* nautilus_label_get_text (NautilusLabel *label);
|
||||
|
@ -105,7 +105,6 @@ void nautilus_label_set_drop_shadow_color (NautilusLabel
|
|||
guint32 color);
|
||||
guint32 nautilus_label_get_drop_shadow_color (const NautilusLabel *label);
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif /* NAUTILUS_LABEL_H */
|
||||
|
|
|
@ -61,74 +61,55 @@ enum
|
|||
/* Detail member struct */
|
||||
struct _NautilusBufferedWidgetDetail
|
||||
{
|
||||
GdkGC *copy_area_gc;
|
||||
GdkPixbuf *buffer_pixbuf;
|
||||
GdkPixbuf *tile_pixbuf;
|
||||
int horizontal_offset;
|
||||
int vertical_offset;
|
||||
guint background_appearance_changed_connection;
|
||||
GdkGC *copy_area_gc;
|
||||
GdkPixbuf *buffer_pixbuf;
|
||||
GdkPixbuf *tile_pixbuf;
|
||||
int horizontal_offset;
|
||||
int vertical_offset;
|
||||
guint background_appearance_changed_connection;
|
||||
NautilusBackgroundType background_type;
|
||||
guint32 background_color;
|
||||
};
|
||||
|
||||
/* GdkGC refcounting macros */ \
|
||||
#define NAUTILUS_GDK_GC_UNREF_IF(_gc) \
|
||||
NAUTILUS_MACRO_BEGIN \
|
||||
if ((_gc) != NULL) { \
|
||||
gdk_gc_unref (_gc); \
|
||||
(_gc) = NULL; \
|
||||
} \
|
||||
NAUTILUS_MACRO_END
|
||||
|
||||
#define NAUTILUS_GDK_GC_REF_IF(_gc) \
|
||||
NAUTILUS_MACRO_BEGIN \
|
||||
if ((_gc) != NULL) { \
|
||||
gdk_gc_ref (_gc); \
|
||||
} \
|
||||
NAUTILUS_MACRO_END
|
||||
|
||||
/* GtkObjectClass methods */
|
||||
static void nautilus_buffered_widget_initialize_class (NautilusBufferedWidgetClass *buffered_widget_class);
|
||||
static void nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget);
|
||||
static void nautilus_buffered_widget_destroy (GtkObject *object);
|
||||
static void nautilus_buffered_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_buffered_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
|
||||
|
||||
static void nautilus_buffered_widget_initialize_class (NautilusBufferedWidgetClass *buffered_widget_class);
|
||||
static void nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget);
|
||||
static void nautilus_buffered_widget_destroy (GtkObject *object);
|
||||
static void nautilus_buffered_widget_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_buffered_widget_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
|
||||
/* GtkWidgetClass methods */
|
||||
static void nautilus_buffered_widget_realize (GtkWidget *widget);
|
||||
static void nautilus_buffered_widget_draw (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void nautilus_buffered_widget_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
|
||||
static void nautilus_buffered_widget_realize (GtkWidget *widget);
|
||||
static void nautilus_buffered_widget_draw (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void nautilus_buffered_widget_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
/* GtkWidgetClass event methods */
|
||||
static gint nautilus_buffered_widget_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
|
||||
static gint nautilus_buffered_widget_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
/* Private NautilusBufferedWidget things */
|
||||
static void background_appearance_changed_callback (NautilusBackground *background,
|
||||
gpointer callback_data);
|
||||
static GdkPixbuf* buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buffered_widget,
|
||||
GdkGC *gc);
|
||||
static void buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget);
|
||||
static GtkWidget *nautilus_gtk_widget_find_background_ancestor (GtkWidget *widget);
|
||||
static void nautilus_gdk_pixbuf_tile_alpha (GdkPixbuf *pixbuf,
|
||||
const GdkPixbuf *tile_pixbuf,
|
||||
guint tile_width,
|
||||
guint tile_height,
|
||||
gint tile_origin_x,
|
||||
gint tile_origin_y,
|
||||
GdkInterpType interpolation_mode,
|
||||
guchar overall_alpha);
|
||||
static void connect_to_background_if_needed (NautilusBufferedWidget *buffered_widget);
|
||||
|
||||
static void background_appearance_changed_callback (NautilusBackground *background,
|
||||
gpointer callback_data);
|
||||
static GdkPixbuf* create_background_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_none (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_solid (const NautilusBufferedWidget *buffered_widget);
|
||||
static GdkPixbuf* create_background_pixbuf_from_ancestor (const NautilusBufferedWidget *buffered_widget);
|
||||
static void buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget);
|
||||
static GtkWidget *nautilus_gtk_widget_find_background_ancestor (GtkWidget *widget);
|
||||
static void nautilus_gdk_pixbuf_tile_alpha (GdkPixbuf *pixbuf,
|
||||
const GdkPixbuf *tile_pixbuf,
|
||||
guint tile_width,
|
||||
guint tile_height,
|
||||
gint tile_origin_x,
|
||||
gint tile_origin_y,
|
||||
GdkInterpType interpolation_mode,
|
||||
guchar overall_alpha);
|
||||
static void connect_to_background_if_needed (NautilusBufferedWidget *buffered_widget);
|
||||
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBufferedWidget, nautilus_buffered_widget, GTK_TYPE_MISC)
|
||||
|
@ -170,6 +151,8 @@ nautilus_buffered_widget_initialize (NautilusBufferedWidget *buffered_widget)
|
|||
buffered_widget->detail->horizontal_offset = 0;
|
||||
buffered_widget->detail->vertical_offset = 0;
|
||||
buffered_widget->detail->background_appearance_changed_connection = 0;
|
||||
buffered_widget->detail->background_type = NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE;
|
||||
buffered_widget->detail->background_color = NAUTILUS_RGB_COLOR_WHITE;
|
||||
}
|
||||
|
||||
/* GtkObjectClass methods */
|
||||
|
@ -183,12 +166,12 @@ nautilus_buffered_widget_destroy (GtkObject *object)
|
|||
|
||||
buffered_widget = NAUTILUS_BUFFERED_WIDGET (object);
|
||||
|
||||
NAUTILUS_GDK_GC_UNREF_IF (buffered_widget->detail->copy_area_gc);
|
||||
nautilus_gdk_gc_unref_if_not_null (buffered_widget->detail->copy_area_gc);
|
||||
buffered_widget->detail->copy_area_gc = NULL;
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->buffer_pixbuf);
|
||||
buffered_widget->detail->buffer_pixbuf = NULL;
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->tile_pixbuf);
|
||||
buffered_widget->detail->tile_pixbuf = NULL;
|
||||
NAUTILUS_GDK_GC_UNREF_IF (buffered_widget->detail->copy_area_gc);
|
||||
|
||||
g_free (buffered_widget->detail);
|
||||
|
||||
|
@ -447,10 +430,9 @@ static void
|
|||
buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf_without_alpha;
|
||||
GdkPixbuf *background_pixbuf;
|
||||
ArtIRect clip_rect;
|
||||
GdkPoint destination_point;
|
||||
NautilusBufferedWidgetClass *buffered_widget_class;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
|
@ -458,11 +440,17 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
|
||||
nautilus_gdk_pixbuf_unref_if_not_null (buffered_widget->detail->buffer_pixbuf);
|
||||
|
||||
pixbuf_without_alpha = buffered_widget_create_pixbuf_from_background (buffered_widget,
|
||||
buffered_widget->detail->copy_area_gc);
|
||||
buffered_widget->detail->buffer_pixbuf = gdk_pixbuf_add_alpha (pixbuf_without_alpha, FALSE, 0, 0, 0);
|
||||
background_pixbuf = create_background_pixbuf (buffered_widget);
|
||||
g_assert (background_pixbuf != NULL);
|
||||
|
||||
gdk_pixbuf_unref (pixbuf_without_alpha);
|
||||
// if (!gdk_pixbuf_get_has_alpha (background_pixbuf)) {
|
||||
buffered_widget->detail->buffer_pixbuf = gdk_pixbuf_add_alpha (background_pixbuf, FALSE, 0, 0, 0);
|
||||
|
||||
gdk_pixbuf_unref (background_pixbuf);
|
||||
// }
|
||||
// else {
|
||||
// buffered_widget->detail->buffer_pixbuf = background_pixbuf;
|
||||
// }
|
||||
|
||||
g_assert (buffered_widget->detail->buffer_pixbuf != NULL);
|
||||
|
||||
|
@ -475,10 +463,6 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
destination_point.x = 0;
|
||||
destination_point.y = 0;
|
||||
|
||||
buffered_widget_class = NAUTILUS_BUFFERED_WIDGET_CLASS (NAUTILUS_CLASS (buffered_widget));
|
||||
g_assert (buffered_widget_class != NULL);
|
||||
g_assert (buffered_widget_class->render_buffer_pixbuf != NULL);
|
||||
|
||||
if (buffered_widget->detail->tile_pixbuf != NULL) {
|
||||
nautilus_gdk_pixbuf_tile_alpha (buffered_widget->detail->buffer_pixbuf,
|
||||
buffered_widget->detail->tile_pixbuf,
|
||||
|
@ -498,25 +482,82 @@ buffered_widget_update_pixbuf (NautilusBufferedWidget *buffered_widget)
|
|||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buffered_widget,
|
||||
GdkGC *gc)
|
||||
create_background_pixbuf_from_none (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
|
||||
|
||||
gtk_paint_flat_box (widget->style,
|
||||
pixmap,
|
||||
widget->state,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL,
|
||||
widget,
|
||||
"eventbox",
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
gdk_rgb_get_cmap (),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf_from_solid (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, widget->allocation.width, widget->allocation.height);
|
||||
|
||||
nautilus_gdk_pixbuf_fill_rectangle_with_color (pixbuf, NULL, buffered_widget->detail->background_color);
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf_from_ancestor (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GtkWidget *background_ancestor;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
g_return_val_if_fail (gc != NULL, NULL);
|
||||
|
||||
widget = GTK_WIDGET (buffered_widget);
|
||||
|
||||
background_ancestor = nautilus_gtk_widget_find_background_ancestor (widget);
|
||||
|
||||
|
||||
if (background_ancestor != NULL) {
|
||||
NautilusBackground *background;
|
||||
GdkPixmap *pixmap;
|
||||
GdkRectangle background_area;
|
||||
|
||||
|
||||
background = nautilus_get_widget_background (background_ancestor);
|
||||
g_assert (NAUTILUS_IS_BACKGROUND (background));
|
||||
|
||||
|
@ -527,7 +568,7 @@ buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buf
|
|||
|
||||
pixmap = gdk_pixmap_new (widget->window, background_area.width, background_area.height, -1);
|
||||
|
||||
nautilus_background_draw (background, pixmap, gc, &background_area, 0, 0);
|
||||
nautilus_background_draw (background, pixmap, buffered_widget->detail->copy_area_gc, &background_area, 0, 0);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
|
@ -538,37 +579,40 @@ buffered_widget_create_pixbuf_from_background (const NautilusBufferedWidget *buf
|
|||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
gdk_pixmap_unref (pixmap);
|
||||
}
|
||||
else {
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
|
||||
|
||||
gtk_paint_flat_box (widget->style,
|
||||
pixmap,
|
||||
widget->state,
|
||||
GTK_SHADOW_NONE,
|
||||
NULL,
|
||||
widget,
|
||||
"eventbox",
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
|
||||
pixmap,
|
||||
gdk_rgb_get_cmap (),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
}
|
||||
static GdkPixbuf*
|
||||
create_background_pixbuf (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), NULL);
|
||||
|
||||
switch (buffered_widget->detail->background_type) {
|
||||
case NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE:
|
||||
pixbuf = create_background_pixbuf_from_ancestor (buffered_widget);
|
||||
if (!pixbuf) {
|
||||
pixbuf = create_background_pixbuf_from_none (buffered_widget);
|
||||
}
|
||||
break;
|
||||
|
||||
case NAUTILUS_BACKGROUND_SOLID:
|
||||
pixbuf = create_background_pixbuf_from_solid (buffered_widget);
|
||||
break;
|
||||
|
||||
default:
|
||||
case NAUTILUS_BACKGROUND_NONE:
|
||||
pixbuf = create_background_pixbuf_from_none (buffered_widget);
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (pixbuf != NULL);
|
||||
|
||||
return pixbuf;
|
||||
|
@ -789,3 +833,101 @@ nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buff
|
|||
|
||||
return buffered_widget->detail->vertical_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_set_background_type:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
* @background_type: The new background type
|
||||
*
|
||||
* Change the background type for the widget as follows:
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE:
|
||||
*
|
||||
* Look for the closest ancestor widget that has an attatched
|
||||
* NautilusBackground and use that. If that fails, then use
|
||||
* the widget's background as specified by its attachted GtkStyle.
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_NONE:
|
||||
*
|
||||
* Use the widget's background as specified by its attachted GtkStyle.
|
||||
*
|
||||
* NAUTILUS_BACKGROUND_SOLID:
|
||||
*
|
||||
* Use a solid color for the background. This solid color can be
|
||||
* changed with nautilus_buffered_widget_set_background_color()
|
||||
*/
|
||||
void
|
||||
nautilus_buffered_widget_set_background_type (NautilusBufferedWidget *buffered_widget,
|
||||
NautilusBackgroundType background_type)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
g_return_if_fail (background_type >= NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE);
|
||||
g_return_if_fail (background_type <= NAUTILUS_BACKGROUND_SOLID);
|
||||
|
||||
if (background_type != buffered_widget->detail->background_type)
|
||||
{
|
||||
buffered_widget->detail->background_type = background_type;
|
||||
|
||||
nautilus_buffered_widget_clear_buffer (NAUTILUS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (buffered_widget));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_get_background_type:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
*
|
||||
* Return value: The current background type.
|
||||
*/
|
||||
NautilusBackgroundType
|
||||
nautilus_buffered_widget_get_background_type (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), 0);
|
||||
|
||||
return buffered_widget->detail->background_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_set_background_color:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
* @background_color: The new background color
|
||||
*
|
||||
* Set the background color to use for when the widget's background_type is
|
||||
* NAUTILUS_BACKGROUND_SOLID.
|
||||
*/
|
||||
void
|
||||
nautilus_buffered_widget_set_background_color (NautilusBufferedWidget *buffered_widget,
|
||||
guint32 background_color)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
if (background_color != buffered_widget->detail->background_color)
|
||||
{
|
||||
buffered_widget->detail->background_color = background_color;
|
||||
|
||||
if (buffered_widget->detail->background_type == NAUTILUS_BACKGROUND_SOLID) {
|
||||
nautilus_buffered_widget_clear_buffer (NAUTILUS_BUFFERED_WIDGET (buffered_widget));
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (buffered_widget));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_buffered_widget_get_background_color:
|
||||
*
|
||||
* @buffered_widget: A NautilusBufferedWidget
|
||||
*
|
||||
* Return value: The current background color.
|
||||
*/
|
||||
guint32
|
||||
nautilus_buffered_widget_get_background_color (const NautilusBufferedWidget *buffered_widget)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_BUFFERED_WIDGET (buffered_widget), 0);
|
||||
|
||||
return buffered_widget->detail->background_color;
|
||||
}
|
||||
|
|
|
@ -83,19 +83,31 @@ typedef struct
|
|||
guint height;
|
||||
} NautilusPixbufSize;
|
||||
|
||||
GtkType nautilus_buffered_widget_get_type (void);
|
||||
void nautilus_buffered_widget_clear_buffer (NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_tile_pixbuf (NautilusBufferedWidget *buffered_widget,
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf* nautilus_buffered_widget_get_tile_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
NautilusPixbufSize nautilus_buffered_get_tile_pixbuf_size (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_vertical_offset (NautilusBufferedWidget *image,
|
||||
int vertical_offset);
|
||||
int nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_horizontal_offset (NautilusBufferedWidget *image,
|
||||
int horizontal_offset);
|
||||
int nautilus_buffered_widget_get_horizontal_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
typedef enum
|
||||
{
|
||||
NAUTILUS_BACKGROUND_ANCESTOR_OR_NONE,
|
||||
NAUTILUS_BACKGROUND_NONE,
|
||||
NAUTILUS_BACKGROUND_SOLID
|
||||
} NautilusBackgroundType;
|
||||
|
||||
GtkType nautilus_buffered_widget_get_type (void);
|
||||
void nautilus_buffered_widget_clear_buffer (NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_tile_pixbuf (NautilusBufferedWidget *buffered_widget,
|
||||
GdkPixbuf *pixbuf);
|
||||
GdkPixbuf* nautilus_buffered_widget_get_tile_pixbuf (const NautilusBufferedWidget *buffered_widget);
|
||||
NautilusPixbufSize nautilus_buffered_get_tile_pixbuf_size (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_vertical_offset (NautilusBufferedWidget *image,
|
||||
int vertical_offset);
|
||||
int nautilus_buffered_widget_get_vertical_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_horizontal_offset (NautilusBufferedWidget *image,
|
||||
int horizontal_offset);
|
||||
int nautilus_buffered_widget_get_horizontal_offset (const NautilusBufferedWidget *buffered_widget);
|
||||
void nautilus_buffered_widget_set_background_type (NautilusBufferedWidget *image,
|
||||
NautilusBackgroundType background_type);
|
||||
NautilusBackgroundType nautilus_buffered_widget_get_background_type (const NautilusBufferedWidget *image);
|
||||
void nautilus_buffered_widget_set_background_color (NautilusBufferedWidget *image,
|
||||
guint32 background_color);
|
||||
guint32 nautilus_buffered_widget_get_background_color (const NautilusBufferedWidget *image);
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
|
|
|
@ -764,6 +764,22 @@ nautilus_gdk_create_copy_area_gc (GdkWindow *window)
|
|||
return copy_area_gc;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_gdk_gc_ref_if_not_null (GdkGC *gc_or_null)
|
||||
{
|
||||
if (gc_or_null != NULL) {
|
||||
gdk_gc_ref (gc_or_null);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_gdk_gc_unref_if_not_null (GdkGC *gc_or_null)
|
||||
{
|
||||
if (gc_or_null != NULL) {
|
||||
gdk_gc_unref (gc_or_null);
|
||||
}
|
||||
}
|
||||
|
||||
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
|
||||
|
||||
static char *
|
||||
|
|
|
@ -68,6 +68,7 @@ char * nautilus_gradient_set_right_color_spec (const char *grad
|
|||
char * nautilus_gradient_set_bottom_color_spec (const char *gradient_spec,
|
||||
const char *bottom_color);
|
||||
|
||||
|
||||
/* A version of parse_color that substitutes a default color instead of returning
|
||||
a boolean to indicate it cannot be parsed.
|
||||
*/
|
||||
|
@ -79,10 +80,11 @@ void nautilus_gdk_color_parse_with_white_default (const char *colo
|
|||
guint32 nautilus_parse_rgb_with_default (const char *color_spec,
|
||||
guint32 default_rgb);
|
||||
guint32 nautilus_parse_rgb_with_white_default (const char *color_spec);
|
||||
guint32 nautilus_rgb_shift_color (guint32 color,
|
||||
float shift_by);
|
||||
guint32 nautilus_gdk_color_to_rgb (const GdkColor *color);
|
||||
guint32 nautilus_rgb_shift_color (guint32 color,
|
||||
float shift_by);
|
||||
guint32 nautilus_gdk_color_to_rgb (const GdkColor *color);
|
||||
GdkColor * nautilus_gdk_rgb_to_color (const guint32 color);
|
||||
|
||||
/* Fill routines that take GdkRectangle parameters instead of four integers. */
|
||||
void nautilus_fill_rectangle (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
|
@ -97,9 +99,11 @@ void nautilus_fill_rectangle_with_gradient (GdkDrawable *draw
|
|||
guint32 start_rgb,
|
||||
guint32 end_rgb,
|
||||
gboolean horizontal_gradient);
|
||||
|
||||
/* A routine to get a 50% gray stippled bitmap for use in some types of highlighting. */
|
||||
GdkBitmap *nautilus_stipple_bitmap (void);
|
||||
|
||||
|
||||
/* Misc GdkRectangle helper functions */
|
||||
gboolean nautilus_rectangle_contains (const GdkRectangle *rectangle,
|
||||
int x,
|
||||
|
@ -108,27 +112,33 @@ void nautilus_rectangle_inset (GdkRectangle *rect
|
|||
int x,
|
||||
int y);
|
||||
|
||||
|
||||
/* A basic operation we use for drawing gradients is interpolating two colors.*/
|
||||
guint32 nautilus_interpolate_color (gdouble ratio,
|
||||
guint32 start_rgb,
|
||||
guint32 end_rgb);
|
||||
|
||||
|
||||
/* Misc GdkFont helper functions */
|
||||
gboolean nautilus_gdk_font_equal (GdkFont *font_a_null_allowed,
|
||||
GdkFont *font_b_null_allowed);
|
||||
GdkFont * nautilus_get_largest_fitting_font (const char *text_to_format,
|
||||
int width,
|
||||
const char *font_format);
|
||||
GdkFont * nautilus_gdk_font_get_bold (const GdkFont *plain);
|
||||
GdkFont * nautilus_gdk_font_get_bold (const GdkFont *plain);
|
||||
|
||||
|
||||
|
||||
/* Misc GdkWindow helper functions */
|
||||
void nautilus_gdk_window_bring_to_front (GdkWindow *window);
|
||||
|
||||
|
||||
/* In GNOME 2.0 this function will be in the libraries */
|
||||
void nautilus_set_mini_icon (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
GdkGC * nautilus_gdk_create_copy_area_gc (GdkWindow *window);
|
||||
GdkGC * nautilus_gdk_create_copy_area_gc (GdkWindow *window);
|
||||
void nautilus_gdk_gc_ref_if_not_null (GdkGC *gc_or_null);
|
||||
void nautilus_gdk_gc_unref_if_not_null (GdkGC *gc_or_null);
|
||||
|
||||
#endif /* NAUTILUS_GDK_EXTENSIONS_H */
|
||||
|
|
|
@ -432,9 +432,15 @@ label_recompute_line_geometries (NautilusLabel *label)
|
|||
|
||||
/* Public NautilusLabel */
|
||||
GtkWidget*
|
||||
nautilus_label_new (void)
|
||||
nautilus_label_new (const char *text)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (nautilus_label_get_type ()));
|
||||
NautilusLabel *label;
|
||||
|
||||
label = NAUTILUS_LABEL (gtk_type_new (nautilus_label_get_type ()));
|
||||
|
||||
nautilus_label_set_text (label, text);
|
||||
|
||||
return GTK_WIDGET (label);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -71,7 +71,7 @@ struct _NautilusLabelClass
|
|||
};
|
||||
|
||||
GtkType nautilus_label_get_type (void);
|
||||
GtkWidget * nautilus_label_new (void);
|
||||
GtkWidget * nautilus_label_new (const char *text);
|
||||
void nautilus_label_set_text (NautilusLabel *label,
|
||||
const char *text);
|
||||
char* nautilus_label_get_text (NautilusLabel *label);
|
||||
|
@ -105,7 +105,6 @@ void nautilus_label_set_drop_shadow_color (NautilusLabel
|
|||
guint32 color);
|
||||
guint32 nautilus_label_get_drop_shadow_color (const NautilusLabel *label);
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif /* NAUTILUS_LABEL_H */
|
||||
|
|
|
@ -195,18 +195,17 @@ update_selection_changed (GtkWidget *radio_buttons, gpointer user_data)
|
|||
/* utility to allocate an anti-aliased description label */
|
||||
|
||||
static GtkWidget*
|
||||
make_anti_aliased_label (const char *description)
|
||||
make_anti_aliased_label (const char *text)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = nautilus_label_new ();
|
||||
label = nautilus_label_new (text);
|
||||
|
||||
nautilus_label_set_font_from_components (NAUTILUS_LABEL (label), "helvetica", "medium", NULL, NULL);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (label), 14);
|
||||
nautilus_label_set_text_justification (NAUTILUS_LABEL (label),
|
||||
GTK_JUSTIFY_LEFT);
|
||||
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), description);
|
||||
return label;
|
||||
}
|
||||
|
||||
|
@ -459,10 +458,9 @@ set_up_update_feedback_page (NautilusDruidPageEazel *page)
|
|||
gtk_box_pack_start (GTK_BOX (main_box), label, FALSE, FALSE, 8);
|
||||
|
||||
|
||||
download_label = nautilus_label_new ();
|
||||
download_label = nautilus_label_new (_("Downloading Nautilus updates..."));
|
||||
nautilus_label_set_font_from_components (NAUTILUS_LABEL (download_label), "helvetica", "medium", NULL, NULL);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (download_label), 18);
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (download_label), _("Downloading Nautilus updates..."));
|
||||
|
||||
gtk_widget_show (download_label);
|
||||
|
||||
|
|
|
@ -181,18 +181,6 @@ nautilus_property_browser_initialize_class (GtkObjectClass *object_klass)
|
|||
widget_class->drag_end = nautilus_property_browser_drag_end;
|
||||
}
|
||||
|
||||
/* utility to allocate an anti-aliased label */
|
||||
static GtkWidget*
|
||||
make_anti_aliased_label (const char *description)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = nautilus_label_new ();
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), description);
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
/* initialize the instance's fields, create the necessary subviews, etc. */
|
||||
|
||||
static void
|
||||
|
@ -281,14 +269,14 @@ nautilus_property_browser_initialize (GtkObject *object)
|
|||
gtk_container_add(GTK_CONTAINER(temp_frame), temp_hbox);
|
||||
|
||||
/* add the title label */
|
||||
property_browser->details->title_label = make_anti_aliased_label (_("Select A Category:"));
|
||||
property_browser->details->title_label = nautilus_label_new (_("Select A Category:"));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (property_browser->details->title_label), 18);
|
||||
|
||||
gtk_widget_show(property_browser->details->title_label);
|
||||
gtk_box_pack_start (GTK_BOX(temp_hbox), property_browser->details->title_label, FALSE, FALSE, 8);
|
||||
|
||||
/* add the help label */
|
||||
property_browser->details->help_label = make_anti_aliased_label ("");
|
||||
property_browser->details->help_label = nautilus_label_new ("");
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (property_browser->details->help_label), 12);
|
||||
|
||||
gtk_widget_show(property_browser->details->help_label);
|
||||
|
@ -316,7 +304,7 @@ nautilus_property_browser_initialize (GtkObject *object)
|
|||
property_browser->details->add_button = gtk_button_new ();
|
||||
gtk_widget_show(property_browser->details->add_button);
|
||||
|
||||
property_browser->details->add_button_label = make_anti_aliased_label (_("Add new..."));
|
||||
property_browser->details->add_button_label = nautilus_label_new (_("Add new..."));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (property_browser->details->add_button_label), 12);
|
||||
|
||||
gtk_widget_show(property_browser->details->add_button_label);
|
||||
|
@ -329,7 +317,7 @@ nautilus_property_browser_initialize (GtkObject *object)
|
|||
property_browser->details->remove_button = gtk_button_new();
|
||||
gtk_widget_show(property_browser->details->remove_button);
|
||||
|
||||
property_browser->details->remove_button_label = make_anti_aliased_label (_("Add new..."));
|
||||
property_browser->details->remove_button_label = nautilus_label_new (_("Add new..."));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (property_browser->details->remove_button_label), 12);
|
||||
|
||||
gtk_widget_show(property_browser->details->remove_button_label);
|
||||
|
@ -1498,11 +1486,12 @@ make_properties_from_directory_path (NautilusPropertyBrowser *property_browser,
|
|||
gtk_box_pack_start(GTK_BOX(temp_vbox), event_box, FALSE, FALSE, 0);
|
||||
|
||||
filtered_name = format_name_for_display (current_file_info->name);
|
||||
/* this is temporarily disabled to due scrolling bug that Ramiro will fix soon
|
||||
label = make_anti_aliased_label (filtered_name);
|
||||
label = nautilus_label_new (filtered_name);
|
||||
nautilus_buffered_widget_set_background_type (NAUTILUS_BUFFERED_WIDGET (label),
|
||||
NAUTILUS_BACKGROUND_SOLID);
|
||||
nautilus_buffered_widget_set_background_color (NAUTILUS_BUFFERED_WIDGET (label),
|
||||
NAUTILUS_RGB_COLOR_WHITE);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (label), 12);
|
||||
*/
|
||||
label = gtk_label_new (filtered_name);
|
||||
|
||||
g_free(filtered_name);
|
||||
gtk_box_pack_start (GTK_BOX(temp_vbox), label, FALSE, FALSE, 0);
|
||||
|
@ -1645,7 +1634,7 @@ make_properties_from_xml_node (NautilusPropertyBrowser *property_browser, xmlNod
|
|||
gtk_box_pack_start (GTK_BOX (container), label_box, FALSE, FALSE, 0);
|
||||
|
||||
label_text = make_color_label (color_str);
|
||||
label = make_anti_aliased_label (label_text);
|
||||
label = nautilus_label_new (label_text);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (label), 10);
|
||||
|
||||
g_free (label_text);
|
||||
|
@ -1727,7 +1716,7 @@ make_category_link(NautilusPropertyBrowser *property_browser, char* name, char *
|
|||
gtk_box_pack_start (GTK_BOX (temp_vbox), button, FALSE, FALSE, 1);
|
||||
|
||||
/* use the name as a label */
|
||||
label = make_anti_aliased_label (display_name);
|
||||
label = nautilus_label_new (display_name);
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (label), 12);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (temp_vbox), label, FALSE, FALSE, 0);
|
||||
|
|
|
@ -594,7 +594,7 @@ sidebar_create_smooth_components_if_needed (NautilusSidebarTitle *sidebar_title)
|
|||
|
||||
/* Label */
|
||||
if (sidebar_title->details->smooth_title_label == NULL) {
|
||||
sidebar_title->details->smooth_title_label = nautilus_label_new ();
|
||||
sidebar_title->details->smooth_title_label = nautilus_label_new ("");
|
||||
|
||||
sidebar_title->details->smooth_title_label_font =
|
||||
NAUTILUS_SCALABLE_FONT (nautilus_scalable_font_new ("helvetica", "bold", NULL, NULL));
|
||||
|
@ -607,7 +607,7 @@ sidebar_create_smooth_components_if_needed (NautilusSidebarTitle *sidebar_title)
|
|||
|
||||
/* More info */
|
||||
if (sidebar_title->details->smooth_more_info_label == NULL) {
|
||||
sidebar_title->details->smooth_more_info_label = nautilus_label_new ();
|
||||
sidebar_title->details->smooth_more_info_label = nautilus_label_new ("");
|
||||
|
||||
sidebar_title->details->smooth_more_info_label_font =
|
||||
NAUTILUS_SCALABLE_FONT (nautilus_scalable_font_new ("helvetica", "medium", NULL, NULL));
|
||||
|
|
|
@ -122,18 +122,6 @@ nautilus_theme_selector_initialize_class (GtkObjectClass *object_klass)
|
|||
object_klass->destroy = nautilus_theme_selector_destroy;
|
||||
}
|
||||
|
||||
/* utility to make anti-aliased labels */
|
||||
|
||||
static GtkWidget*
|
||||
make_anti_aliased_label (const char *description)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = nautilus_label_new ();
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), description);
|
||||
return label;
|
||||
}
|
||||
|
||||
/* initialize the instance's fields, create the necessary subviews, etc. */
|
||||
|
||||
static void
|
||||
|
@ -188,14 +176,14 @@ nautilus_theme_selector_initialize (GtkObject *object)
|
|||
gtk_container_add(GTK_CONTAINER(temp_frame), temp_hbox);
|
||||
|
||||
/* add the title label */
|
||||
theme_selector->details->title_label = make_anti_aliased_label (_("Nautilus Theme:"));
|
||||
theme_selector->details->title_label = nautilus_label_new (_("Nautilus Theme:"));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (theme_selector->details->title_label), 18);
|
||||
|
||||
gtk_widget_show(theme_selector->details->title_label);
|
||||
gtk_box_pack_start (GTK_BOX(temp_hbox), theme_selector->details->title_label, FALSE, FALSE, 8);
|
||||
|
||||
/* add the help label */
|
||||
theme_selector->details->help_label = make_anti_aliased_label (_("Click on a theme to change the\nappearance of Nautilus."));
|
||||
theme_selector->details->help_label = nautilus_label_new (_("Click on a theme to change the\nappearance of Nautilus."));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (theme_selector->details->help_label), 12);
|
||||
|
||||
gtk_widget_show(theme_selector->details->help_label);
|
||||
|
@ -248,7 +236,7 @@ nautilus_theme_selector_initialize (GtkObject *object)
|
|||
theme_selector->details->add_button = gtk_button_new ();
|
||||
gtk_widget_show(theme_selector->details->add_button);
|
||||
|
||||
theme_selector->details->add_button_label = make_anti_aliased_label (_("Add new theme"));
|
||||
theme_selector->details->add_button_label = nautilus_label_new (_("Add new theme"));
|
||||
nautilus_label_set_font_size (NAUTILUS_LABEL (theme_selector->details->add_button_label), 14);
|
||||
|
||||
gtk_widget_show(theme_selector->details->add_button_label);
|
||||
|
@ -260,7 +248,7 @@ nautilus_theme_selector_initialize (GtkObject *object)
|
|||
/* now create the "remove" button */
|
||||
theme_selector->details->remove_button = gtk_button_new();
|
||||
|
||||
theme_selector->details->remove_button_label = make_anti_aliased_label (_("Remove theme"));
|
||||
theme_selector->details->remove_button_label = nautilus_label_new (_("Remove theme"));
|
||||
gtk_widget_show(theme_selector->details->remove_button_label);
|
||||
gtk_container_add (GTK_CONTAINER(theme_selector->details->remove_button), theme_selector->details->remove_button_label);
|
||||
gtk_box_pack_end (GTK_BOX (theme_selector->details->bottom_box),
|
||||
|
|
|
@ -609,7 +609,7 @@ main (int argc, char* argv[])
|
|||
main_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_box);
|
||||
|
||||
label = nautilus_label_new ();
|
||||
label = nautilus_label_new ("Label that doesn't suck\nFoo\nBar");
|
||||
|
||||
bottom_box = gtk_vbox_new (FALSE, 4);
|
||||
|
||||
|
@ -623,8 +623,6 @@ main (int argc, char* argv[])
|
|||
gtk_box_pack_start (GTK_BOX (bottom_box), tool_box2, TRUE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (bottom_box), tool_box3, TRUE, TRUE, 10);
|
||||
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), "Label that doesn't suck\nFoo\nBar");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_box), label, TRUE, TRUE, 10);
|
||||
gtk_box_pack_end (GTK_BOX (main_box), bottom_box, TRUE, TRUE, 10);
|
||||
|
||||
|
|
|
@ -635,7 +635,7 @@ main (int argc, char* argv[])
|
|||
main_box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_box);
|
||||
|
||||
label = nautilus_label_new ();
|
||||
label = nautilus_label_new ("Label that doesn't suck\nFoo\nBar");
|
||||
|
||||
bottom_box = gtk_vbox_new (FALSE, 4);
|
||||
|
||||
|
@ -649,8 +649,6 @@ main (int argc, char* argv[])
|
|||
gtk_box_pack_start (GTK_BOX (bottom_box), tool_box2, TRUE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (bottom_box), tool_box3, TRUE, TRUE, 10);
|
||||
|
||||
nautilus_label_set_text (NAUTILUS_LABEL (label), "Label that doesn't suck\nFoo\nBar");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_box), label, TRUE, TRUE, 10);
|
||||
gtk_box_pack_end (GTK_BOX (main_box), bottom_box, TRUE, TRUE, 10);
|
||||
|
||||
|
|
Loading…
Reference in a new issue