[gnome-control-center] user-accounts: Remove unused icon style code
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Remove unused icon style code
- Date: Tue, 13 Nov 2018 21:16:12 +0000 (UTC)
commit 96b6ae98d0b32be1ae26def69c4476227c55522c
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Nov 9 09:14:58 2018 +1300
user-accounts: Remove unused icon style code
panels/user-accounts/cc-user-image.c | 1 -
panels/user-accounts/um-utils.c | 156 +----------------------------------
panels/user-accounts/um-utils.h | 15 ----
3 files changed, 3 insertions(+), 169 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-image.c b/panels/user-accounts/cc-user-image.c
index 68b5455ad..94a2880a9 100644
--- a/panels/user-accounts/cc-user-image.c
+++ b/panels/user-accounts/cc-user-image.c
@@ -43,7 +43,6 @@ render_image (CcUserImage *image)
pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (image));
scale = gtk_widget_get_scale_factor (GTK_WIDGET (image));
surface = render_user_icon (image->user,
- UM_ICON_STYLE_NONE,
pixel_size > 0 ? pixel_size : 48,
scale);
gtk_image_set_from_surface (GTK_IMAGE (image), surface);
diff --git a/panels/user-accounts/um-utils.c b/panels/user-accounts/um-utils.c
index c01bc1f70..5238cae89 100644
--- a/panels/user-accounts/um-utils.c
+++ b/panels/user-accounts/um-utils.c
@@ -362,49 +362,6 @@ popup_menu_below_button (GtkMenu *menu,
*push_in = TRUE;
}
-void
-rounded_rectangle (cairo_t *cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height)
-{
- gdouble radius;
- gdouble degrees;
-
- radius = corner_radius / aspect;
- degrees = G_PI / 180.0;
-
- cairo_new_sub_path (cr);
- cairo_arc (cr,
- x + width - radius,
- y + radius,
- radius,
- -90 * degrees,
- 0 * degrees);
- cairo_arc (cr,
- x + width - radius,
- y + height - radius,
- radius,
- 0 * degrees,
- 90 * degrees);
- cairo_arc (cr,
- x + radius,
- y + height - radius,
- radius,
- 90 * degrees,
- 180 * degrees);
- cairo_arc (cr,
- x + radius,
- y + radius,
- radius,
- 180 * degrees,
- 270 * degrees);
- cairo_close_path (cr);
-}
-
/* Taken from defines.h in shadow-utils. On Linux, this value is much smaller
* than the sysconf limit LOGIN_NAME_MAX, and values larger than this will
* result in failure when running useradd. We could check UT_NAMESIZE instead,
@@ -768,105 +725,14 @@ check_user_file (const char *filename,
return TRUE;
}
-static GdkPixbuf *
-frame_pixbuf (GdkPixbuf *source, gint scale)
-{
- GdkPixbuf *dest;
- cairo_t *cr;
- cairo_surface_t *surface;
- guint w;
- guint h;
- int frame_width;
- double radius;
-
- frame_width = 2 * scale;
-
- w = gdk_pixbuf_get_width (source) + frame_width * 2;
- h = gdk_pixbuf_get_height (source) + frame_width * 2;
- radius = w / 10;
-
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
- w, h);
- cr = cairo_create (surface);
- cairo_surface_destroy (surface);
-
- /* set up image */
- cairo_rectangle (cr, 0, 0, w, h);
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
- cairo_fill (cr);
-
- rounded_rectangle (cr, 1.0, 0.5, 0.5, radius, w - 1, h - 1);
- cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.3);
- cairo_fill_preserve (cr);
-
- gdk_cairo_set_source_pixbuf (cr, source, frame_width, frame_width);
- cairo_fill (cr);
-
- dest = gdk_pixbuf_get_from_surface (surface, 0, 0, w, h);
-
- cairo_destroy (cr);
-
- return dest;
-}
-
-static GdkPixbuf *
-logged_in_pixbuf (GdkPixbuf *pixbuf, gint scale)
-{
- cairo_format_t format;
- cairo_surface_t *surface;
- cairo_pattern_t *pattern;
- cairo_t *cr;
- gint width, height;
- GdkRGBA color;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- g_return_val_if_fail (width > 15 && height > 15, pixbuf);
-
- format = gdk_pixbuf_get_has_alpha (pixbuf) ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24;
- surface = cairo_image_surface_create (format, width, height);
- cr = cairo_create (surface);
-
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
-
- /* Draw pattern */
- cairo_rectangle (cr, 0, 0, width, height);
- pattern = cairo_pattern_create_radial (width - 9.5 * scale, height - 10 * scale, 0,
- width - 8.5 * scale, height - 7.5 * scale, 7.7 * scale);
- cairo_pattern_add_color_stop_rgb (pattern, 0, 0.4, 0.9, 0);
- cairo_pattern_add_color_stop_rgb (pattern, 0.7, 0.3, 0.6, 0);
- cairo_pattern_add_color_stop_rgb (pattern, 0.8, 0.4, 0.4, 0.4);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0, 0, 0, 0);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
-
- /* Draw border */
- cairo_set_line_width (cr, 0.9 * scale);
- cairo_arc (cr, width - 8.5 * scale, height - 8.5 * scale, 6 * scale, 0, 2 * G_PI);
- gdk_rgba_parse (&color, "#ffffff");
- gdk_cairo_set_source_rgba (cr, &color);
- cairo_stroke (cr);
-
- pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
-
- cairo_surface_finish (surface);
- cairo_destroy (cr);
-
- return pixbuf;
-}
-
#define MAX_FILE_SIZE 65536
cairo_surface_t *
-render_user_icon (ActUser *user,
- UmIconStyle style,
- gint icon_size,
- gint scale)
+render_user_icon (ActUser *user,
+ gint icon_size,
+ gint scale)
{
GdkPixbuf *pixbuf;
- GdkPixbuf *framed;
gboolean res;
GError *error;
const gchar *icon_file;
@@ -908,22 +774,6 @@ render_user_icon (ActUser *user,
out:
- if (pixbuf != NULL && (style & UM_ICON_STYLE_FRAME)) {
- framed = frame_pixbuf (pixbuf, scale);
- if (framed != NULL) {
- g_object_unref (pixbuf);
- pixbuf = framed;
- }
- }
-
- if (pixbuf != NULL && (style & UM_ICON_STYLE_STATUS) && act_user_is_logged_in (user)) {
- framed = logged_in_pixbuf (pixbuf, scale);
- if (framed != NULL) {
- g_object_unref (pixbuf);
- pixbuf = framed;
- }
- }
-
if (pixbuf != NULL) {
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL);
g_object_unref (pixbuf);
diff --git a/panels/user-accounts/um-utils.h b/panels/user-accounts/um-utils.h
index aa9e6fbb0..5127f1768 100644
--- a/panels/user-accounts/um-utils.h
+++ b/panels/user-accounts/um-utils.h
@@ -25,12 +25,6 @@
G_BEGIN_DECLS
-typedef enum {
- UM_ICON_STYLE_NONE = 0,
- UM_ICON_STYLE_FRAME = 1 << 0,
- UM_ICON_STYLE_STATUS = 1 << 1
-} UmIconStyle;
-
void setup_tooltip_with_embedded_icon (GtkWidget *widget,
const gchar *text,
const gchar *placeholder,
@@ -50,14 +44,6 @@ void popup_menu_below_button (GtkMenu *menu,
gboolean *push_in,
GtkWidget *button);
-void rounded_rectangle (cairo_t *cr,
- gdouble aspect,
- gdouble x,
- gdouble y,
- gdouble corner_radius,
- gdouble width,
- gdouble height);
-
gboolean is_valid_name (const gchar *name);
gboolean is_valid_username (const gchar *name,
gchar **tip);
@@ -66,7 +52,6 @@ void generate_username_choices (const gchar *name,
GtkListStore *store);
cairo_surface_t *render_user_icon (ActUser *user,
- UmIconStyle style,
gint icon_size,
gint scale);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]