mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 12:25:31 +00:00
Port to libhandy 1
This ports Calls to libhandy 1 and drops the embedded HdyAvatar in favor of the libhandy one. Fixes https://source.puri.sm/Librem5/calls/-/issues/172
This commit is contained in:
parent
019b4fd407
commit
6dba2c453b
20 changed files with 13 additions and 834 deletions
2
debian/control
vendored
2
debian/control
vendored
|
@ -7,7 +7,7 @@ Uploaders:
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
debhelper (>= 11),
|
debhelper (>= 11),
|
||||||
libfeedback-dev,
|
libfeedback-dev,
|
||||||
libhandy-0.0-dev (>= 0.0.12),
|
libhandy-1-dev (>= 1.0.0),
|
||||||
libgtk-3-dev,
|
libgtk-3-dev,
|
||||||
modemmanager-dev,
|
modemmanager-dev,
|
||||||
libmm-glib-dev (>= 1.12.0),
|
libmm-glib-dev (>= 1.12.0),
|
||||||
|
|
|
@ -77,8 +77,8 @@
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
"type" : "archive",
|
"type" : "archive",
|
||||||
"url" : "https://source.puri.sm/Librem5/libhandy/-/archive/v0.0.13/libhandy-v0.0.13.tar.gz",
|
"url" : "https://download.gnome.org/sources/libhandy/1.0/libhandy-1.0.0.tar.xz",
|
||||||
"sha256" : "138bec94e66d15a7a19350b65845d4529bcd969ea913ab3eb438f56fe47d5d37"
|
"sha256" : "a9398582f47b7d729205d6eac0c068fef35aaf249fdd57eea3724f8518d26699"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"cleanup" : [
|
"cleanup" : [
|
||||||
|
|
|
@ -38,10 +38,8 @@
|
||||||
#include "calls-manager.h"
|
#include "calls-manager.h"
|
||||||
#include "calls-application.h"
|
#include "calls-application.h"
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
#include <handy.h>
|
||||||
#include <libebook-contacts/libebook-contacts.h>
|
#include <libebook-contacts/libebook-contacts.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +304,8 @@ startup (GApplication *application)
|
||||||
|
|
||||||
G_APPLICATION_CLASS (calls_application_parent_class)->startup (application);
|
G_APPLICATION_CLASS (calls_application_parent_class)->startup (application);
|
||||||
|
|
||||||
|
hdy_init ();
|
||||||
|
|
||||||
g_set_prgname (APP_ID);
|
g_set_prgname (APP_ID);
|
||||||
g_set_application_name (_("Calls"));
|
g_set_application_name (_("Calls"));
|
||||||
|
|
||||||
|
@ -501,11 +501,6 @@ calls_application_class_init (CallsApplicationClass *klass)
|
||||||
g_type_ensure (CALLS_TYPE_ENCRYPTION_INDICATOR);
|
g_type_ensure (CALLS_TYPE_ENCRYPTION_INDICATOR);
|
||||||
g_type_ensure (CALLS_TYPE_HISTORY_BOX);
|
g_type_ensure (CALLS_TYPE_HISTORY_BOX);
|
||||||
g_type_ensure (CALLS_TYPE_NEW_CALL_BOX);
|
g_type_ensure (CALLS_TYPE_NEW_CALL_BOX);
|
||||||
g_type_ensure (HDY_TYPE_DIALER);
|
|
||||||
g_type_ensure (HDY_TYPE_HEADER_BAR);
|
|
||||||
g_type_ensure (HDY_TYPE_SQUEEZER);
|
|
||||||
g_type_ensure (HDY_TYPE_VIEW_SWITCHER);
|
|
||||||
g_type_ensure (HDY_TYPE_VIEW_SWITCHER_BAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
|
||||||
|
|
||||||
struct _CallsCallDisplay
|
struct _CallsCallDisplay
|
||||||
{
|
{
|
||||||
GtkOverlay parent_instance;
|
GtkOverlay parent_instance;
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
#include "calls-call-record-row.h"
|
#include "calls-call-record-row.h"
|
||||||
#include "calls-best-match.h"
|
#include "calls-best-match.h"
|
||||||
#include "calls-contacts.h"
|
#include "calls-contacts.h"
|
||||||
#include "contrib/hdy-avatar.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <handy.h>
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
|
||||||
|
|
||||||
struct _CallsCallSelectorItem
|
struct _CallsCallSelectorItem
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,8 +36,6 @@
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
#include <handy.h>
|
||||||
|
|
||||||
#ifdef CALLS_WAYLAND
|
#ifdef CALLS_WAYLAND
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
|
||||||
|
|
||||||
|
|
||||||
struct _CallsHistoryBox
|
struct _CallsHistoryBox
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CALLS_TYPE_HISTORY_BOX (calls_history_box_get_type ())
|
#define CALLS_TYPE_HISTORY_BOX (calls_history_box_get_type ())
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
#include <handy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "calls-manager.h"
|
#include "calls-manager.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#define HANDY_USE_UNSTABLE_API
|
|
||||||
#include <handy.h>
|
#include <handy.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ get_origin (CallsNewCallBox *self)
|
||||||
static void
|
static void
|
||||||
backspace_clicked_cb (CallsNewCallBox *self)
|
backspace_clicked_cb (CallsNewCallBox *self)
|
||||||
{
|
{
|
||||||
GtkWidget *entry = hdy_keypad_get_entry (self->keypad);
|
GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
|
||||||
g_signal_emit_by_name (entry, "backspace", NULL);
|
g_signal_emit_by_name (entry, "backspace", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ backspace_clicked_cb (CallsNewCallBox *self)
|
||||||
static void
|
static void
|
||||||
dial_clicked_cb (CallsNewCallBox *self)
|
dial_clicked_cb (CallsNewCallBox *self)
|
||||||
{
|
{
|
||||||
GtkWidget *entry = hdy_keypad_get_entry (self->keypad);
|
GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
|
||||||
calls_new_call_box_dial
|
calls_new_call_box_dial
|
||||||
(self,
|
(self,
|
||||||
gtk_entry_get_text (GTK_ENTRY (entry)));
|
gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||||
|
|
|
@ -1,735 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2020 Purism SPC
|
|
||||||
* Copyright (C) 2020 Felipe Borges
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Felipe Borges <felipeborges@gnome.org>
|
|
||||||
* Julian Sparber <julian@sparber.net>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "hdy-avatar.h"
|
|
||||||
|
|
||||||
#define NUMBER_OF_COLORS 8
|
|
||||||
/**
|
|
||||||
* SECTION:hdy-avatar
|
|
||||||
* @short_description: A widget displaying an image, with a generated fallback.
|
|
||||||
* @Title: HdyAvatar
|
|
||||||
*
|
|
||||||
* #HdyAvatar is a widget to display a round avatar.
|
|
||||||
* A provided image is made round before displaying, if no image is given this
|
|
||||||
* widget generates a round fallback with the initials of the #HdyAvatar:text
|
|
||||||
* on top of a colord background.
|
|
||||||
* The color is picked based on the hash of the #HdyAvatar:text.
|
|
||||||
* If #HdyAvatar:show-initials is set to %FALSE, `avatar-default-symbolic` is
|
|
||||||
* shown in place of the initials.
|
|
||||||
* Use hdy_avatar_set_image_load_func () to set a custom image.
|
|
||||||
* Create a #HdyAvatarImageLoadFunc similar to this example:
|
|
||||||
*
|
|
||||||
* |[<!-- language="C" -->
|
|
||||||
* static GdkPixbuf *
|
|
||||||
* image_load_func (gint size, gpointer user_data)
|
|
||||||
* {
|
|
||||||
* g_autoptr (GError) error = NULL;
|
|
||||||
* g_autoptr (GdkPixbuf) pixbuf = NULL;
|
|
||||||
* g_autofree gchar *file = gtk_file_chooser_get_filename ("avatar.png");
|
|
||||||
* gint width, height;
|
|
||||||
*
|
|
||||||
* gdk_pixbuf_get_file_info (file, &width, &height);
|
|
||||||
*
|
|
||||||
* pixbuf = gdk_pixbuf_new_from_file_at_scale (file,
|
|
||||||
* (width <= height) ? size : -1,
|
|
||||||
* (width >= height) ? size : -1,
|
|
||||||
* TRUE,
|
|
||||||
* error);
|
|
||||||
* if (error != NULL) {
|
|
||||||
* g_critical ("Failed to create pixbuf from file: %s", error->message);
|
|
||||||
*
|
|
||||||
* return NULL;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* return pixbuf;
|
|
||||||
* }
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* # CSS nodes
|
|
||||||
*
|
|
||||||
* #HdyAvatar has a single CSS node with name avatar.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
gchar *text;
|
|
||||||
PangoLayout *layout;
|
|
||||||
gboolean show_initials;
|
|
||||||
guint color_class;
|
|
||||||
gint size;
|
|
||||||
cairo_surface_t *round_image;
|
|
||||||
|
|
||||||
HdyAvatarImageLoadFunc load_image_func;
|
|
||||||
gpointer load_image_func_target;
|
|
||||||
GDestroyNotify load_image_func_target_destroy_notify;
|
|
||||||
} HdyAvatarPrivate;
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (HdyAvatar, hdy_avatar, GTK_TYPE_DRAWING_AREA);
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_NAME,
|
|
||||||
PROP_SHOW_INITIALS,
|
|
||||||
PROP_SIZE,
|
|
||||||
PROP_LAST_PROP,
|
|
||||||
};
|
|
||||||
static GParamSpec *props[PROP_LAST_PROP];
|
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (cairo_t, cairo_destroy)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (cairo_surface_t, cairo_surface_destroy)
|
|
||||||
|
|
||||||
static cairo_surface_t *
|
|
||||||
round_image (GdkPixbuf *pixbuf,
|
|
||||||
gdouble size)
|
|
||||||
{
|
|
||||||
g_autoptr (cairo_surface_t) surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
|
||||||
g_autoptr (cairo_t) cr = cairo_create (surface);
|
|
||||||
|
|
||||||
/* Clip a circle */
|
|
||||||
cairo_arc (cr, size / 2.0, size / 2.0, size / 2.0, 0, 2 * G_PI);
|
|
||||||
cairo_clip (cr);
|
|
||||||
cairo_new_path (cr);
|
|
||||||
|
|
||||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
|
||||||
cairo_paint (cr);
|
|
||||||
|
|
||||||
return g_steal_pointer (&surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gchar *
|
|
||||||
extract_initials_from_text (const gchar *text)
|
|
||||||
{
|
|
||||||
GString *initials;
|
|
||||||
g_autofree gchar *p = g_utf8_strup (text, -1);
|
|
||||||
g_autofree gchar *normalized = g_utf8_normalize (g_strstrip (p), -1, G_NORMALIZE_DEFAULT_COMPOSE);
|
|
||||||
gunichar unichar;
|
|
||||||
gchar *q = NULL;
|
|
||||||
|
|
||||||
if (normalized == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
initials = g_string_new ("");
|
|
||||||
|
|
||||||
unichar = g_utf8_get_char (normalized);
|
|
||||||
g_string_append_unichar (initials, unichar);
|
|
||||||
|
|
||||||
q = g_utf8_strrchr (normalized, -1, ' ');
|
|
||||||
if (q != NULL && g_utf8_next_char (q) != NULL) {
|
|
||||||
q = g_utf8_next_char (q);
|
|
||||||
|
|
||||||
unichar = g_utf8_get_char (q);
|
|
||||||
g_string_append_unichar (initials, unichar);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_string_free (initials, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_custom_image (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (self);
|
|
||||||
g_autoptr (GdkPixbuf) pixbuf = NULL;
|
|
||||||
gint scale_factor;
|
|
||||||
gint size;
|
|
||||||
gboolean was_custom = FALSE;
|
|
||||||
|
|
||||||
if (priv->round_image != NULL) {
|
|
||||||
g_clear_pointer (&priv->round_image, cairo_surface_destroy);
|
|
||||||
was_custom = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->load_image_func != NULL) {
|
|
||||||
scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (self));
|
|
||||||
size = MIN (gtk_widget_get_allocated_width (GTK_WIDGET (self)),
|
|
||||||
gtk_widget_get_allocated_height (GTK_WIDGET (self)));
|
|
||||||
pixbuf = priv->load_image_func (size * scale_factor, priv->load_image_func_target);
|
|
||||||
if (pixbuf != NULL) {
|
|
||||||
priv->round_image = round_image (pixbuf, (gdouble) size * scale_factor);
|
|
||||||
cairo_surface_set_device_scale (priv->round_image, scale_factor, scale_factor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (was_custom || priv->round_image != NULL)
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_class_color (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (self);
|
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
g_autofree GRand *rand = NULL;
|
|
||||||
g_autofree gchar *new_class = NULL;
|
|
||||||
g_autofree gchar *old_class = g_strdup_printf ("color%d", priv->color_class);
|
|
||||||
|
|
||||||
gtk_style_context_remove_class (context, old_class);
|
|
||||||
|
|
||||||
if (priv->text == NULL || strlen (priv->text) == 0) {
|
|
||||||
/* Use a random color if we don't have a text */
|
|
||||||
rand = g_rand_new ();
|
|
||||||
priv->color_class = g_rand_int_range (rand, 1, NUMBER_OF_COLORS);
|
|
||||||
} else {
|
|
||||||
priv->color_class = (g_str_hash (priv->text) % NUMBER_OF_COLORS) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_class = g_strdup_printf ("color%d", priv->color_class);
|
|
||||||
gtk_style_context_add_class (context, new_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_class_contrasted (HdyAvatar *self, gint size)
|
|
||||||
{
|
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
if (size < 25)
|
|
||||||
gtk_style_context_add_class (context, "contrasted");
|
|
||||||
else
|
|
||||||
gtk_style_context_remove_class (context, "contrasted");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clear_pango_layout (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
g_clear_object (&priv->layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ensure_pango_layout (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (self);
|
|
||||||
g_autofree gchar *initials = NULL;
|
|
||||||
|
|
||||||
if (priv->layout != NULL || priv->text == NULL || strlen (priv->text) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
initials = extract_initials_from_text (priv->text);
|
|
||||||
priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), initials);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_font_size (HdyAvatar *self,
|
|
||||||
gint size)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (self);
|
|
||||||
GtkStyleContext *context;
|
|
||||||
PangoFontDescription *font_desc;
|
|
||||||
gint width, height;
|
|
||||||
gdouble padding;
|
|
||||||
gdouble sqr_size;
|
|
||||||
gdouble max_size;
|
|
||||||
gdouble new_font_size;
|
|
||||||
|
|
||||||
if (priv->round_image != NULL || priv->layout == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
|
||||||
gtk_style_context_get (context, gtk_style_context_get_state (context),
|
|
||||||
"font", &font_desc, NULL);
|
|
||||||
|
|
||||||
pango_layout_set_font_description (priv->layout, font_desc);
|
|
||||||
pango_layout_get_pixel_size (priv->layout, &width, &height);
|
|
||||||
|
|
||||||
/* This is the size of the biggest square fitting inside the circle */
|
|
||||||
sqr_size = (gdouble)size / 1.4142;
|
|
||||||
/* The padding has to be a function of the overall size.
|
|
||||||
* The 0.4 is how steep the linear function grows and the -5 is just
|
|
||||||
* an adjustment for smaller sizes which doesn't have a big impact on bigger sizes.
|
|
||||||
* Make also sure we don't have a negative padding */
|
|
||||||
padding = MAX (size * 0.4 - 5, 0);
|
|
||||||
max_size = sqr_size - padding;
|
|
||||||
new_font_size = (gdouble)height * (max_size / (gdouble)width);
|
|
||||||
|
|
||||||
font_desc = pango_font_description_copy (font_desc);
|
|
||||||
pango_font_description_set_absolute_size (font_desc,
|
|
||||||
CLAMP (new_font_size, 0, max_size) * PANGO_SCALE);
|
|
||||||
pango_layout_set_font_description (priv->layout, font_desc);
|
|
||||||
pango_font_description_free (font_desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_get_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
HdyAvatar *self = HDY_AVATAR (object);
|
|
||||||
|
|
||||||
switch (property_id) {
|
|
||||||
case PROP_NAME:
|
|
||||||
g_value_set_string (value, hdy_avatar_get_text (self));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SHOW_INITIALS:
|
|
||||||
g_value_set_boolean (value, hdy_avatar_get_show_initials (self));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SIZE:
|
|
||||||
g_value_set_int (value, hdy_avatar_get_size (self));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_set_property (GObject *object,
|
|
||||||
guint property_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
HdyAvatar *self = HDY_AVATAR (object);
|
|
||||||
|
|
||||||
switch (property_id) {
|
|
||||||
case PROP_NAME:
|
|
||||||
hdy_avatar_set_text (self, g_value_get_string (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SHOW_INITIALS:
|
|
||||||
hdy_avatar_set_show_initials (self, g_value_get_boolean (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SIZE:
|
|
||||||
hdy_avatar_set_size (self, g_value_get_int (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (HDY_AVATAR (object));
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->text, g_free);
|
|
||||||
g_clear_pointer (&priv->round_image, cairo_surface_destroy);
|
|
||||||
g_clear_object (&priv->layout);
|
|
||||||
|
|
||||||
if (priv->load_image_func_target_destroy_notify != NULL)
|
|
||||||
priv->load_image_func_target_destroy_notify (priv->load_image_func_target);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (hdy_avatar_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
hdy_avatar_draw (GtkWidget *widget,
|
|
||||||
cairo_t *cr)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (HDY_AVATAR (widget));
|
|
||||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
|
||||||
gint width = gtk_widget_get_allocated_width (widget);
|
|
||||||
gint height = gtk_widget_get_allocated_height (widget);
|
|
||||||
gint size = MIN (width, height);
|
|
||||||
gdouble x = (gdouble)(width - size) / 2.0;
|
|
||||||
gdouble y = (gdouble)(height - size) / 2.0;
|
|
||||||
gint scale;
|
|
||||||
GdkRGBA color;
|
|
||||||
g_autoptr (GtkIconInfo) icon = NULL;
|
|
||||||
g_autoptr (GdkPixbuf) pixbuf = NULL;
|
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
g_autoptr (cairo_surface_t) surface = NULL;
|
|
||||||
|
|
||||||
set_class_contrasted (HDY_AVATAR (widget), size);
|
|
||||||
|
|
||||||
gtk_render_frame (context, cr, x, y, size, size);
|
|
||||||
|
|
||||||
if (priv->round_image) {
|
|
||||||
cairo_set_source_surface (cr, priv->round_image, x, y);
|
|
||||||
cairo_paint (cr);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_render_background (context, cr, x, y, size, size);
|
|
||||||
ensure_pango_layout (HDY_AVATAR (widget));
|
|
||||||
|
|
||||||
if (priv->show_initials && priv->layout != NULL) {
|
|
||||||
set_font_size (HDY_AVATAR (widget), size);
|
|
||||||
pango_layout_get_pixel_size (priv->layout, &width, &height);
|
|
||||||
|
|
||||||
gtk_render_layout (context, cr,
|
|
||||||
((gdouble)(size - width) / 2.0) + x,
|
|
||||||
((gdouble)(size - height) / 2.0) + y,
|
|
||||||
priv->layout);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
scale = gtk_widget_get_scale_factor (widget);
|
|
||||||
icon = gtk_icon_theme_lookup_icon_for_scale (gtk_icon_theme_get_default (),
|
|
||||||
"avatar-default-symbolic",
|
|
||||||
size / 2, scale,
|
|
||||||
GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
|
|
||||||
gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
|
|
||||||
pixbuf = gtk_icon_info_load_symbolic (icon, &color, NULL, NULL, NULL, NULL, &error);
|
|
||||||
if (error != NULL) {
|
|
||||||
g_critical ("Failed to load avatar-default-symbolic: %s", error->message);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale,
|
|
||||||
gtk_widget_get_window (widget));
|
|
||||||
|
|
||||||
width = cairo_image_surface_get_width (surface);
|
|
||||||
height = cairo_image_surface_get_height (surface);
|
|
||||||
gtk_render_icon_surface (context, cr, surface,
|
|
||||||
(((gdouble)size - ((gdouble)width / (gdouble)scale)) / 2.0) + x,
|
|
||||||
(((gdouble)size - ((gdouble)height / (gdouble)scale)) / 2.0) + y);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This private method is prefixed by the class name because it will be a
|
|
||||||
* virtual method in GTK 4.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
hdy_avatar_measure (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
int for_size,
|
|
||||||
int *minimum,
|
|
||||||
int *natural,
|
|
||||||
int *minimum_baseline,
|
|
||||||
int *natural_baseline)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv = hdy_avatar_get_instance_private (HDY_AVATAR (widget));
|
|
||||||
|
|
||||||
if (minimum)
|
|
||||||
*minimum = priv->size;
|
|
||||||
if (natural)
|
|
||||||
*natural = priv->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_get_preferred_width (GtkWidget *widget,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
hdy_avatar_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
|
|
||||||
minimum, natural, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_get_preferred_width_for_height (GtkWidget *widget,
|
|
||||||
gint height,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
hdy_avatar_measure (widget, GTK_ORIENTATION_HORIZONTAL, height,
|
|
||||||
minimum, natural, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_get_preferred_height (GtkWidget *widget,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
hdy_avatar_measure (widget, GTK_ORIENTATION_VERTICAL, -1,
|
|
||||||
minimum, natural, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_get_preferred_height_for_width (GtkWidget *widget,
|
|
||||||
gint width,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
hdy_avatar_measure (widget, GTK_ORIENTATION_VERTICAL, width,
|
|
||||||
minimum, natural, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkSizeRequestMode
|
|
||||||
hdy_avatar_get_request_mode (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_class_init (HdyAvatarClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->finalize = hdy_avatar_finalize;
|
|
||||||
|
|
||||||
object_class->set_property = hdy_avatar_set_property;
|
|
||||||
object_class->get_property = hdy_avatar_get_property;
|
|
||||||
|
|
||||||
widget_class->draw = hdy_avatar_draw;
|
|
||||||
widget_class->get_request_mode = hdy_avatar_get_request_mode;
|
|
||||||
widget_class->get_preferred_width = hdy_avatar_get_preferred_width;
|
|
||||||
widget_class->get_preferred_height = hdy_avatar_get_preferred_height;
|
|
||||||
widget_class->get_preferred_width_for_height = hdy_avatar_get_preferred_width_for_height;
|
|
||||||
widget_class->get_preferred_height_for_width = hdy_avatar_get_preferred_height_for_width;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HdyAvatar:size:
|
|
||||||
*
|
|
||||||
* The avatar size of the avatar.
|
|
||||||
*/
|
|
||||||
props[PROP_SIZE] =
|
|
||||||
g_param_spec_int ("size",
|
|
||||||
"Size",
|
|
||||||
"The size of the avatar",
|
|
||||||
-1, INT_MAX, -1,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
|
||||||
/**
|
|
||||||
* HdyAvatar:text:
|
|
||||||
*
|
|
||||||
* The text used for the initials and for generating the color.
|
|
||||||
* If #HdyAvatar:show-initials is %FALSE it's only used to generate the color.
|
|
||||||
*/
|
|
||||||
props[PROP_NAME] =
|
|
||||||
g_param_spec_string ("text",
|
|
||||||
"Text",
|
|
||||||
"The text used to generate the color and the initials",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HdyAvatar:show_initials:
|
|
||||||
*
|
|
||||||
* Whether to show the initials or the fallback icon on the generated avatar.
|
|
||||||
*/
|
|
||||||
props[PROP_SHOW_INITIALS] =
|
|
||||||
g_param_spec_boolean ("show-initials",
|
|
||||||
"Show initials",
|
|
||||||
"Whether to show the initials",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
|
||||||
|
|
||||||
gtk_widget_class_set_css_name (widget_class, "avatar");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hdy_avatar_init (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
set_class_color (self);
|
|
||||||
g_signal_connect (self, "notify::scale-factor", G_CALLBACK (update_custom_image), NULL);
|
|
||||||
g_signal_connect (self, "size-allocate", G_CALLBACK (update_custom_image), NULL);
|
|
||||||
g_signal_connect (self, "screen-changed", G_CALLBACK (clear_pango_layout), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_new:
|
|
||||||
* @size: The size of the avatar
|
|
||||||
* @text: (allow-none): The text used to generate the color and initials if
|
|
||||||
* @show_initials is %TRUE. The color is selected at random if @text is empty.
|
|
||||||
* @show_initials: whether to show the initials or the fallback icon on
|
|
||||||
* top of the color generated based on @text.
|
|
||||||
*
|
|
||||||
* Creates a new #HdyAvatar.
|
|
||||||
*
|
|
||||||
* Returns: the newly created #HdyAvatar
|
|
||||||
*/
|
|
||||||
GtkWidget *
|
|
||||||
hdy_avatar_new (gint size,
|
|
||||||
const gchar *text,
|
|
||||||
gboolean show_initials)
|
|
||||||
{
|
|
||||||
return g_object_new (HDY_TYPE_AVATAR,
|
|
||||||
"size", size,
|
|
||||||
"text", text,
|
|
||||||
"show-initials", show_initials,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_get_text:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
*
|
|
||||||
* Get the text used to generate the fallback initials and color
|
|
||||||
*
|
|
||||||
* Returns: (nullable) (transfer none): returns the text used to generate
|
|
||||||
* the fallback initials. This is the internal string used by
|
|
||||||
* the #HdyAvatar, and must not be modified.
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
hdy_avatar_get_text (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (HDY_IS_AVATAR (self), NULL);
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
return priv->text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_set_text:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
* @text: (allow-none): the text used to get the initials and color
|
|
||||||
*
|
|
||||||
* Set the text used to generate the fallback initials color
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hdy_avatar_set_text (HdyAvatar *self,
|
|
||||||
const gchar *text)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (HDY_IS_AVATAR (self));
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
if (g_strcmp0 (priv->text, text) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->text, g_free);
|
|
||||||
priv->text = g_strdup (text);
|
|
||||||
|
|
||||||
clear_pango_layout (self);
|
|
||||||
set_class_color (self);
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_NAME]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_get_show_initials:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
*
|
|
||||||
* Returns whether initials are used for the fallback or the icon.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the initials are used for the fallback.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
hdy_avatar_get_show_initials (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (HDY_IS_AVATAR (self), FALSE);
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
return priv->show_initials;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_set_show_initials:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
* @show_initials: whether the initials should be shown on the fallback avatar
|
|
||||||
* or the icon.
|
|
||||||
*
|
|
||||||
* Sets whether the initials should be shown on the fallback avatar or the icon.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hdy_avatar_set_show_initials (HdyAvatar *self,
|
|
||||||
gboolean show_initials)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (HDY_IS_AVATAR (self));
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
if (priv->show_initials == show_initials)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv->show_initials = show_initials;
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SHOW_INITIALS]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_set_image_load_func:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
* @load_image: (closure user_data) (allow-none): callback to set a custom image
|
|
||||||
* @user_data: (allow-none): user data passed to @load_image
|
|
||||||
* @destroy: (allow-none): destroy notifier for @user_data
|
|
||||||
*
|
|
||||||
* A callback which is called when the custom image need to be reloaded for some
|
|
||||||
* reason (e.g. scale-factor changes).
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hdy_avatar_set_image_load_func (HdyAvatar *self,
|
|
||||||
HdyAvatarImageLoadFunc load_image,
|
|
||||||
gpointer user_data,
|
|
||||||
GDestroyNotify destroy)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (HDY_IS_AVATAR (self));
|
|
||||||
g_return_if_fail (user_data != NULL || (user_data == NULL && destroy == NULL));
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
if (priv->load_image_func_target_destroy_notify != NULL)
|
|
||||||
priv->load_image_func_target_destroy_notify (priv->load_image_func_target);
|
|
||||||
|
|
||||||
priv->load_image_func = load_image;
|
|
||||||
priv->load_image_func_target = user_data;
|
|
||||||
priv->load_image_func_target_destroy_notify = destroy;
|
|
||||||
|
|
||||||
update_custom_image (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_get_size:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
*
|
|
||||||
* Returns the size of the avatar.
|
|
||||||
*
|
|
||||||
* Returns: the size of the avatar.
|
|
||||||
*/
|
|
||||||
gint
|
|
||||||
hdy_avatar_get_size (HdyAvatar *self)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (HDY_IS_AVATAR (self), 0);
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
return priv->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hdy_avatar_set_size:
|
|
||||||
* @self: a #HdyAvatar
|
|
||||||
* @size: The size to be used for the avatar
|
|
||||||
*
|
|
||||||
* Sets the size of the avatar.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hdy_avatar_set_size (HdyAvatar *self,
|
|
||||||
gint size)
|
|
||||||
{
|
|
||||||
HdyAvatarPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (HDY_IS_AVATAR (self));
|
|
||||||
g_return_if_fail (size >= -1);
|
|
||||||
|
|
||||||
priv = hdy_avatar_get_instance_private (self);
|
|
||||||
|
|
||||||
if (priv->size == size)
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv->size = size;
|
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIZE]);
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2020 Purism SPC
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define HDY_TYPE_AVATAR (hdy_avatar_get_type())
|
|
||||||
|
|
||||||
G_DECLARE_DERIVABLE_TYPE (HdyAvatar, hdy_avatar, HDY, AVATAR, GtkDrawingArea)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HdyAvatarClass:
|
|
||||||
* @parent_class: The parent class
|
|
||||||
*/
|
|
||||||
struct _HdyAvatarClass
|
|
||||||
{
|
|
||||||
GtkDrawingAreaClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HdyAvatarImageLoadFunc:
|
|
||||||
* @size: the required size of the avatar
|
|
||||||
* @user_data: (closure): user data
|
|
||||||
*
|
|
||||||
* The returned #GdkPixbuf is expected to be square with width and height set
|
|
||||||
* to @size. The image is cropped to a circle without any scaling or transformation.
|
|
||||||
*
|
|
||||||
* Returns: (nullable) (transfer full): the #GdkPixbuf to use as a custom avatar
|
|
||||||
* or %NULL to fallback to the generated avatar.
|
|
||||||
*/
|
|
||||||
typedef GdkPixbuf *(*HdyAvatarImageLoadFunc) (gint size,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *hdy_avatar_new (gint size,
|
|
||||||
const gchar *text,
|
|
||||||
gboolean show_initials);
|
|
||||||
const gchar *hdy_avatar_get_text (HdyAvatar *self);
|
|
||||||
void hdy_avatar_set_text (HdyAvatar *self,
|
|
||||||
const gchar *text);
|
|
||||||
gboolean hdy_avatar_get_show_initials (HdyAvatar *self);
|
|
||||||
void hdy_avatar_set_show_initials (HdyAvatar *self,
|
|
||||||
gboolean show_initials);
|
|
||||||
void hdy_avatar_set_image_load_func (HdyAvatar *self,
|
|
||||||
HdyAvatarImageLoadFunc load_image,
|
|
||||||
gpointer user_data,
|
|
||||||
GDestroyNotify destroy);
|
|
||||||
gint hdy_avatar_get_size (HdyAvatar *self);
|
|
||||||
void hdy_avatar_set_size (HdyAvatar *self,
|
|
||||||
gint size);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
|
@ -30,7 +30,7 @@ calls_includes = [ top_include, src_include ]
|
||||||
|
|
||||||
calls_deps = [ dependency('gobject-2.0', version: '>= 2.58'),
|
calls_deps = [ dependency('gobject-2.0', version: '>= 2.58'),
|
||||||
dependency('gtk+-3.0'),
|
dependency('gtk+-3.0'),
|
||||||
dependency('libhandy-0.0', version: '>= 0.0.12'),
|
dependency('libhandy-1', version: '>= 1.0.0'),
|
||||||
dependency('libfeedback-0.0'),
|
dependency('libfeedback-0.0'),
|
||||||
dependency('libpeas-1.0'),
|
dependency('libpeas-1.0'),
|
||||||
dependency('gom-1.0'),
|
dependency('gom-1.0'),
|
||||||
|
@ -89,7 +89,6 @@ calls_sources = files(['calls-message-source.c', 'calls-message-source.h',
|
||||||
'calls-in-app-notification.c', 'calls-in-app-notification.h',
|
'calls-in-app-notification.c', 'calls-in-app-notification.h',
|
||||||
'calls-manager.c', 'calls-manager.h',
|
'calls-manager.c', 'calls-manager.h',
|
||||||
'calls-notifier.c', 'calls-notifier.h',
|
'calls-notifier.c', 'calls-notifier.h',
|
||||||
'contrib/hdy-avatar.c', 'contrib/hdy-avatar.h',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
calls_config_data = config_data
|
calls_config_data = config_data
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<!-- Generated with glade 3.22.0 -->
|
<!-- Generated with glade 3.22.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<requires lib="libhandy" version="0.0"/>
|
|
||||||
<template class="CallsCallWindow" parent="GtkApplicationWindow">
|
<template class="CallsCallWindow" parent="GtkApplicationWindow">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<!-- <property name="decorated">False</property> -->
|
<!-- <property name="decorated">False</property> -->
|
||||||
|
|
|
@ -43,11 +43,9 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="hscrollbar-policy">never</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="HdyColumn">
|
<object class="HdyClamp">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="maximum-width">600</property>
|
|
||||||
<property name="linear-growth-width">450</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="history">
|
<object class="GtkListBox" id="history">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<requires lib="libhandy" version="0.0"/>
|
|
||||||
<template class="CallsHistoryHeaderBar" parent="GtkHeaderBar">
|
<template class="CallsHistoryHeaderBar" parent="GtkHeaderBar">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="show-close-button">True</property>
|
<property name="show-close-button">True</property>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- Generated with glade 3.22.0 -->
|
<!-- Generated with glade 3.22.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<requires lib="libhandy" version="0.0"/>
|
<requires lib="libhandy" version="1.0"/>
|
||||||
<template class="CallsMainWindow" parent="GtkApplicationWindow">
|
<template class="CallsMainWindow" parent="GtkApplicationWindow">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="title" translatable="yes">Calls</property>
|
<property name="title" translatable="yes">Calls</property>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- Generated with glade 3.22.0 -->
|
<!-- Generated with glade 3.22.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<requires lib="libhandy" version="0.0"/>
|
<requires lib="libhandy" version="1.0"/>
|
||||||
<object class="GtkListStore" id="origin_store">
|
<object class="GtkListStore" id="origin_store">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name name -->
|
<!-- column-name name -->
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<requires lib="libhandy" version="0.0"/>
|
|
||||||
<template class="CallsNewCallHeaderBar" parent="GtkHeaderBar">
|
<template class="CallsNewCallHeaderBar" parent="GtkHeaderBar">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="show-close-button">True</property>
|
<property name="show-close-button">True</property>
|
||||||
|
|
Loading…
Reference in a new issue