Skip to content

Commit

Permalink
remove rb_image_new_from_stock
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Matthew committed Feb 23, 2015
1 parent 62b30b1 commit df57c71
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 86 deletions.
84 changes: 0 additions & 84 deletions lib/rb-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,90 +292,6 @@ rb_safe_strcmp (const char *a,
return (!a && !b) ? 0 : (a && !b) || (!a && b) ? 1 : strcmp (a, b);
}

/* Taken from totem/video-utils.c CVS HEAD 2004-04-22 */
static void
totem_pixbuf_mirror (GdkPixbuf *pixbuf)
{
int i, j, rowstride, offset, right;
guchar *pixels;
int width, height, size;
guint32 tmp;

pixels = gdk_pixbuf_get_pixels (pixbuf);
g_return_if_fail (pixels != NULL);

width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
size = height * width * sizeof (guint32);

for (i = 0; i < size; i += rowstride)
{
for (j = 0; j < rowstride; j += sizeof(guint32))
{
offset = i + j;
right = i + (((width - 1) * sizeof(guint32)) - j);

if (right <= offset)
break;

memcpy (&tmp, pixels + offset, sizeof(guint32));
memcpy (pixels + offset, pixels + right,
sizeof(guint32));
memcpy (pixels + right, &tmp, sizeof(guint32));
}
}
}



/**
* rb_image_new_from_stock:
* @stock_id: stock image id
* @size: requested icon size
*
* Same as @gtk_image_new_from_stock except that it mirrors the icons for RTL
* languages.
*
* Return value: (transfer full): a #GtkImage of the requested stock item
*/
GtkWidget *
rb_image_new_from_stock (const gchar *stock_id, GtkIconSize size)
{
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR) {
return gtk_image_new_from_stock (stock_id, size);
} else {

GtkWidget *image;
GdkPixbuf *pixbuf;
GdkPixbuf *mirror;

image = gtk_image_new ();

if (image == NULL) {
return NULL;
}

pixbuf = gtk_widget_render_icon_pixbuf (image, stock_id, size);
g_assert (pixbuf != NULL);


mirror = gdk_pixbuf_copy (pixbuf);
g_object_unref (pixbuf);

if (!mirror)
return NULL;

totem_pixbuf_mirror (mirror);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), mirror);
g_object_unref (mirror);

return image;
}

return NULL;
}

/**
* rb_is_main_thread:
*
Expand Down
2 changes: 0 additions & 2 deletions lib/rb-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ char *rb_make_time_string (guint seconds);
char *rb_make_duration_string (guint duration);
char *rb_make_elapsed_time_string (guint elapsed, guint duration, gboolean show_remaining);

GtkWidget *rb_image_new_from_stock (const gchar *stock_id, GtkIconSize size);

void rb_threads_init (void);
gboolean rb_is_main_thread (void);

Expand Down

0 comments on commit df57c71

Please sign in to comment.