Uncrustify sources
Ran `find src plugins -iname '*.[c|h]' -print0 | xargs -0 uncrustify --no-backup` with some minimal manual intervention.
This commit is contained in:
@@ -49,23 +49,23 @@ typedef enum {
|
||||
|
||||
|
||||
struct _CallsAccountOverview {
|
||||
HdyWindow parent;
|
||||
HdyWindow parent;
|
||||
|
||||
/* UI widgets */
|
||||
GtkStack *stack;
|
||||
GtkWidget *intro;
|
||||
GtkWidget *overview;
|
||||
GtkWidget *add_btn;
|
||||
GtkWidget *add_row;
|
||||
GtkStack *stack;
|
||||
GtkWidget *intro;
|
||||
GtkWidget *overview;
|
||||
GtkWidget *add_btn;
|
||||
GtkWidget *add_row;
|
||||
|
||||
/* The window where we add the account providers widget */
|
||||
GtkWindow *account_window;
|
||||
GtkWidget *current_account_widget;
|
||||
GtkWindow *account_window;
|
||||
GtkWidget *current_account_widget;
|
||||
|
||||
/* misc */
|
||||
CallsAccountOverviewState state;
|
||||
GList *providers;
|
||||
CallsInAppNotification *in_app_notification;
|
||||
CallsAccountOverviewState state;
|
||||
GList *providers;
|
||||
CallsInAppNotification *in_app_notification;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsAccountOverview, calls_account_overview, HDY_TYPE_WINDOW)
|
||||
|
||||
@@ -35,14 +35,13 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_INTERFACE (CallsAccountProvider, calls_account_provider, CALLS, ACCOUNT_PROVIDER, CallsProvider)
|
||||
|
||||
struct _CallsAccountProviderInterface
|
||||
{
|
||||
struct _CallsAccountProviderInterface {
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
GtkWidget *(*get_account_widget) (CallsAccountProvider *self);
|
||||
void (*add_new_account) (CallsAccountProvider *self);
|
||||
void (*edit_account) (CallsAccountProvider *self,
|
||||
CallsAccount *account);
|
||||
GtkWidget *(*get_account_widget) (CallsAccountProvider *self);
|
||||
void (*add_new_account) (CallsAccountProvider *self);
|
||||
void (*edit_account) (CallsAccountProvider *self,
|
||||
CallsAccount *account);
|
||||
};
|
||||
|
||||
GtkWidget *calls_account_provider_get_account_widget (CallsAccountProvider *self);
|
||||
|
||||
@@ -140,10 +140,10 @@ calls_account_row_set_property (GObject *object,
|
||||
|
||||
|
||||
static void
|
||||
calls_account_row_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
calls_account_row_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsAccountRow *self = CALLS_ACCOUNT_ROW (object);
|
||||
|
||||
@@ -213,8 +213,8 @@ calls_account_row_class_init (CallsAccountRowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsAccountRow, online_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsAccountRow, edit_btn);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_edit_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_online_switched);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_edit_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_online_switched);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ G_DECLARE_FINAL_TYPE (CallsAccountRow, calls_account_row, CALLS, ACCOUNT_ROW, Hd
|
||||
|
||||
CallsAccountRow *calls_account_row_new (CallsAccountProvider *provider,
|
||||
CallsAccount *account);
|
||||
gboolean calls_account_row_get_online (CallsAccountRow *self);
|
||||
void calls_account_row_set_online (CallsAccountRow *self,
|
||||
gboolean online);
|
||||
CallsAccount *calls_account_row_get_account (CallsAccountRow *self);
|
||||
gboolean calls_account_row_get_online (CallsAccountRow *self);
|
||||
void calls_account_row_set_online (CallsAccountRow *self,
|
||||
gboolean online);
|
||||
CallsAccount *calls_account_row_get_account (CallsAccountRow *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -44,7 +44,7 @@ enum {
|
||||
SIGNAL_STATE_CHANGED,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
};
|
||||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
static guint signals[SIGNAL_LAST_SIGNAL];
|
||||
|
||||
|
||||
static gboolean
|
||||
@@ -92,7 +92,8 @@ calls_account_state_reason_is_error (CallsAccountStateReason reason)
|
||||
static void
|
||||
calls_account_default_init (CallsAccountInterface *iface)
|
||||
{
|
||||
g_object_interface_install_property (iface,
|
||||
g_object_interface_install_property (
|
||||
iface,
|
||||
g_param_spec_enum ("account-state",
|
||||
"Account state",
|
||||
"The state of the account",
|
||||
@@ -102,7 +103,8 @@ calls_account_default_init (CallsAccountInterface *iface)
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
g_object_interface_install_property (iface,
|
||||
g_object_interface_install_property (
|
||||
iface,
|
||||
g_param_spec_string ("address",
|
||||
"Address",
|
||||
"The address of this account",
|
||||
@@ -312,8 +314,8 @@ calls_account_emit_message_for_state_change (CallsAccount *account,
|
||||
|
||||
if (reason_is_error || calls_log_get_verbosity () >= 3)
|
||||
message = g_strdup_printf ("%s: %s",
|
||||
calls_account_state_to_string (new_state),
|
||||
calls_account_state_reason_to_string (reason));
|
||||
calls_account_state_to_string (new_state),
|
||||
calls_account_state_reason_to_string (reason));
|
||||
else
|
||||
message = g_strdup (calls_account_state_to_string (new_state));
|
||||
|
||||
|
||||
@@ -91,24 +91,23 @@ typedef enum {
|
||||
} CallsAccountStateReason;
|
||||
|
||||
|
||||
struct _CallsAccountInterface
|
||||
{
|
||||
struct _CallsAccountInterface {
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
void (*go_online) (CallsAccount *self,
|
||||
gboolean online);
|
||||
const char *(*get_address) (CallsAccount *self);
|
||||
void (*go_online) (CallsAccount *self,
|
||||
gboolean online);
|
||||
const char *(*get_address) (CallsAccount *self);
|
||||
};
|
||||
|
||||
|
||||
void calls_account_go_online (CallsAccount *self,
|
||||
gboolean online);
|
||||
const char *calls_account_get_address (CallsAccount *self);
|
||||
CallsAccountState calls_account_get_state (CallsAccount *self);
|
||||
const char *calls_account_state_to_string (CallsAccountState state);
|
||||
const char *calls_account_state_reason_to_string (CallsAccountStateReason reason);
|
||||
void calls_account_emit_message_for_state_change (CallsAccount *account,
|
||||
CallsAccountState new_state,
|
||||
CallsAccountStateReason reason);
|
||||
void calls_account_go_online (CallsAccount *self,
|
||||
gboolean online);
|
||||
const char *calls_account_get_address (CallsAccount *self);
|
||||
CallsAccountState calls_account_get_state (CallsAccount *self);
|
||||
const char *calls_account_state_to_string (CallsAccountState state);
|
||||
const char *calls_account_state_reason_to_string (CallsAccountStateReason reason);
|
||||
void calls_account_emit_message_for_state_change (CallsAccount *account,
|
||||
CallsAccountState new_state,
|
||||
CallsAccountStateReason reason);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -57,9 +57,8 @@
|
||||
|
||||
#define DEFAULT_PROVIDER_PLUGIN "mm"
|
||||
|
||||
struct _CallsApplication
|
||||
{
|
||||
GtkApplication parent_instance;
|
||||
struct _CallsApplication {
|
||||
GtkApplication parent_instance;
|
||||
|
||||
gboolean daemon;
|
||||
CallsRinger *ringer;
|
||||
@@ -79,10 +78,10 @@ static gboolean start_proper (CallsApplication *self);
|
||||
|
||||
|
||||
static gboolean
|
||||
cmd_verbose_cb (const char *option_name,
|
||||
const char *value,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
cmd_verbose_cb (const char *option_name,
|
||||
const char *value,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
calls_log_increase_verbosity ();
|
||||
|
||||
@@ -165,6 +164,7 @@ set_default_providers_action (GSimpleAction *action,
|
||||
{
|
||||
CallsManager *manager = calls_manager_get_default ();
|
||||
CallsSettings *settings = calls_manager_get_settings (manager);
|
||||
|
||||
g_auto (GStrv) plugins = NULL;
|
||||
/**
|
||||
* Only add default providers when there are none added yet,
|
||||
@@ -240,7 +240,7 @@ extract_dial_string (const char *number)
|
||||
}
|
||||
|
||||
dial_string = g_regex_replace_literal
|
||||
(replace_visual, number, -1, 0, "", 0, &error);
|
||||
(replace_visual, number, -1, 0, "", 0, &error);
|
||||
|
||||
if (!dial_string) {
|
||||
g_warning ("Error replacing visual separators"
|
||||
@@ -260,25 +260,25 @@ call_number (CallsApplication *self,
|
||||
g_autofree char *dial_string = NULL;
|
||||
gboolean number_ok;
|
||||
|
||||
number_ok = check_dial_number (number);
|
||||
if (!number_ok) {
|
||||
g_warning ("Dial number `%s' is not a valid dial string",
|
||||
number);
|
||||
return;
|
||||
}
|
||||
number_ok = check_dial_number (number);
|
||||
if (!number_ok) {
|
||||
g_warning ("Dial number `%s' is not a valid dial string",
|
||||
number);
|
||||
return;
|
||||
}
|
||||
|
||||
dial_string = extract_dial_string (number);
|
||||
if (!dial_string) {
|
||||
return;
|
||||
}
|
||||
dial_string = extract_dial_string (number);
|
||||
if (!dial_string) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("Dialing dial string `%s' extracted from number `%s'",
|
||||
dial_string, number);
|
||||
g_debug ("Dialing dial string `%s' extracted from number `%s'",
|
||||
dial_string, number);
|
||||
|
||||
start_proper (self);
|
||||
start_proper (self);
|
||||
|
||||
calls_main_window_dial (self->main_window,
|
||||
dial_string);
|
||||
calls_main_window_dial (self->main_window,
|
||||
dial_string);
|
||||
|
||||
}
|
||||
|
||||
@@ -368,6 +368,7 @@ show_accounts (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsApplication *app = CALLS_APPLICATION (g_application_get_default ());
|
||||
|
||||
calls_main_window_show_accounts_overview (app->main_window);
|
||||
}
|
||||
|
||||
@@ -377,7 +378,7 @@ manager_state_changed_cb (GApplication *application)
|
||||
GAction* dial_action = g_action_map_lookup_action (G_ACTION_MAP (application), "dial");
|
||||
CallsManagerFlags state_flags = calls_manager_get_state_flags (calls_manager_get_default ());
|
||||
gboolean enabled = (state_flags & CALLS_MANAGER_FLAGS_HAS_CELLULAR_MODEM) ||
|
||||
(state_flags & CALLS_MANAGER_FLAGS_HAS_VOIP_ACCOUNT);
|
||||
(state_flags & CALLS_MANAGER_FLAGS_HAS_VOIP_ACCOUNT);
|
||||
|
||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (dial_action), enabled);
|
||||
}
|
||||
@@ -413,7 +414,7 @@ startup (GApplication *application)
|
||||
{
|
||||
g_autoptr (GtkCssProvider) provider = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
#if HDY_CHECK_VERSION(1, 5, 0)
|
||||
#if HDY_CHECK_VERSION (1, 5, 0)
|
||||
HdyStyleManager *style_manager;
|
||||
#endif
|
||||
|
||||
@@ -421,7 +422,7 @@ startup (GApplication *application)
|
||||
|
||||
hdy_init ();
|
||||
|
||||
#if HDY_CHECK_VERSION(1, 5, 0)
|
||||
#if HDY_CHECK_VERSION (1, 5, 0)
|
||||
style_manager = hdy_style_manager_get_default ();
|
||||
|
||||
hdy_style_manager_set_color_scheme (style_manager, HDY_COLOR_SCHEME_PREFER_LIGHT);
|
||||
@@ -462,8 +463,9 @@ calls_application_command_line (GApplication *application,
|
||||
CallsApplication *self = CALLS_APPLICATION (application);
|
||||
GVariantDict *options;
|
||||
const char *arg;
|
||||
|
||||
g_autoptr (GVariant) providers = NULL;
|
||||
g_auto(GStrv) arguments = NULL;
|
||||
g_auto (GStrv) arguments = NULL;
|
||||
gint argc;
|
||||
|
||||
options = g_application_command_line_get_options_dict (command_line);
|
||||
@@ -514,8 +516,8 @@ app_shutdown (GApplication *application)
|
||||
|
||||
|
||||
static void
|
||||
notify_window_visible_cb (GtkWidget *window,
|
||||
GParamSpec *pspec,
|
||||
notify_window_visible_cb (GtkWidget *window,
|
||||
GParamSpec *pspec,
|
||||
CallsApplication *application)
|
||||
{
|
||||
CallsManager *manager = calls_manager_get_default ();
|
||||
@@ -530,7 +532,7 @@ notify_window_visible_cb (GtkWidget *window,
|
||||
|
||||
|
||||
static gboolean
|
||||
start_proper (CallsApplication *self)
|
||||
start_proper (CallsApplication *self)
|
||||
{
|
||||
GtkApplication *gtk_app;
|
||||
|
||||
@@ -550,8 +552,8 @@ start_proper (CallsApplication *self)
|
||||
g_assert (CALLS_IS_NOTIFIER (self->notifier));
|
||||
|
||||
self->main_window = calls_main_window_new
|
||||
(gtk_app,
|
||||
G_LIST_MODEL (self->record_store));
|
||||
(gtk_app,
|
||||
G_LIST_MODEL (self->record_store));
|
||||
g_assert (self->main_window != NULL);
|
||||
|
||||
self->call_window = calls_call_window_new (gtk_app);
|
||||
@@ -600,10 +602,10 @@ activate (GApplication *application)
|
||||
}
|
||||
|
||||
static void
|
||||
app_open (GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const char *hint)
|
||||
app_open (GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const char *hint)
|
||||
{
|
||||
CallsApplication *self = CALLS_APPLICATION (application);
|
||||
|
||||
@@ -642,7 +644,7 @@ app_open (GApplication *application,
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
CallsApplication *self = (CallsApplication *)object;
|
||||
CallsApplication *self = (CallsApplication *) object;
|
||||
|
||||
g_clear_object (&self->call_window);
|
||||
g_clear_object (&self->main_window);
|
||||
@@ -669,8 +671,8 @@ calls_application_class_init (CallsApplicationClass *klass)
|
||||
application_class->shutdown = app_shutdown;
|
||||
application_class->activate = activate;
|
||||
application_class->open = app_open;
|
||||
application_class->dbus_register = calls_application_dbus_register;
|
||||
application_class->dbus_unregister = calls_application_dbus_unregister;
|
||||
application_class->dbus_register = calls_application_dbus_register;
|
||||
application_class->dbus_unregister = calls_application_dbus_unregister;
|
||||
|
||||
g_type_ensure (CALLS_TYPE_HISTORY_BOX);
|
||||
g_type_ensure (CALLS_TYPE_NEW_CALL_BOX);
|
||||
|
||||
@@ -31,16 +31,15 @@
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
|
||||
struct _CallsBestMatch
|
||||
{
|
||||
GObject parent_instance;
|
||||
struct _CallsBestMatch {
|
||||
GObject parent_instance;
|
||||
|
||||
FolksSearchView *view;
|
||||
FolksIndividual *matched_individual;
|
||||
char *phone_number;
|
||||
char *country_code;
|
||||
char *name_sip;
|
||||
gboolean had_country_code_last_time;
|
||||
FolksSearchView *view;
|
||||
FolksIndividual *matched_individual;
|
||||
char *phone_number;
|
||||
char *country_code;
|
||||
char *name_sip;
|
||||
gboolean had_country_code_last_time;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsBestMatch, calls_best_match, G_TYPE_OBJECT);
|
||||
@@ -112,7 +111,7 @@ update_best_match (CallsBestMatch *self)
|
||||
g_return_if_fail (GEE_IS_COLLECTION (individuals));
|
||||
|
||||
if (!gee_collection_get_is_empty (GEE_COLLECTION (individuals)))
|
||||
matched_individual = gee_sorted_set_first (individuals);
|
||||
matched_individual = gee_sorted_set_first (individuals);
|
||||
|
||||
if (matched_individual == self->matched_individual)
|
||||
return;
|
||||
@@ -174,10 +173,10 @@ set_property (GObject *object,
|
||||
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsBestMatch *self = CALLS_BEST_MATCH (object);
|
||||
|
||||
@@ -432,8 +431,8 @@ calls_best_match_get_primary_info (CallsBestMatch *self)
|
||||
if (self->phone_number)
|
||||
return self->phone_number;
|
||||
|
||||
anon:
|
||||
return _("Anonymous caller");
|
||||
anon:
|
||||
return _("Anonymous caller");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,6 +460,6 @@ calls_best_match_get_secondary_info (CallsBestMatch *self)
|
||||
* https://gitlab.gnome.org/GNOME/calls/-/issues/358
|
||||
*/
|
||||
|
||||
anon:
|
||||
anon:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsBestMatch, calls_best_match, CALLS, BEST_MATCH, GObject);
|
||||
|
||||
CallsBestMatch *calls_best_match_new (const char *phone_number);
|
||||
gboolean calls_best_match_has_individual (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_phone_number (CallsBestMatch *self);
|
||||
void calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||
const char *phone_number);
|
||||
const char *calls_best_match_get_name (CallsBestMatch *self);
|
||||
GLoadableIcon *calls_best_match_get_avatar (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_primary_info (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_secondary_info (CallsBestMatch *self);
|
||||
CallsBestMatch *calls_best_match_new (const char *phone_number);
|
||||
gboolean calls_best_match_has_individual (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_phone_number (CallsBestMatch *self);
|
||||
void calls_best_match_set_phone_number (CallsBestMatch *self,
|
||||
const char *phone_number);
|
||||
const char *calls_best_match_get_name (CallsBestMatch *self);
|
||||
GLoadableIcon *calls_best_match_get_avatar (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_primary_info (CallsBestMatch *self);
|
||||
const char *calls_best_match_get_secondary_info (CallsBestMatch *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -37,29 +37,28 @@
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
struct _CallsCallRecordRow
|
||||
{
|
||||
GtkListBoxRow parent_instance;
|
||||
struct _CallsCallRecordRow {
|
||||
GtkListBoxRow parent_instance;
|
||||
|
||||
GtkWidget *avatar;
|
||||
GtkImage *type;
|
||||
GtkLabel *target;
|
||||
GtkLabel *time;
|
||||
GtkButton *button;
|
||||
GtkPopover *popover;
|
||||
GtkGesture *gesture;
|
||||
GtkEventBox *event_box;
|
||||
GtkWidget *avatar;
|
||||
GtkImage *type;
|
||||
GtkLabel *target;
|
||||
GtkLabel *time;
|
||||
GtkButton *button;
|
||||
GtkPopover *popover;
|
||||
GtkGesture *gesture;
|
||||
GtkEventBox *event_box;
|
||||
|
||||
GMenu *context_menu;
|
||||
GMenu *context_menu;
|
||||
|
||||
GActionMap *action_map;
|
||||
GActionMap *action_map;
|
||||
|
||||
CallsCallRecord *record;
|
||||
gulong answered_notify_handler_id;
|
||||
gulong end_notify_handler_id;
|
||||
guint date_change_timeout;
|
||||
gulong answered_notify_handler_id;
|
||||
gulong end_notify_handler_id;
|
||||
guint date_change_timeout;
|
||||
|
||||
CallsBestMatch *contact;
|
||||
CallsBestMatch *contact;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsCallRecordRow, calls_call_record_row, GTK_TYPE_LIST_BOX_ROW)
|
||||
@@ -75,10 +74,11 @@ static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
||||
static void
|
||||
nice_time (GDateTime *t,
|
||||
gchar **nice,
|
||||
gboolean *final)
|
||||
gchar **nice,
|
||||
gboolean *final)
|
||||
{
|
||||
GDateTime *now = g_date_time_new_now_local ();
|
||||
|
||||
g_autoptr (GTimeZone) local_tz = g_time_zone_new_local ();
|
||||
g_autoptr (GDateTime) t_local_tz = g_date_time_to_timezone (t, local_tz);
|
||||
const gboolean today =
|
||||
@@ -119,6 +119,7 @@ update_time_text (CallsCallRecordRow *self,
|
||||
gboolean *final)
|
||||
{
|
||||
gchar *nice;
|
||||
|
||||
nice_time (end, &nice, final);
|
||||
gtk_label_set_text (self->time, nice);
|
||||
g_free (nice);
|
||||
@@ -155,18 +156,17 @@ setup_date_change_timeout (CallsCallRecordRow *self)
|
||||
g_date_time_unref (gnextday);
|
||||
|
||||
// Convert to a timeval
|
||||
tomorrow.tv_sec = g_date_time_to_unix (gtomorrow);
|
||||
tomorrow.tv_sec = g_date_time_to_unix (gtomorrow);
|
||||
tomorrow.tv_usec = 0;
|
||||
g_date_time_unref (gtomorrow);
|
||||
|
||||
// Get the precise time now
|
||||
err = gettimeofday (&now, NULL);
|
||||
if (err == -1)
|
||||
{
|
||||
g_warning ("Error getting time to set date change timeout: %s",
|
||||
g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
if (err == -1) {
|
||||
g_warning ("Error getting time to set date change timeout: %s",
|
||||
g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
// Find how long from now until the start of the next day
|
||||
timersub (&tomorrow, &now, &delta);
|
||||
@@ -180,7 +180,7 @@ setup_date_change_timeout (CallsCallRecordRow *self)
|
||||
// Add the timeout
|
||||
self->date_change_timeout =
|
||||
g_timeout_add (interval,
|
||||
(GSourceFunc)date_change_cb,
|
||||
(GSourceFunc) date_change_cb,
|
||||
self);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ on_notify_can_add_contacts (CallsCallRecordRow *self)
|
||||
if (!calls_contacts_provider_get_can_add_contacts (contacts_provider))
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_data(contacts_provider, self);
|
||||
g_signal_handlers_disconnect_by_data (contacts_provider, self);
|
||||
|
||||
/* The record has a NULL id */
|
||||
if (!self->contact)
|
||||
@@ -379,7 +379,7 @@ context_menu (GtkWidget *widget,
|
||||
gtk_popover_bind_model (self->popover,
|
||||
G_MENU_MODEL (self->context_menu),
|
||||
"row-history");
|
||||
}
|
||||
}
|
||||
|
||||
gtk_popover_popup (self->popover);
|
||||
}
|
||||
@@ -483,10 +483,10 @@ constructed (GObject *object)
|
||||
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsCallRecordRow *self = CALLS_CALL_RECORD_ROW (object);
|
||||
|
||||
@@ -562,6 +562,7 @@ delete_call_activated (GSimpleAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *self = GTK_WIDGET (data);
|
||||
|
||||
g_signal_emit_by_name (CALLS_CALL_RECORD_ROW (self)->record, "call-delete");
|
||||
}
|
||||
|
||||
@@ -603,9 +604,9 @@ new_contact_activated (GSimpleAction *action,
|
||||
|
||||
static GActionEntry entries[] =
|
||||
{
|
||||
{ "delete-call", delete_call_activated, NULL, NULL, NULL},
|
||||
{ "copy-number", copy_number_activated, NULL, NULL, NULL},
|
||||
{ "new-contact", new_contact_activated, NULL, NULL, NULL},
|
||||
{ "delete-call", delete_call_activated, NULL, NULL, NULL},
|
||||
{ "copy-number", copy_number_activated, NULL, NULL, NULL},
|
||||
{ "new-contact", new_contact_activated, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
|
||||
@@ -613,6 +614,7 @@ static void
|
||||
calls_call_record_row_init (CallsCallRecordRow *self)
|
||||
{
|
||||
GAction *act;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->action_map = G_ACTION_MAP (g_simple_action_group_new ());
|
||||
|
||||
@@ -37,8 +37,8 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (CallsCallRecordRow, calls_call_record_row,
|
||||
CALLS, CALL_RECORD_ROW, GtkListBoxRow)
|
||||
|
||||
CallsCallRecordRow *calls_call_record_row_new (CallsCallRecord *record);
|
||||
CallsCallRecord * calls_call_record_row_get_record (CallsCallRecordRow *self);
|
||||
CallsCallRecordRow *calls_call_record_row_new (CallsCallRecord *record);
|
||||
CallsCallRecord *calls_call_record_row_get_record (CallsCallRecordRow *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -27,20 +27,19 @@
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
|
||||
struct _CallsCallRecord
|
||||
{
|
||||
struct _CallsCallRecord {
|
||||
GomResource parent_instance;
|
||||
guint id;
|
||||
char *target;
|
||||
gboolean inbound;
|
||||
GDateTime *start;
|
||||
GDateTime *answered;
|
||||
GDateTime *end;
|
||||
char *protocol;
|
||||
gboolean complete;
|
||||
guint id;
|
||||
char *target;
|
||||
gboolean inbound;
|
||||
GDateTime *start;
|
||||
GDateTime *answered;
|
||||
GDateTime *end;
|
||||
char *protocol;
|
||||
gboolean complete;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(CallsCallRecord, calls_call_record, GOM_TYPE_RESOURCE)
|
||||
G_DEFINE_TYPE (CallsCallRecord, calls_call_record, GOM_TYPE_RESOURCE)
|
||||
|
||||
|
||||
enum {
|
||||
@@ -57,17 +56,17 @@ enum {
|
||||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
||||
enum {
|
||||
SIGNAL_CALL_DELETE,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
SIGNAL_CALL_DELETE,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
};
|
||||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
static guint signals[SIGNAL_LAST_SIGNAL];
|
||||
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsCallRecord *self = CALLS_CALL_RECORD (object);
|
||||
|
||||
@@ -109,17 +108,15 @@ get_property (GObject *object,
|
||||
|
||||
|
||||
static void
|
||||
set_date_time (GDateTime **stamp_ptr,
|
||||
const GValue *value)
|
||||
set_date_time (GDateTime **stamp_ptr,
|
||||
const GValue *value)
|
||||
{
|
||||
gpointer new_stamp = g_value_get_boxed (value);
|
||||
|
||||
g_clear_pointer (stamp_ptr, g_date_time_unref);
|
||||
|
||||
if (new_stamp)
|
||||
{
|
||||
*stamp_ptr = g_date_time_ref (new_stamp);
|
||||
}
|
||||
*stamp_ptr = g_date_time_ref (new_stamp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,15 +32,14 @@
|
||||
#include <glib.h>
|
||||
|
||||
|
||||
struct _CallsCallSelectorItem
|
||||
{
|
||||
GtkEventBox parent_instance;
|
||||
struct _CallsCallSelectorItem {
|
||||
GtkEventBox parent_instance;
|
||||
|
||||
CuiCallDisplay *display;
|
||||
|
||||
GtkBox *main_box;
|
||||
GtkLabel *name;
|
||||
GtkLabel *status;
|
||||
GtkBox *main_box;
|
||||
GtkLabel *name;
|
||||
GtkLabel *status;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsCallSelectorItem, calls_call_selector_item, GTK_TYPE_EVENT_BOX);
|
||||
@@ -184,5 +183,3 @@ calls_call_selector_item_get_display (CallsCallSelectorItem *item)
|
||||
g_return_val_if_fail (CALLS_IS_CALL_SELECTOR_ITEM (item), NULL);
|
||||
return item->display;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (CallsCallSelectorItem, calls_call_selector_item,
|
||||
CALLS, CALL_SELECTOR_ITEM, GtkEventBox);
|
||||
|
||||
CallsCallSelectorItem *calls_call_selector_item_new (CuiCallDisplay *display);
|
||||
CallsCallSelectorItem *calls_call_selector_item_new (CuiCallDisplay *display);
|
||||
CuiCallDisplay *calls_call_selector_item_get_display (CallsCallSelectorItem *item);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -40,21 +40,20 @@
|
||||
#include <handy.h>
|
||||
|
||||
|
||||
struct _CallsCallWindow
|
||||
{
|
||||
GtkApplicationWindow parent_instance;
|
||||
struct _CallsCallWindow {
|
||||
GtkApplicationWindow parent_instance;
|
||||
|
||||
GListStore *calls;
|
||||
GListStore *calls;
|
||||
|
||||
CallsInAppNotification *in_app_notification;
|
||||
|
||||
GtkStack *main_stack;
|
||||
GtkStack *header_bar_stack;
|
||||
GtkButton *show_calls;
|
||||
GtkStack *call_stack;
|
||||
GtkFlowBox *call_selector;
|
||||
GtkStack *main_stack;
|
||||
GtkStack *header_bar_stack;
|
||||
GtkButton *show_calls;
|
||||
GtkStack *call_stack;
|
||||
GtkFlowBox *call_selector;
|
||||
|
||||
guint inhibit_cookie;
|
||||
guint inhibit_cookie;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsCallWindow, calls_call_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
@@ -280,6 +279,7 @@ calls_call_window_init (CallsCallWindow *self)
|
||||
{
|
||||
g_autoptr (GList) calls = NULL;
|
||||
GList *c;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->calls = g_list_store_new (CALLS_TYPE_CALL_SELECTOR_ITEM);
|
||||
@@ -350,4 +350,3 @@ calls_call_window_new (GtkApplication *application)
|
||||
"application", application,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ static GParamSpec *properties[N_PROPS];
|
||||
static guint signals[N_SIGNALS];
|
||||
|
||||
typedef struct {
|
||||
char *id;
|
||||
char *name;
|
||||
char *id;
|
||||
char *name;
|
||||
CallsCallState state;
|
||||
gboolean inbound;
|
||||
CallsCallType call_type;
|
||||
gboolean inbound;
|
||||
CallsCallType call_type;
|
||||
} CallsCallPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CallsCall, calls_call, G_TYPE_OBJECT)
|
||||
|
||||
@@ -49,38 +49,36 @@ typedef enum {
|
||||
CALLS_CALL_TYPE_SIP_VOICE,
|
||||
} CallsCallType;
|
||||
|
||||
struct _CallsCallClass
|
||||
{
|
||||
struct _CallsCallClass {
|
||||
GObjectClass parent_iface;
|
||||
|
||||
const char *(*get_protocol) (CallsCall *self);
|
||||
void (*answer) (CallsCall *self);
|
||||
void (*hang_up) (CallsCall *self);
|
||||
void (*send_dtmf_tone) (CallsCall *self,
|
||||
char key);
|
||||
const char *(*get_protocol) (CallsCall *self);
|
||||
void (*answer) (CallsCall *self);
|
||||
void (*hang_up) (CallsCall *self);
|
||||
void (*send_dtmf_tone) (CallsCall *self,
|
||||
char key);
|
||||
};
|
||||
|
||||
const char *calls_call_get_id (CallsCall *self);
|
||||
void calls_call_set_id (CallsCall *self,
|
||||
const char *id);
|
||||
const char *calls_call_get_name (CallsCall *self);
|
||||
void calls_call_set_name (CallsCall *self,
|
||||
const char *name);
|
||||
CallsCallState calls_call_get_state (CallsCall *self);
|
||||
void calls_call_set_state (CallsCall *self,
|
||||
CallsCallState state);
|
||||
CallsCallType calls_call_get_call_type (CallsCall *self);
|
||||
gboolean calls_call_get_inbound (CallsCall *self);
|
||||
const char *calls_call_get_protocol (CallsCall *self);
|
||||
void calls_call_answer (CallsCall *self);
|
||||
void calls_call_hang_up (CallsCall *self);
|
||||
gboolean calls_call_can_dtmf (CallsCall *self);
|
||||
void calls_call_send_dtmf_tone (CallsCall *self,
|
||||
char key);
|
||||
const char *calls_call_get_id (CallsCall *self);
|
||||
void calls_call_set_id (CallsCall *self,
|
||||
const char *id);
|
||||
const char *calls_call_get_name (CallsCall *self);
|
||||
void calls_call_set_name (CallsCall *self,
|
||||
const char *name);
|
||||
CallsCallState calls_call_get_state (CallsCall *self);
|
||||
void calls_call_set_state (CallsCall *self,
|
||||
CallsCallState state);
|
||||
CallsCallType calls_call_get_call_type (CallsCall *self);
|
||||
gboolean calls_call_get_inbound (CallsCall *self);
|
||||
const char *calls_call_get_protocol (CallsCall *self);
|
||||
void calls_call_answer (CallsCall *self);
|
||||
void calls_call_hang_up (CallsCall *self);
|
||||
gboolean calls_call_can_dtmf (CallsCall *self);
|
||||
void calls_call_send_dtmf_tone (CallsCall *self,
|
||||
char key);
|
||||
|
||||
gboolean calls_call_state_parse_nick (CallsCallState *state,
|
||||
const char *nick);
|
||||
gboolean calls_call_state_parse_nick (CallsCallState *state,
|
||||
const char *nick);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -32,14 +32,13 @@
|
||||
#define HANDY_USE_UNSTABLE_API
|
||||
#include <handy.h>
|
||||
|
||||
struct _CallsContactsBox
|
||||
{
|
||||
GtkBin parent_instance;
|
||||
struct _CallsContactsBox {
|
||||
GtkBin parent_instance;
|
||||
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *contacts_frame;
|
||||
GtkWidget *contacts_listbox;
|
||||
GtkWidget *placeholder_empty;
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *contacts_frame;
|
||||
GtkWidget *contacts_listbox;
|
||||
GtkWidget *placeholder_empty;
|
||||
|
||||
FolksSimpleQuery *search_query;
|
||||
};
|
||||
@@ -51,6 +50,7 @@ search_changed_cb (CallsContactsBox *self,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
const gchar *search_text;
|
||||
|
||||
search_text = gtk_entry_get_text (entry);
|
||||
|
||||
folks_simple_query_set_query_string (self->search_query, search_text);
|
||||
@@ -73,31 +73,27 @@ adjust_style (CallsContactsBox *self, GtkWidget *widget)
|
||||
{
|
||||
g_return_if_fail (CALLS_IS_CONTACTS_BOX (self));
|
||||
|
||||
if (gtk_widget_get_mapped (widget))
|
||||
{
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_vexpand (self->contacts_frame, TRUE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (self->contacts_listbox),
|
||||
"no-background");
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_widget_set_vexpand (self->contacts_frame, FALSE);
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (self->contacts_listbox),
|
||||
"no-background");
|
||||
}
|
||||
if (gtk_widget_get_mapped (widget)) {
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_vexpand (self->contacts_frame, TRUE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (self->contacts_listbox),
|
||||
"no-background");
|
||||
} else {
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (self->contacts_frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_widget_set_vexpand (self->contacts_frame, FALSE);
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (self->contacts_listbox),
|
||||
"no-background");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
header_cb (GtkListBoxRow *row,
|
||||
GtkListBoxRow *before)
|
||||
header_cb (GtkListBoxRow *row,
|
||||
GtkListBoxRow *before)
|
||||
{
|
||||
if (!before)
|
||||
{
|
||||
gtk_list_box_row_set_header (row, NULL);
|
||||
return;
|
||||
}
|
||||
if (!before) {
|
||||
gtk_list_box_row_set_header (row, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!gtk_list_box_row_get_header (row))
|
||||
@@ -109,6 +105,7 @@ contacts_provider_added (CallsContactsBox *self,
|
||||
FolksIndividual *individual)
|
||||
{
|
||||
GtkWidget *row;
|
||||
|
||||
row = calls_contacts_row_new (individual);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (self->contacts_listbox), row);
|
||||
@@ -131,7 +128,7 @@ contacts_provider_removed (CallsContactsBox *self,
|
||||
static gint
|
||||
contacts_sort_func (CallsContactsRow *a,
|
||||
CallsContactsRow *b,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
const gchar *name_a = folks_individual_get_display_name (calls_contacts_row_get_item (a));
|
||||
const gchar *name_b = folks_individual_get_display_name (calls_contacts_row_get_item (b));
|
||||
@@ -157,6 +154,7 @@ static void
|
||||
calls_contacts_box_init (CallsContactsBox *self)
|
||||
{
|
||||
CallsContactsProvider *contacts_provider;
|
||||
|
||||
g_autoptr (GeeCollection) individuals = NULL;
|
||||
gchar* query_fields[] = { "alias",
|
||||
"full-name",
|
||||
|
||||
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsContactsBox, calls_contacts_box, CALLS, CONTACTS_BOX, GtkBin);
|
||||
|
||||
GtkWidget * calls_contacts_box_new (void);
|
||||
GtkWidget *calls_contacts_box_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -48,16 +48,14 @@
|
||||
*/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GeeIterator *iter;
|
||||
IdleCallback callback;
|
||||
gpointer user_data;
|
||||
typedef struct {
|
||||
GeeIterator *iter;
|
||||
IdleCallback callback;
|
||||
gpointer user_data;
|
||||
} IdleData;
|
||||
|
||||
|
||||
struct _CallsContactsProvider
|
||||
{
|
||||
struct _CallsContactsProvider {
|
||||
GObject parent_instance;
|
||||
|
||||
FolksIndividualAggregator *folks_aggregator;
|
||||
@@ -215,12 +213,13 @@ on_contacts_actions_updated (CallsContactsProvider *self)
|
||||
|
||||
|
||||
static void
|
||||
on_contacts_appeared (GDBusConnection *connection,
|
||||
const char *name,
|
||||
const char *owner_name,
|
||||
gpointer user_data)
|
||||
on_contacts_appeared (GDBusConnection *connection,
|
||||
const char *name,
|
||||
const char *owner_name,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsContactsProvider *self;
|
||||
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
g_assert (CALLS_IS_CONTACTS_PROVIDER (user_data));
|
||||
@@ -298,7 +297,7 @@ calls_contacts_provider_finalize (GObject *object)
|
||||
static void
|
||||
calls_contacts_provider_class_init (CallsContactsProviderClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = calls_contacts_provider_get_property;
|
||||
object_class->set_property = calls_contacts_provider_set_property;
|
||||
@@ -313,14 +312,14 @@ calls_contacts_provider_class_init (CallsContactsProviderClass *klass)
|
||||
* having been added.
|
||||
*/
|
||||
signals[SIGNAL_ADDED] =
|
||||
g_signal_new ("added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
FOLKS_TYPE_INDIVIDUAL);
|
||||
g_signal_new ("added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
FOLKS_TYPE_INDIVIDUAL);
|
||||
/**
|
||||
* CallsContactsProvider::removed:
|
||||
* @self: The #CallsContactsProvider instance
|
||||
@@ -330,14 +329,14 @@ calls_contacts_provider_class_init (CallsContactsProviderClass *klass)
|
||||
* having been removed.
|
||||
*/
|
||||
signals[SIGNAL_REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
FOLKS_TYPE_INDIVIDUAL);
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
FOLKS_TYPE_INDIVIDUAL);
|
||||
|
||||
/**
|
||||
* CallsContactsProvider::settings:
|
||||
@@ -481,6 +480,7 @@ calls_contacts_provider_consume_iter_on_idle (GeeIterator *iter,
|
||||
gpointer user_data)
|
||||
{
|
||||
IdleData *data = g_new (IdleData, 1);
|
||||
|
||||
data->iter = iter;
|
||||
data->user_data = user_data;
|
||||
data->callback = callback;
|
||||
|
||||
@@ -42,7 +42,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeSortedSet, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeCollection, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EPhoneNumber, e_phone_number_free)
|
||||
|
||||
typedef void (*IdleCallback) (gpointer user_data,
|
||||
typedef void (*IdleCallback) (gpointer user_data,
|
||||
FolksIndividual *individual);
|
||||
|
||||
#define CALLS_TYPE_CONTACTS_PROVIDER (calls_contacts_provider_get_type ())
|
||||
@@ -50,14 +50,14 @@ typedef void (*IdleCallback) (gpointer user_data,
|
||||
G_DECLARE_FINAL_TYPE (CallsContactsProvider, calls_contacts_provider, CALLS, CONTACTS_PROVIDER, GObject)
|
||||
|
||||
CallsContactsProvider *calls_contacts_provider_new (CallsSettings *settings);
|
||||
GeeCollection *calls_contacts_provider_get_individuals (CallsContactsProvider *self);
|
||||
CallsBestMatch *calls_contacts_provider_lookup_id (CallsContactsProvider *self,
|
||||
const char *id);
|
||||
void calls_contacts_provider_consume_iter_on_idle (GeeIterator *iter,
|
||||
IdleCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean calls_contacts_provider_get_can_add_contacts (CallsContactsProvider *self);
|
||||
void calls_contacts_provider_add_new_contact (CallsContactsProvider *self,
|
||||
const char *phone_number);
|
||||
GeeCollection *calls_contacts_provider_get_individuals (CallsContactsProvider *self);
|
||||
CallsBestMatch *calls_contacts_provider_lookup_id (CallsContactsProvider *self,
|
||||
const char *id);
|
||||
void calls_contacts_provider_consume_iter_on_idle (GeeIterator *iter,
|
||||
IdleCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean calls_contacts_provider_get_can_add_contacts (CallsContactsProvider *self);
|
||||
void calls_contacts_provider_add_new_contact (CallsContactsProvider *self,
|
||||
const char *phone_number);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -16,17 +16,16 @@
|
||||
#include "calls-contacts-row.h"
|
||||
#include "calls-contacts-provider.h"
|
||||
|
||||
struct _CallsContactsRow
|
||||
{
|
||||
GtkListBoxRow parent_instance;
|
||||
struct _CallsContactsRow {
|
||||
GtkListBoxRow parent_instance;
|
||||
|
||||
GtkWidget *avatar;
|
||||
GtkWidget *title;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *avatar;
|
||||
GtkWidget *title;
|
||||
GtkWidget *grid;
|
||||
|
||||
gint n_phonenumbers;
|
||||
gint n_phonenumbers;
|
||||
|
||||
FolksIndividual *item;
|
||||
FolksIndividual *item;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsContactsRow, calls_contacts_row, GTK_TYPE_LIST_BOX_ROW)
|
||||
@@ -63,6 +62,7 @@ static void
|
||||
phone_numbers_changed_cb (CallsContactsRow *self)
|
||||
{
|
||||
GeeIterator *phone_iter;
|
||||
|
||||
g_autoptr (GeeSet) phone_numbers;
|
||||
|
||||
while (gtk_grid_get_child_at (GTK_GRID (self->grid), 1, 1) != NULL) {
|
||||
@@ -121,7 +121,7 @@ calls_contacts_row_dispose (GObject *object)
|
||||
static void
|
||||
calls_contacts_row_class_init (CallsContactsRowClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = calls_contacts_row_dispose;
|
||||
|
||||
@@ -102,12 +102,12 @@ on_handle_call_hangup (CallsDBusCallsCall *skeleton,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
(avatar_loadable_icon_transform_to_image_path) (GBinding *binding,
|
||||
const GValue *from_value,
|
||||
GValue *to_value,
|
||||
gpointer user_data)
|
||||
(avatar_loadable_icon_transform_to_image_path) (GBinding *binding,
|
||||
const GValue *from_value,
|
||||
GValue *to_value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GLoadableIcon *icon = G_LOADABLE_ICON (g_value_get_object(from_value));
|
||||
GLoadableIcon *icon = G_LOADABLE_ICON (g_value_get_object (from_value));
|
||||
|
||||
if (icon == NULL) {
|
||||
g_value_set_string (to_value, NULL);
|
||||
@@ -237,11 +237,11 @@ on_notify_update_hints (CallsUiCallData *call,
|
||||
static void
|
||||
call_added_cb (CallsDBusManager *self, CuiCall *call)
|
||||
{
|
||||
g_autofree char *path = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autoptr (CallsDBusObjectSkeleton) object = NULL;
|
||||
g_autoptr (CallsDBusCallsCall) iface = NULL;
|
||||
g_autoptr (CallsBestMatch) match = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
path = get_obj_path (self, self->iface_num++);
|
||||
object = calls_dbus_object_skeleton_new (path);
|
||||
|
||||
@@ -19,8 +19,8 @@ G_DECLARE_FINAL_TYPE (CallsDBusManager, calls_dbus_manager,
|
||||
CALLS, DBUS_MANAGER, GObject)
|
||||
|
||||
CallsDBusManager *calls_dbus_manager_new (void);
|
||||
gboolean calls_dbus_manager_register (CallsDBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
const char *object_path,
|
||||
GError **error);
|
||||
gboolean calls_dbus_manager_register (CallsDBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
const char *object_path,
|
||||
GError **error);
|
||||
G_END_DECLS
|
||||
|
||||
@@ -31,14 +31,13 @@
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
struct _CallsHistoryBox
|
||||
{
|
||||
GtkStack parent_instance;
|
||||
struct _CallsHistoryBox {
|
||||
GtkStack parent_instance;
|
||||
|
||||
GtkListBox *history;
|
||||
|
||||
GListModel *model;
|
||||
gulong model_changed_handler_id;
|
||||
gulong model_changed_handler_id;
|
||||
|
||||
};
|
||||
|
||||
@@ -74,8 +73,8 @@ update (CallsHistoryBox *self)
|
||||
|
||||
|
||||
static void
|
||||
delete_call_cb (CallsCallRecord *record,
|
||||
CallsHistoryBox *self)
|
||||
delete_call_cb (CallsCallRecord *record,
|
||||
CallsHistoryBox *self)
|
||||
{
|
||||
guint position;
|
||||
guint id;
|
||||
@@ -84,8 +83,8 @@ delete_call_cb (CallsCallRecord *record,
|
||||
g_return_if_fail (CALLS_IS_CALL_RECORD (record));
|
||||
|
||||
ok = calls_find_in_store (self->model,
|
||||
record,
|
||||
&position);
|
||||
record,
|
||||
&position);
|
||||
|
||||
g_object_get (G_OBJECT (record),
|
||||
"id",
|
||||
@@ -100,7 +99,7 @@ delete_call_cb (CallsCallRecord *record,
|
||||
|
||||
g_list_store_remove ((GListStore *) self->model, position);
|
||||
|
||||
update(self);
|
||||
update (self);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +108,7 @@ create_row_cb (CallsCallRecord *record,
|
||||
CallsHistoryBox *self)
|
||||
{
|
||||
GtkWidget *row_widget;
|
||||
|
||||
row_widget = GTK_WIDGET (calls_call_record_row_new (record));
|
||||
|
||||
g_signal_connect (record,
|
||||
@@ -149,12 +149,12 @@ constructed (GObject *object)
|
||||
|
||||
self->model_changed_handler_id =
|
||||
g_signal_connect_swapped
|
||||
(self->model, "items-changed", G_CALLBACK (update), self);
|
||||
(self->model, "items-changed", G_CALLBACK (update), self);
|
||||
g_assert (self->model_changed_handler_id != 0);
|
||||
|
||||
gtk_list_box_bind_model (self->history,
|
||||
self->model,
|
||||
(GtkListBoxCreateWidgetFunc)create_row_cb,
|
||||
(GtkListBoxCreateWidgetFunc) create_row_cb,
|
||||
self,
|
||||
NULL);
|
||||
|
||||
@@ -208,7 +208,7 @@ calls_history_box_init (CallsHistoryBox *self)
|
||||
|
||||
|
||||
CallsHistoryBox *
|
||||
calls_history_box_new (GListModel *model)
|
||||
calls_history_box_new (GListModel *model)
|
||||
{
|
||||
return g_object_new (CALLS_TYPE_HISTORY_BOX,
|
||||
"model", model,
|
||||
|
||||
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkStack);
|
||||
|
||||
CallsHistoryBox * calls_history_box_new (GListModel *model);
|
||||
CallsHistoryBox *calls_history_box_new (GListModel *model);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -26,14 +26,13 @@
|
||||
|
||||
#define DEFAULT_TIMEOUT_SECONDS 3
|
||||
|
||||
struct _CallsInAppNotification
|
||||
{
|
||||
struct _CallsInAppNotification {
|
||||
GtkRevealer parent_instance;
|
||||
|
||||
GtkLabel *label;
|
||||
GtkLabel *label;
|
||||
|
||||
guint timeout;
|
||||
guint timeout_id;
|
||||
guint timeout;
|
||||
guint timeout_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsInAppNotification, calls_in_app_notification, GTK_TYPE_REVEALER)
|
||||
@@ -56,10 +55,10 @@ timeout_cb (CallsInAppNotification *self)
|
||||
|
||||
|
||||
static void
|
||||
calls_in_app_notification_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
calls_in_app_notification_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsInAppNotification *self = CALLS_IN_APP_NOTIFICATION (object);
|
||||
|
||||
@@ -159,7 +158,7 @@ calls_in_app_notification_show (CallsInAppNotification *self, const gchar *messa
|
||||
g_source_remove (self->timeout_id);
|
||||
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self), TRUE);
|
||||
self->timeout_id = g_timeout_add_seconds (self->timeout, (GSourceFunc)timeout_cb, self);
|
||||
self->timeout_id = g_timeout_add_seconds (self->timeout, (GSourceFunc) timeout_cb, self);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,5 +169,5 @@ calls_in_app_notification_hide (CallsInAppNotification *self)
|
||||
|
||||
g_clear_handle_id (&self->timeout_id, g_source_remove);
|
||||
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER(self), FALSE);
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ get_log_level_prefix (GLogLevelFlags log_level,
|
||||
log_level = log_level & ~CALLS_LOG_DETAILED;
|
||||
|
||||
if (use_color) {
|
||||
switch ((int)log_level) { /* Same colors as used in GLib */
|
||||
switch ((int) log_level) { /* Same colors as used in GLib */
|
||||
case G_LOG_LEVEL_ERROR: return " \033[1;31mERROR\033[0m";
|
||||
case G_LOG_LEVEL_CRITICAL: return "\033[1;35mCRITICAL\033[0m";
|
||||
case G_LOG_LEVEL_WARNING: return " \033[1;33mWARNING\033[0m";
|
||||
@@ -74,7 +74,7 @@ get_log_level_prefix (GLogLevelFlags log_level,
|
||||
default: return " UNKNOWN";
|
||||
}
|
||||
} else {
|
||||
switch ((int)log_level) {
|
||||
switch ((int) log_level) {
|
||||
case G_LOG_LEVEL_ERROR: return " ERROR";
|
||||
case G_LOG_LEVEL_CRITICAL: return "CRITICAL";
|
||||
case G_LOG_LEVEL_WARNING: return " WARNING";
|
||||
@@ -95,7 +95,7 @@ calls_log_write (GLogLevelFlags log_level,
|
||||
gsize n_fields,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr(GString) log_str = NULL;
|
||||
g_autoptr (GString) log_str = NULL;
|
||||
FILE *stream;
|
||||
gboolean can_color;
|
||||
|
||||
@@ -123,7 +123,7 @@ calls_log_write (GLogLevelFlags log_level,
|
||||
strftime (buffer, sizeof (buffer), "%H:%M:%S", &tm_now);
|
||||
|
||||
g_string_append_printf (log_str, "%s.%04d ", buffer,
|
||||
(int)((now % G_USEC_PER_SEC) / 100));
|
||||
(int) ((now % G_USEC_PER_SEC) / 100));
|
||||
}
|
||||
|
||||
can_color = g_log_writer_supports_color (fileno (stream));
|
||||
@@ -173,7 +173,7 @@ calls_log_handler (GLogLevelFlags log_level,
|
||||
const char *log_message = NULL;
|
||||
|
||||
/* If domain is “all” show logs upto debug regardless of the verbosity */
|
||||
switch ((int)log_level) {
|
||||
switch ((int) log_level) {
|
||||
case G_LOG_LEVEL_MESSAGE:
|
||||
if (any_domain && domains)
|
||||
break;
|
||||
@@ -235,7 +235,7 @@ calls_log_handler (GLogLevelFlags log_level,
|
||||
|
||||
if (any_domain || strcasestr (domains, log_domain))
|
||||
return calls_log_write (log_level, log_domain, log_message,
|
||||
fields, n_fields, user_data);
|
||||
fields, n_fields, user_data);
|
||||
|
||||
return G_LOG_WRITER_HANDLED;
|
||||
}
|
||||
|
||||
@@ -40,32 +40,31 @@
|
||||
#include <handy.h>
|
||||
|
||||
|
||||
struct _CallsMainWindow
|
||||
{
|
||||
HdyApplicationWindow parent_instance;
|
||||
struct _CallsMainWindow {
|
||||
HdyApplicationWindow parent_instance;
|
||||
|
||||
GListModel *record_store;
|
||||
GListModel *record_store;
|
||||
|
||||
CallsInAppNotification *in_app_notification;
|
||||
|
||||
HdyViewSwitcherTitle *title_switcher;
|
||||
GtkStack *main_stack;
|
||||
HdyViewSwitcherTitle *title_switcher;
|
||||
GtkStack *main_stack;
|
||||
|
||||
GtkRevealer *permanent_error_revealer;
|
||||
GtkLabel *permanent_error_label;
|
||||
GtkRevealer *permanent_error_revealer;
|
||||
GtkLabel *permanent_error_label;
|
||||
|
||||
CallsAccountOverview *account_overview;
|
||||
CallsNewCallBox *new_call;
|
||||
CallsAccountOverview *account_overview;
|
||||
CallsNewCallBox *new_call;
|
||||
|
||||
GtkDialog *ussd_dialog;
|
||||
GtkStack *ussd_stack;
|
||||
GtkSpinner *ussd_spinner;
|
||||
GtkBox *ussd_content;
|
||||
GtkLabel *ussd_label;
|
||||
GtkEntry *ussd_entry;
|
||||
GtkButton *ussd_close_button;
|
||||
GtkButton *ussd_cancel_button;
|
||||
GtkButton *ussd_reply_button;
|
||||
GtkDialog *ussd_dialog;
|
||||
GtkStack *ussd_stack;
|
||||
GtkSpinner *ussd_spinner;
|
||||
GtkBox *ussd_content;
|
||||
GtkLabel *ussd_label;
|
||||
GtkEntry *ussd_entry;
|
||||
GtkButton *ussd_close_button;
|
||||
GtkButton *ussd_cancel_button;
|
||||
GtkButton *ussd_reply_button;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsMainWindow, calls_main_window, HDY_TYPE_APPLICATION_WINDOW);
|
||||
@@ -106,8 +105,8 @@ about_action (GSimpleAction *action,
|
||||
NULL
|
||||
};
|
||||
|
||||
version = g_str_equal (VCS_TAG, "") ? PACKAGE_VERSION:
|
||||
PACKAGE_VERSION "-" VCS_TAG;
|
||||
version = g_str_equal (VCS_TAG, "") ?
|
||||
PACKAGE_VERSION : PACKAGE_VERSION "-" VCS_TAG;
|
||||
|
||||
/*
|
||||
* “program-name” defaults to g_get_application_name().
|
||||
@@ -128,7 +127,7 @@ about_action (GSimpleAction *action,
|
||||
}
|
||||
|
||||
|
||||
static const GActionEntry window_entries [] =
|
||||
static const GActionEntry window_entries[] =
|
||||
{
|
||||
{ "about", about_action },
|
||||
};
|
||||
@@ -216,26 +215,24 @@ window_ussd_respond_cb (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsMainWindow *self = user_data;
|
||||
g_autofree char *response = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autofree char *response = NULL;
|
||||
CallsMainWindow *self = user_data;
|
||||
CallsUssd *ussd;
|
||||
|
||||
ussd = g_object_get_data (G_OBJECT (self->ussd_dialog), "ussd");
|
||||
response = calls_ussd_respond_finish (ussd, result, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
|
||||
g_warning ("USSD Error: %s", error->message);
|
||||
return;
|
||||
}
|
||||
if (error) {
|
||||
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
|
||||
g_warning ("USSD Error: %s", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response && *response)
|
||||
{
|
||||
window_update_ussd_state (self, ussd);
|
||||
gtk_label_set_text (self->ussd_label, response);
|
||||
}
|
||||
if (response && *response) {
|
||||
window_update_ussd_state (self, ussd);
|
||||
gtk_label_set_text (self->ussd_label, response);
|
||||
}
|
||||
|
||||
gtk_spinner_stop (self->ussd_spinner);
|
||||
gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_content));
|
||||
@@ -263,20 +260,19 @@ main_window_ussd_send_cb (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsMainWindow *self = user_data;
|
||||
g_autofree char *response = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
g_autofree char *response = NULL;
|
||||
CallsMainWindow *self = user_data;
|
||||
CallsUssd *ussd;
|
||||
|
||||
response = calls_new_call_box_send_ussd_finish (self->new_call, result, &error);
|
||||
ussd = g_task_get_task_data (G_TASK (result));
|
||||
|
||||
if (error)
|
||||
{
|
||||
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
|
||||
g_warning ("USSD Error: %s", error->message);
|
||||
return;
|
||||
}
|
||||
if (error) {
|
||||
gtk_dialog_response (self->ussd_dialog, GTK_RESPONSE_CLOSE);
|
||||
g_warning ("USSD Error: %s", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (self->ussd_dialog), "ussd",
|
||||
g_object_ref (ussd), g_object_unref);
|
||||
@@ -376,9 +372,9 @@ constructed (GObject *object)
|
||||
"recent", _("Recent"));
|
||||
gtk_container_child_set
|
||||
(main_stack, widget,
|
||||
"icon-name", "document-open-recent-symbolic",
|
||||
"position", 0,
|
||||
NULL);
|
||||
"icon-name", "document-open-recent-symbolic",
|
||||
"position", 0,
|
||||
NULL);
|
||||
gtk_widget_set_visible (widget, TRUE);
|
||||
gtk_stack_set_visible_child_name (self->main_stack, "recent");
|
||||
|
||||
@@ -501,22 +497,19 @@ void
|
||||
calls_main_window_dial (CallsMainWindow *self,
|
||||
const gchar *target)
|
||||
{
|
||||
if (calls_number_is_ussd (target))
|
||||
{
|
||||
gtk_widget_hide (GTK_WIDGET (self->ussd_cancel_button));
|
||||
gtk_widget_hide (GTK_WIDGET (self->ussd_reply_button));
|
||||
gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_spinner));
|
||||
gtk_spinner_start (self->ussd_spinner);
|
||||
if (calls_number_is_ussd (target)) {
|
||||
gtk_widget_hide (GTK_WIDGET (self->ussd_cancel_button));
|
||||
gtk_widget_hide (GTK_WIDGET (self->ussd_reply_button));
|
||||
gtk_stack_set_visible_child (self->ussd_stack, GTK_WIDGET (self->ussd_spinner));
|
||||
gtk_spinner_start (self->ussd_spinner);
|
||||
|
||||
calls_new_call_box_send_ussd_async (self->new_call, target, NULL,
|
||||
main_window_ussd_send_cb, self);
|
||||
calls_new_call_box_send_ussd_async (self->new_call, target, NULL,
|
||||
main_window_ussd_send_cb, self);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (self->ussd_dialog));
|
||||
}
|
||||
else
|
||||
{
|
||||
calls_new_call_box_dial (self->new_call, target);
|
||||
}
|
||||
gtk_window_present (GTK_WINDOW (self->ussd_dialog));
|
||||
} else {
|
||||
calls_new_call_box_dial (self->new_call, target);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -33,11 +33,11 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsMainWindow, calls_main_window, CALLS, MAIN_WINDOW, HdyApplicationWindow);
|
||||
|
||||
CallsMainWindow *calls_main_window_new (GtkApplication *application,
|
||||
GListModel *record_store);
|
||||
void calls_main_window_dial (CallsMainWindow *self,
|
||||
const gchar *target);
|
||||
void calls_main_window_show_accounts_overview (CallsMainWindow *self);
|
||||
CallsMainWindow *calls_main_window_new (GtkApplication *application,
|
||||
GListModel *record_store);
|
||||
void calls_main_window_dial (CallsMainWindow *self,
|
||||
const gchar *target);
|
||||
void calls_main_window_show_accounts_overview (CallsMainWindow *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -59,25 +59,24 @@ static const char * const protocols[] = {
|
||||
"sips"
|
||||
};
|
||||
|
||||
struct _CallsManager
|
||||
{
|
||||
GObject parent_instance;
|
||||
struct _CallsManager {
|
||||
GObject parent_instance;
|
||||
|
||||
GHashTable *providers;
|
||||
GHashTable *providers;
|
||||
|
||||
GListStore *origins;
|
||||
GListStore *origins;
|
||||
/* origins_by_protocol maps protocol names to GListStore's of suitable origins */
|
||||
GHashTable *origins_by_protocol;
|
||||
GHashTable *origins_by_protocol;
|
||||
/* dial_actions_by_protocol maps protocol names to GSimpleActions */
|
||||
GHashTable *dial_actions_by_protocol;
|
||||
GHashTable *dial_actions_by_protocol;
|
||||
|
||||
/* map CallsCall to CallsUiCallData */
|
||||
GHashTable *calls;
|
||||
GHashTable *calls;
|
||||
|
||||
CallsContactsProvider *contacts_provider;
|
||||
|
||||
CallsManagerFlags state_flags;
|
||||
CallsSettings *settings;
|
||||
CallsManagerFlags state_flags;
|
||||
CallsSettings *settings;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -106,7 +105,7 @@ enum {
|
||||
PROVIDERS_CHANGED,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
};
|
||||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
static guint signals[SIGNAL_LAST_SIGNAL];
|
||||
|
||||
|
||||
static void
|
||||
@@ -224,7 +223,7 @@ on_message (CallsMessageSource *source,
|
||||
}
|
||||
|
||||
calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (self),
|
||||
notification ? : message,
|
||||
notification ?: message,
|
||||
message_type);
|
||||
}
|
||||
|
||||
@@ -247,8 +246,7 @@ add_call (CallsManager *self, CallsCall *call, CallsOrigin *origin)
|
||||
}
|
||||
|
||||
|
||||
struct CallsRemoveData
|
||||
{
|
||||
struct CallsRemoveData {
|
||||
CallsManager *manager;
|
||||
CallsCall *call;
|
||||
};
|
||||
@@ -358,6 +356,7 @@ static void
|
||||
add_origin (CallsManager *self, CallsOrigin *origin)
|
||||
{
|
||||
g_autofree const char *name = NULL;
|
||||
|
||||
g_assert (CALLS_IS_MANAGER (self));
|
||||
g_assert (CALLS_IS_ORIGIN (origin));
|
||||
|
||||
@@ -379,12 +378,11 @@ add_origin (CallsManager *self, CallsOrigin *origin)
|
||||
g_signal_connect_swapped (origin, "call-added", G_CALLBACK (add_call), self);
|
||||
g_signal_connect_swapped (origin, "call-removed", G_CALLBACK (remove_call), self);
|
||||
|
||||
if (CALLS_IS_USSD (origin))
|
||||
{
|
||||
g_signal_connect_swapped (origin, "ussd-added", G_CALLBACK (ussd_added_cb), self);
|
||||
g_signal_connect_swapped (origin, "ussd-cancelled", G_CALLBACK (ussd_cancelled_cb), self);
|
||||
g_signal_connect_swapped (origin, "ussd-state-changed", G_CALLBACK (ussd_state_changed_cb), self);
|
||||
}
|
||||
if (CALLS_IS_USSD (origin)) {
|
||||
g_signal_connect_swapped (origin, "ussd-added", G_CALLBACK (ussd_added_cb), self);
|
||||
g_signal_connect_swapped (origin, "ussd-cancelled", G_CALLBACK (ussd_cancelled_cb), self);
|
||||
g_signal_connect_swapped (origin, "ussd-state-changed", G_CALLBACK (ussd_state_changed_cb), self);
|
||||
}
|
||||
|
||||
calls_origin_foreach_call (origin, (CallsOriginForeachCallFunc) add_call, self);
|
||||
}
|
||||
@@ -464,9 +462,10 @@ static void
|
||||
remove_provider (CallsManager *self,
|
||||
const char *name)
|
||||
{
|
||||
g_autoptr (CallsProvider) provider = NULL;
|
||||
|
||||
GListModel *origins;
|
||||
guint n_items;
|
||||
g_autoptr (CallsProvider) provider = NULL;
|
||||
|
||||
g_assert (CALLS_IS_MANAGER (self));
|
||||
g_assert (name);
|
||||
@@ -488,7 +487,7 @@ remove_provider (CallsManager *self,
|
||||
n_items = g_list_model_get_n_items (origins);
|
||||
|
||||
for (guint i = 0; i < n_items; i++) {
|
||||
g_autoptr(CallsOrigin) origin = NULL;
|
||||
g_autoptr (CallsOrigin) origin = NULL;
|
||||
|
||||
origin = g_list_model_get_item (origins, i);
|
||||
remove_origin (self, origin);
|
||||
@@ -568,7 +567,7 @@ origin_items_changed_cb (GListModel *model,
|
||||
g_warning ("Managed origins are not in sync anymore!");
|
||||
}
|
||||
|
||||
skip_remove:
|
||||
skip_remove:
|
||||
for (i = 0; i < added; i++) {
|
||||
g_debug ("before adding: %d",
|
||||
g_list_model_get_n_items (G_LIST_MODEL (self->origins)));
|
||||
@@ -830,7 +829,7 @@ calls_manager_get_default (void)
|
||||
|
||||
if (instance == NULL) {
|
||||
instance = calls_manager_new ();
|
||||
g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *)&instance);
|
||||
g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *) &instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@@ -980,12 +979,11 @@ calls_manager_has_active_call (CallsManager *self)
|
||||
|
||||
calls = calls_manager_get_calls (self);
|
||||
|
||||
for (node = calls; node; node = node->next)
|
||||
{
|
||||
call = node->data;
|
||||
if (calls_call_get_state (call) != CALLS_CALL_STATE_DISCONNECTED)
|
||||
return TRUE;
|
||||
}
|
||||
for (node = calls; node; node = node->next) {
|
||||
call = node->data;
|
||||
if (calls_call_get_state (call) != CALLS_CALL_STATE_DISCONNECTED)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ G_DECLARE_FINAL_TYPE (CallsManager, calls_manager, CALLS, MANAGER, GObject)
|
||||
|
||||
typedef enum /*< flags >*/
|
||||
{
|
||||
CALLS_MANAGER_FLAGS_UNKNOWN = 0,
|
||||
CALLS_MANAGER_FLAGS_UNKNOWN = 0,
|
||||
CALLS_MANAGER_FLAGS_HAS_CELLULAR_PROVIDER = (1<<0),
|
||||
CALLS_MANAGER_FLAGS_HAS_CELLULAR_MODEM = (1<<1),
|
||||
CALLS_MANAGER_FLAGS_HAS_VOIP_PROVIDER = (1<<2),
|
||||
CALLS_MANAGER_FLAGS_HAS_VOIP_ACCOUNT = (1<<3),
|
||||
CALLS_MANAGER_FLAGS_HAS_CELLULAR_MODEM = (1<<1),
|
||||
CALLS_MANAGER_FLAGS_HAS_VOIP_PROVIDER = (1<<2),
|
||||
CALLS_MANAGER_FLAGS_HAS_VOIP_ACCOUNT = (1<<3),
|
||||
} CallsManagerFlags;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ GListModel *calls_manager_get_suitable_origins (CallsManager *sel
|
||||
const char *target);
|
||||
CallsOrigin *calls_manager_get_origin_by_id (CallsManager *self,
|
||||
const char *origin_id);
|
||||
const gchar *calls_manager_get_contact_name (CallsCall *call);
|
||||
const gchar *calls_manager_get_contact_name (CallsCall *call);
|
||||
gboolean calls_manager_has_active_call (CallsManager *self);
|
||||
void calls_manager_hang_up_all_calls (CallsManager *self);
|
||||
gboolean calls_manager_has_any_provider (CallsManager *self);
|
||||
|
||||
@@ -40,7 +40,7 @@ enum {
|
||||
SIGNAL_MESSAGE,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
};
|
||||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
static guint signals[SIGNAL_LAST_SIGNAL];
|
||||
|
||||
|
||||
static void
|
||||
@@ -61,11 +61,11 @@ calls_message_source_default_init (CallsMessageSourceInterface *iface)
|
||||
*/
|
||||
signals[SIGNAL_MESSAGE] =
|
||||
g_signal_newv ("message",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
2, arg_types);
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
2, arg_types);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,8 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_INTERFACE (CallsMessageSource, calls_message_source, CALLS, MESSAGE_SOURCE, GObject)
|
||||
|
||||
struct _CallsMessageSourceInterface
|
||||
{
|
||||
struct _CallsMessageSourceInterface {
|
||||
GTypeInterface parent_iface;
|
||||
};
|
||||
|
||||
@@ -69,8 +68,8 @@ struct _CallsMessageSourceInterface
|
||||
#define CALLS_ERROR(obj,error) \
|
||||
CALLS_EMIT_MESSAGE (obj, error->message, GTK_MESSAGE_ERROR)
|
||||
|
||||
void calls_message_source_emit_message (CallsMessageSource *self,
|
||||
const char *message,
|
||||
GtkMessageType message_type);
|
||||
void calls_message_source_emit_message (CallsMessageSource *self,
|
||||
const char *message,
|
||||
GtkMessageType message_type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
typedef struct {
|
||||
struct nlmsghdr n;
|
||||
struct rtmsg r;
|
||||
char buf[1024];
|
||||
struct rtmsg r;
|
||||
char buf[1024];
|
||||
} RequestData;
|
||||
|
||||
enum {
|
||||
@@ -67,20 +67,20 @@ static guint signals[N_SIGNALS];
|
||||
|
||||
|
||||
typedef struct _CallsNetworkWatch {
|
||||
GObject parent;
|
||||
GObject parent;
|
||||
|
||||
RequestData *req;
|
||||
int fd;
|
||||
int fd;
|
||||
unsigned int seq;
|
||||
char buf[1024]; /* buffer for responses to rtnetlink requests */
|
||||
char buf[1024]; /* buffer for responses to rtnetlink requests */
|
||||
|
||||
guint timeout_id;
|
||||
guint timeout_id;
|
||||
|
||||
gboolean repeated_warning;
|
||||
gboolean repeated_warning;
|
||||
|
||||
char *ipv4;
|
||||
char *ipv6;
|
||||
char tmp_addr[INET6_ADDRSTRLEN];
|
||||
char *ipv4;
|
||||
char *ipv6;
|
||||
char tmp_addr[INET6_ADDRSTRLEN];
|
||||
} CallsNetworkWatch;
|
||||
|
||||
|
||||
@@ -308,9 +308,9 @@ on_watch_network (CallsNetworkWatch *self)
|
||||
}
|
||||
|
||||
static void
|
||||
calls_network_watch_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
calls_network_watch_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsNetworkWatch *self = CALLS_NETWORK_WATCH (object);
|
||||
|
||||
@@ -32,8 +32,8 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsNetworkWatch, calls_network_watch, CALLS, NETWORK_WATCH, GObject)
|
||||
|
||||
CallsNetworkWatch *calls_network_watch_get_default (void);
|
||||
const char *calls_network_watch_get_ipv4 (CallsNetworkWatch *self);
|
||||
const char *calls_network_watch_get_ipv6 (CallsNetworkWatch *self);
|
||||
CallsNetworkWatch *calls_network_watch_get_default (void);
|
||||
const char *calls_network_watch_get_ipv4 (CallsNetworkWatch *self);
|
||||
const char *calls_network_watch_get_ipv6 (CallsNetworkWatch *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -40,23 +40,22 @@ enum {
|
||||
};
|
||||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
||||
struct _CallsNewCallBox
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
struct _CallsNewCallBox {
|
||||
GtkBox parent_instance;
|
||||
|
||||
GtkListBox *origin_list_box;
|
||||
HdyComboRow *origin_list;
|
||||
GtkButton *backspace;
|
||||
HdyKeypad *keypad;
|
||||
GtkButton *dial;
|
||||
GtkEntry *address_entry;
|
||||
HdyActionRow *result;
|
||||
GtkButton *dial_result;
|
||||
GtkListBox *origin_list_box;
|
||||
HdyComboRow *origin_list;
|
||||
GtkButton *backspace;
|
||||
HdyKeypad *keypad;
|
||||
GtkButton *dial;
|
||||
GtkEntry *address_entry;
|
||||
HdyActionRow *result;
|
||||
GtkButton *dial_result;
|
||||
GtkGestureLongPress *long_press_back_gesture;
|
||||
|
||||
GList *dial_queue;
|
||||
GList *dial_queue;
|
||||
|
||||
gboolean numeric_input_only;
|
||||
gboolean numeric_input_only;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsNewCallBox, calls_new_call_box, GTK_TYPE_BOX);
|
||||
@@ -85,6 +84,7 @@ get_origin (CallsNewCallBox *self,
|
||||
{
|
||||
CallsManager *manager = calls_manager_get_default ();
|
||||
CallsSettings *settings = calls_manager_get_settings (manager);
|
||||
|
||||
g_autoptr (CallsOrigin) origin = NULL;
|
||||
GListModel *model;
|
||||
gboolean auto_use_def_origin =
|
||||
@@ -158,6 +158,7 @@ static void
|
||||
long_press_back_cb (CallsNewCallBox *self)
|
||||
{
|
||||
GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
|
||||
|
||||
gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
|
||||
}
|
||||
|
||||
@@ -165,6 +166,7 @@ static void
|
||||
backspace_clicked_cb (CallsNewCallBox *self)
|
||||
{
|
||||
GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
|
||||
|
||||
g_signal_emit_by_name (entry, "backspace", NULL);
|
||||
}
|
||||
|
||||
@@ -174,7 +176,8 @@ ussd_send_cb (GObject *object,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsNewCallBox *self;
|
||||
CallsUssd *ussd = (CallsUssd *)object;
|
||||
CallsUssd *ussd = (CallsUssd *) object;
|
||||
|
||||
g_autoptr (GTask) task = user_data;
|
||||
GError *error = NULL;
|
||||
char *response;
|
||||
@@ -232,6 +235,7 @@ dial_queued_cb (gchar *target,
|
||||
CallsNewCallBox *self)
|
||||
{
|
||||
CallsOrigin *origin = NULL;
|
||||
|
||||
g_debug ("Try dialing queued target `%s'", target);
|
||||
|
||||
origin = get_origin (self,
|
||||
@@ -239,9 +243,9 @@ dial_queued_cb (gchar *target,
|
||||
if (origin) {
|
||||
calls_origin_dial (origin, target);
|
||||
self->dial_queue = g_list_remove (self->dial_queue, target);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
g_debug ("No suitable origin found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -414,11 +418,11 @@ calls_new_call_box_dial (CallsNewCallBox *self,
|
||||
}
|
||||
|
||||
void
|
||||
calls_new_call_box_send_ussd_async (CallsNewCallBox *self,
|
||||
const char *target,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
calls_new_call_box_send_ussd_async (CallsNewCallBox *self,
|
||||
const char *target,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr (CallsOrigin) origin = NULL;
|
||||
g_autoptr (GTask) task = NULL;
|
||||
@@ -454,7 +458,7 @@ calls_new_call_box_send_ussd_async (CallsNewCallBox *self,
|
||||
char *
|
||||
calls_new_call_box_send_ussd_finish (CallsNewCallBox *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_NEW_CALL_BOX (self), NULL);
|
||||
g_return_val_if_fail (G_IS_TASK (result), NULL);
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALLS_NEW_CALL_BOX_H__
|
||||
#define CALLS_NEW_CALL_BOX_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -31,20 +30,18 @@ G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_NEW_CALL_BOX (calls_new_call_box_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsNewCallBox, calls_new_call_box, CALLS, NEW_CALL_BOX, GtkBox);
|
||||
G_DECLARE_FINAL_TYPE (CallsNewCallBox, calls_new_call_box, CALLS, NEW_CALL_BOX, GtkBox)
|
||||
|
||||
CallsNewCallBox * calls_new_call_box_new (void);
|
||||
void calls_new_call_box_dial (CallsNewCallBox *self,
|
||||
const gchar *target);
|
||||
void calls_new_call_box_send_ussd_async (CallsNewCallBox *self,
|
||||
const char *target,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_new_call_box_send_ussd_finish (CallsNewCallBox *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
CallsNewCallBox *calls_new_call_box_new (void);
|
||||
void calls_new_call_box_dial (CallsNewCallBox *self,
|
||||
const gchar *target);
|
||||
void calls_new_call_box_send_ussd_async (CallsNewCallBox *self,
|
||||
const char *target,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_new_call_box_send_ussd_finish (CallsNewCallBox *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* CALLS_NEW_CALL_BOX_H__ */
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
struct _CallsNotifier
|
||||
{
|
||||
GObject parent_instance;
|
||||
struct _CallsNotifier {
|
||||
GObject parent_instance;
|
||||
|
||||
GListStore *unanswered;
|
||||
GListStore *unanswered;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsNotifier, calls_notifier, G_TYPE_OBJECT);
|
||||
@@ -49,6 +48,7 @@ static void
|
||||
notify (CallsNotifier *self, CuiCall *call)
|
||||
{
|
||||
GApplication *app = g_application_get_default ();
|
||||
|
||||
g_autoptr (GNotification) notification = g_notification_new (_("Missed call"));
|
||||
g_autofree gchar *msg = NULL;
|
||||
g_autofree gchar *ref = NULL;
|
||||
@@ -58,13 +58,13 @@ notify (CallsNotifier *self, CuiCall *call)
|
||||
gboolean got_id;
|
||||
gboolean got_contact;
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,70,0)
|
||||
#if GLIB_CHECK_VERSION (2,70,0)
|
||||
g_notification_set_category (notification, "x-gnome.call.unanswered");
|
||||
#endif
|
||||
/* TODO: We need to update the notification when the contact name changes
|
||||
We would need to resend the notification in this case, as changing the properties
|
||||
after having called g_application_send_notification() will have no effect.
|
||||
*/
|
||||
*/
|
||||
name = cui_call_get_display_name (call);
|
||||
id = cui_call_get_id (call);
|
||||
|
||||
@@ -123,7 +123,7 @@ state_changed_cb (CallsNotifier *self,
|
||||
static void
|
||||
call_added_cb (CallsNotifier *self, CuiCall *call)
|
||||
{
|
||||
g_list_store_append(self->unanswered, call);
|
||||
g_list_store_append (self->unanswered, call);
|
||||
|
||||
g_signal_connect_swapped (call,
|
||||
"state-changed",
|
||||
|
||||
@@ -40,7 +40,7 @@ enum {
|
||||
SIGNAL_CALL_REMOVED,
|
||||
SIGNAL_LAST_SIGNAL,
|
||||
};
|
||||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
static guint signals[SIGNAL_LAST_SIGNAL];
|
||||
|
||||
static void
|
||||
calls_origin_default_init (CallsOriginInterface *iface)
|
||||
@@ -80,19 +80,19 @@ calls_origin_default_init (CallsOriginInterface *iface)
|
||||
|
||||
signals[SIGNAL_CALL_ADDED] =
|
||||
g_signal_newv ("call-added",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1, arg_types);
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1, arg_types);
|
||||
|
||||
signals[SIGNAL_CALL_REMOVED] =
|
||||
g_signal_newv ("call-removed",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
2, arg_types);
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
2, arg_types);
|
||||
}
|
||||
|
||||
#define DEFINE_ORIGIN_GETTER(prop,rettype,errval) \
|
||||
@@ -107,7 +107,7 @@ calls_origin_default_init (CallsOriginInterface *iface)
|
||||
* Returns (transfer full): A string containing the name. The string must be freed by
|
||||
* the caller.
|
||||
*/
|
||||
DEFINE_ORIGIN_GETTER(name, char *, NULL);
|
||||
DEFINE_ORIGIN_GETTER (name, char *, NULL);
|
||||
|
||||
/**
|
||||
* calls_origin_get_id:
|
||||
@@ -118,7 +118,7 @@ DEFINE_ORIGIN_GETTER(name, char *, NULL);
|
||||
* Returns (transfer full): A string containing the id. The string must be freed by
|
||||
* the caller.
|
||||
*/
|
||||
DEFINE_ORIGIN_GETTER(id, char *, NULL);
|
||||
DEFINE_ORIGIN_GETTER (id, char *, NULL);
|
||||
|
||||
/**
|
||||
* calls_origin_get_calls:
|
||||
@@ -129,7 +129,7 @@ DEFINE_ORIGIN_GETTER(id, char *, NULL);
|
||||
* Returns: (transfer container): A newly-allocated GList of objects implementing
|
||||
* #CallsCall or NULL if there was an error.
|
||||
*/
|
||||
DEFINE_ORIGIN_GETTER(calls, GList *, NULL);
|
||||
DEFINE_ORIGIN_GETTER (calls, GList *, NULL);
|
||||
|
||||
/**
|
||||
* calls_origin_foreach_call:
|
||||
@@ -140,9 +140,9 @@ DEFINE_ORIGIN_GETTER(calls, GList *, NULL);
|
||||
* Iterate over all current calls from this origin
|
||||
**/
|
||||
void
|
||||
calls_origin_foreach_call(CallsOrigin *self,
|
||||
CallsOriginForeachCallFunc callback,
|
||||
gpointer param)
|
||||
calls_origin_foreach_call (CallsOrigin *self,
|
||||
CallsOriginForeachCallFunc callback,
|
||||
gpointer param)
|
||||
{
|
||||
g_autoptr (GList) calls = NULL;
|
||||
GList *node;
|
||||
@@ -164,8 +164,8 @@ calls_origin_foreach_call(CallsOrigin *self,
|
||||
* there is an error, an appropriate #message signal will be emitted.
|
||||
*/
|
||||
void
|
||||
calls_origin_dial(CallsOrigin *self,
|
||||
const char *number)
|
||||
calls_origin_dial (CallsOrigin *self,
|
||||
const char *number)
|
||||
{
|
||||
CallsOriginInterface *iface;
|
||||
|
||||
@@ -175,7 +175,7 @@ calls_origin_dial(CallsOrigin *self,
|
||||
iface = CALLS_ORIGIN_GET_IFACE (self);
|
||||
g_return_if_fail (iface->dial != NULL);
|
||||
|
||||
return iface->dial(self, number);
|
||||
return iface->dial (self, number);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALLS_ORIGIN_H__
|
||||
#define CALLS_ORIGIN_H__
|
||||
#pragma once
|
||||
|
||||
#include "calls-call.h"
|
||||
#include "util.h"
|
||||
@@ -35,31 +34,29 @@ G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_ORIGIN (calls_origin_get_type ())
|
||||
|
||||
G_DECLARE_INTERFACE (CallsOrigin, calls_origin, CALLS, ORIGIN, GObject);
|
||||
G_DECLARE_INTERFACE (CallsOrigin, calls_origin, CALLS, ORIGIN, GObject)
|
||||
|
||||
|
||||
struct _CallsOriginInterface
|
||||
{
|
||||
struct _CallsOriginInterface {
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
void (*dial) (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean (*supports_protocol) (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
void (*dial) (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean (*supports_protocol) (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
};
|
||||
|
||||
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
|
||||
|
||||
char * calls_origin_get_name (CallsOrigin *self);
|
||||
char * calls_origin_get_id (CallsOrigin *self);
|
||||
GList * calls_origin_get_calls (CallsOrigin *self);
|
||||
void calls_origin_foreach_call (CallsOrigin *self,
|
||||
CallsOriginForeachCallFunc callback,
|
||||
gpointer param);
|
||||
void calls_origin_dial (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean calls_origin_supports_protocol (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
char *calls_origin_get_name (CallsOrigin *self);
|
||||
char *calls_origin_get_id (CallsOrigin *self);
|
||||
GList *calls_origin_get_calls (CallsOrigin *self);
|
||||
void calls_origin_foreach_call (CallsOrigin *self,
|
||||
CallsOriginForeachCallFunc callback,
|
||||
gpointer param);
|
||||
void calls_origin_dial (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean calls_origin_supports_protocol (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* CALLS_ORIGIN_H__ */
|
||||
|
||||
@@ -40,26 +40,25 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_DERIVABLE_TYPE (CallsProvider, calls_provider, CALLS, PROVIDER, GObject)
|
||||
|
||||
|
||||
struct _CallsProviderClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
struct _CallsProviderClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
const char *(*get_name) (CallsProvider *self);
|
||||
const char *(*get_status) (CallsProvider *self);
|
||||
GListModel *(*get_origins) (CallsProvider *self);
|
||||
const char * const *(*get_protocols) (CallsProvider *self);
|
||||
gboolean (*is_modem) (CallsProvider *self);
|
||||
gboolean (*is_operational) (CallsProvider *self);
|
||||
const char *(*get_name) (CallsProvider *self);
|
||||
const char *(*get_status) (CallsProvider *self);
|
||||
GListModel *(*get_origins) (CallsProvider *self);
|
||||
const char *const *(*get_protocols) (CallsProvider *self);
|
||||
gboolean (*is_modem) (CallsProvider *self);
|
||||
gboolean (*is_operational) (CallsProvider *self);
|
||||
};
|
||||
|
||||
const char *calls_provider_get_name (CallsProvider *self);
|
||||
const char *calls_provider_get_status (CallsProvider *self);
|
||||
GListModel *calls_provider_get_origins (CallsProvider *self);
|
||||
CallsProvider *calls_provider_load_plugin (const char *name);
|
||||
void calls_provider_unload_plugin (const char *name);
|
||||
const char * const *calls_provider_get_protocols (CallsProvider *self);
|
||||
gboolean calls_provider_is_modem (CallsProvider *self);
|
||||
gboolean calls_provider_is_operational (CallsProvider *self);
|
||||
const char *calls_provider_get_name (CallsProvider *self);
|
||||
const char *calls_provider_get_status (CallsProvider *self);
|
||||
GListModel *calls_provider_get_origins (CallsProvider *self);
|
||||
CallsProvider *calls_provider_load_plugin (const char *name);
|
||||
void calls_provider_unload_plugin (const char *name);
|
||||
const char *const *calls_provider_get_protocols (CallsProvider *self);
|
||||
gboolean calls_provider_is_modem (CallsProvider *self);
|
||||
gboolean calls_provider_is_operational (CallsProvider *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -75,13 +75,12 @@ state_to_record_state (CuiCallState call_state)
|
||||
}
|
||||
|
||||
|
||||
struct _CallsRecordStore
|
||||
{
|
||||
struct _CallsRecordStore {
|
||||
GtkApplicationWindow parent_instance;
|
||||
|
||||
gchar *filename;
|
||||
GomAdapter *adapter;
|
||||
GomRepository *repository;
|
||||
gchar *filename;
|
||||
GomAdapter *adapter;
|
||||
GomRepository *repository;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsRecordStore, calls_record_store, G_TYPE_LIST_STORE);
|
||||
@@ -124,8 +123,8 @@ delete_record_cb (GomResource *resource,
|
||||
|
||||
|
||||
static void
|
||||
delete_call_cb (CallsCallRecord *record,
|
||||
CallsRecordStore *self)
|
||||
delete_call_cb (CallsCallRecord *record,
|
||||
CallsRecordStore *self)
|
||||
{
|
||||
gom_resource_delete_async (GOM_RESOURCE (record),
|
||||
(GAsyncReadyCallback) delete_record_cb,
|
||||
@@ -138,8 +137,8 @@ load_calls_fetch_cb (GomResourceGroup *group,
|
||||
GAsyncResult *res,
|
||||
CallsRecordStore *self)
|
||||
{
|
||||
gboolean ok;
|
||||
g_autoptr (GError) error = NULL;
|
||||
gboolean ok;
|
||||
guint count, i;
|
||||
gpointer *records;
|
||||
|
||||
@@ -191,8 +190,8 @@ load_calls_find_cb (GomRepository *repository,
|
||||
GAsyncResult *res,
|
||||
CallsRecordStore *self)
|
||||
{
|
||||
GomResourceGroup *group;
|
||||
g_autoptr (GError) error = NULL;
|
||||
GomResourceGroup *group;
|
||||
guint count;
|
||||
|
||||
group = gom_repository_find_finish (repository,
|
||||
@@ -214,12 +213,11 @@ load_calls_find_cb (GomRepository *repository,
|
||||
|
||||
g_debug ("Found %u call records in database `%s', fetching",
|
||||
count, self->filename);
|
||||
gom_resource_group_fetch_async
|
||||
(group,
|
||||
0,
|
||||
count,
|
||||
(GAsyncReadyCallback)load_calls_fetch_cb,
|
||||
self);
|
||||
gom_resource_group_fetch_async (group,
|
||||
0,
|
||||
count,
|
||||
(GAsyncReadyCallback) load_calls_fetch_cb,
|
||||
self);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +228,7 @@ load_calls (CallsRecordStore *self)
|
||||
GomSorting *sorting;
|
||||
|
||||
filter = gom_filter_new_is_not_null
|
||||
(CALLS_TYPE_CALL_RECORD, "start");
|
||||
(CALLS_TYPE_CALL_RECORD, "start");
|
||||
|
||||
sorting = gom_sorting_new (CALLS_TYPE_CALL_RECORD,
|
||||
"start",
|
||||
@@ -243,7 +241,7 @@ load_calls (CallsRecordStore *self)
|
||||
CALLS_TYPE_CALL_RECORD,
|
||||
filter,
|
||||
sorting,
|
||||
(GAsyncReadyCallback)load_calls_find_cb,
|
||||
(GAsyncReadyCallback) load_calls_find_cb,
|
||||
self);
|
||||
|
||||
g_object_unref (G_OBJECT (filter));
|
||||
@@ -251,8 +249,8 @@ load_calls (CallsRecordStore *self)
|
||||
|
||||
|
||||
static void
|
||||
set_up_repo_migrate_cb (GomRepository *repo,
|
||||
GAsyncResult *res,
|
||||
set_up_repo_migrate_cb (GomRepository *repo,
|
||||
GAsyncResult *res,
|
||||
CallsRecordStore *self)
|
||||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
@@ -260,17 +258,17 @@ set_up_repo_migrate_cb (GomRepository *repo,
|
||||
|
||||
ok = gom_repository_automatic_migrate_finish (repo, res, &error);
|
||||
if (!ok) {
|
||||
if (error)
|
||||
g_warning ("Error migrating call record database `%s': %s",
|
||||
self->filename, error->message);
|
||||
else
|
||||
g_warning ("Unknown error migrating call record database `%s'",
|
||||
self->filename);
|
||||
if (error)
|
||||
g_warning ("Error migrating call record database `%s': %s",
|
||||
self->filename, error->message);
|
||||
else
|
||||
g_warning ("Unknown error migrating call record database `%s'",
|
||||
self->filename);
|
||||
|
||||
g_clear_object (&self->repository);
|
||||
g_clear_object (&self->adapter);
|
||||
g_clear_object (&self->repository);
|
||||
g_clear_object (&self->adapter);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
g_debug ("Successfully migrated call record database `%s'",
|
||||
self->filename);
|
||||
load_calls (self);
|
||||
@@ -296,13 +294,13 @@ set_up_repo (CallsRecordStore *self)
|
||||
g_debug ("Attempting migration of call"
|
||||
" record database `%s'",
|
||||
self->filename);
|
||||
types = g_list_append (types, (gpointer)CALLS_TYPE_CALL_RECORD);
|
||||
types = g_list_append (types, (gpointer) CALLS_TYPE_CALL_RECORD);
|
||||
gom_repository_automatic_migrate_async
|
||||
(repo,
|
||||
RECORD_STORE_VERSION,
|
||||
types,
|
||||
(GAsyncReadyCallback)set_up_repo_migrate_cb,
|
||||
self);
|
||||
RECORD_STORE_VERSION,
|
||||
types,
|
||||
(GAsyncReadyCallback) set_up_repo_migrate_cb,
|
||||
self);
|
||||
|
||||
self->repository = repo;
|
||||
}
|
||||
@@ -314,28 +312,27 @@ close_adapter (CallsRecordStore *self)
|
||||
g_autoptr (GError) error = NULL;
|
||||
gboolean ok;
|
||||
|
||||
if (!self->adapter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!self->adapter) {
|
||||
return;
|
||||
}
|
||||
|
||||
ok = gom_adapter_close_sync(self->adapter, &error);
|
||||
ok = gom_adapter_close_sync (self->adapter, &error);
|
||||
if (!ok) {
|
||||
if (error)
|
||||
g_warning ("Error closing call record database `%s': %s",
|
||||
self->filename, error->message);
|
||||
else
|
||||
g_warning ("Unknown error closing call record database `%s'",
|
||||
self->filename);
|
||||
}
|
||||
if (error)
|
||||
g_warning ("Error closing call record database `%s': %s",
|
||||
self->filename, error->message);
|
||||
else
|
||||
g_warning ("Unknown error closing call record database `%s'",
|
||||
self->filename);
|
||||
}
|
||||
|
||||
g_clear_object (&self->adapter);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
open_repo_adapter_open_cb (GomAdapter *adapter,
|
||||
GAsyncResult *res,
|
||||
open_repo_adapter_open_cb (GomAdapter *adapter,
|
||||
GAsyncResult *res,
|
||||
CallsRecordStore *self)
|
||||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
@@ -384,18 +381,17 @@ open_repo (CallsRecordStore *self)
|
||||
self->adapter = gom_adapter_new ();
|
||||
gom_adapter_open_async
|
||||
(self->adapter,
|
||||
uri,
|
||||
(GAsyncReadyCallback)open_repo_adapter_open_cb,
|
||||
self);
|
||||
uri,
|
||||
(GAsyncReadyCallback) open_repo_adapter_open_cb,
|
||||
self);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
||||
struct CallsRecordCallData
|
||||
{
|
||||
struct CallsRecordCallData {
|
||||
CallsRecordStore *self;
|
||||
CallsUiCallData *call;
|
||||
CallsUiCallData *call;
|
||||
};
|
||||
|
||||
|
||||
@@ -405,6 +401,7 @@ record_call_save_cb (GomResource *resource,
|
||||
struct CallsRecordCallData *data)
|
||||
{
|
||||
GObject * const call_obj = G_OBJECT (data->call);
|
||||
|
||||
g_autoptr (GError) error = NULL;
|
||||
gboolean ok;
|
||||
|
||||
@@ -469,7 +466,7 @@ record_call (CallsRecordStore *self,
|
||||
data->call = call;
|
||||
|
||||
gom_resource_save_async (GOM_RESOURCE (record),
|
||||
(GAsyncReadyCallback)record_call_save_cb,
|
||||
(GAsyncReadyCallback) record_call_save_cb,
|
||||
data);
|
||||
}
|
||||
|
||||
@@ -497,8 +494,8 @@ update_cb (GomResource *resource,
|
||||
|
||||
|
||||
static void
|
||||
stamp_call (CallsCallRecord *record,
|
||||
const gchar *stamp_name)
|
||||
stamp_call (CallsCallRecord *record,
|
||||
const gchar *stamp_name)
|
||||
{
|
||||
GObject *record_obj = G_OBJECT (record);
|
||||
GDateTime *stamp = NULL;
|
||||
@@ -519,7 +516,7 @@ stamp_call (CallsCallRecord *record,
|
||||
g_date_time_unref (stamp);
|
||||
|
||||
gom_resource_save_async (GOM_RESOURCE (record),
|
||||
(GAsyncReadyCallback)update_cb,
|
||||
(GAsyncReadyCallback) update_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -603,7 +600,7 @@ call_added_cb (CallsRecordStore *self,
|
||||
g_assert (g_object_get_data (call_obj, "calls-call-start") == NULL);
|
||||
start = g_date_time_new_now_utc ();
|
||||
g_object_set_data_full (call_obj, "calls-call-start",
|
||||
start, (GDestroyNotify)g_date_time_unref);
|
||||
start, (GDestroyNotify) g_date_time_unref);
|
||||
|
||||
if (!self->repository) {
|
||||
open_repo (self);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define LIBFEEDBACK_USE_UNSTABLE_API
|
||||
#include <libfeedback.h>
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_IS_RINGING,
|
||||
@@ -53,18 +54,20 @@ typedef enum {
|
||||
|
||||
|
||||
struct _CallsRinger {
|
||||
GObject parent_instance;
|
||||
GObject parent_instance;
|
||||
|
||||
GList *calls;
|
||||
LfbEvent *event;
|
||||
GCancellable *cancel_ring;
|
||||
GList *calls;
|
||||
LfbEvent *event;
|
||||
GCancellable *cancel_ring;
|
||||
CallsRingState state;
|
||||
|
||||
guint restart_id;
|
||||
gboolean is_quiet;
|
||||
guint restart_id;
|
||||
gboolean is_quiet;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT);
|
||||
|
||||
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT)
|
||||
|
||||
|
||||
static const char *
|
||||
ring_state_to_string (CallsRingState state)
|
||||
@@ -83,6 +86,7 @@ ring_state_to_string (CallsRingState state)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
change_ring_state (CallsRinger *self,
|
||||
CallsRingState state)
|
||||
@@ -114,21 +118,22 @@ on_event_triggered (LfbEvent *event,
|
||||
GAsyncResult *res,
|
||||
CallsRinger *self)
|
||||
{
|
||||
g_autoptr (GError) err = NULL;
|
||||
g_return_if_fail (LFB_IS_EVENT (event));
|
||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||
g_autoptr (GError) err = NULL;
|
||||
|
||||
g_debug ("%s", __func__);
|
||||
if (lfb_event_trigger_feedback_finish (event, res, &err)) {
|
||||
change_ring_state (self, CALLS_RING_STATE_PLAYING);
|
||||
} else {
|
||||
if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_warning ("Failed to trigger feedback for '%s': %s",
|
||||
lfb_event_get_event (event), err->message);
|
||||
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
||||
}
|
||||
g_return_if_fail (LFB_IS_EVENT (event));
|
||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||
|
||||
g_object_unref (self);
|
||||
g_debug ("%s", __func__);
|
||||
if (lfb_event_trigger_feedback_finish (event, res, &err)) {
|
||||
change_ring_state (self, CALLS_RING_STATE_PLAYING);
|
||||
} else {
|
||||
if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
g_warning ("Failed to trigger feedback for '%s': %s",
|
||||
lfb_event_get_event (event), err->message);
|
||||
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
||||
}
|
||||
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,22 +175,22 @@ on_event_feedback_ended (LfbEvent *event,
|
||||
GAsyncResult *res,
|
||||
CallsRinger *self)
|
||||
{
|
||||
g_autoptr (GError) err = NULL;
|
||||
g_autoptr (GError) err = NULL;
|
||||
|
||||
g_return_if_fail (LFB_IS_EVENT (event));
|
||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||
g_return_if_fail (LFB_IS_EVENT (event));
|
||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||
|
||||
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||
|
||||
if (self->state == CALLS_RING_STATE_REQUEST_PLAY ||
|
||||
self->state == CALLS_RING_STATE_PLAYING)
|
||||
g_warning ("Feedback ended although it should be playing");
|
||||
if (self->state == CALLS_RING_STATE_REQUEST_PLAY ||
|
||||
self->state == CALLS_RING_STATE_PLAYING)
|
||||
g_warning ("Feedback ended although it should be playing");
|
||||
|
||||
if (!lfb_event_end_feedback_finish (event, res, &err))
|
||||
g_warning ("Failed to end feedback for '%s': %s",
|
||||
lfb_event_get_event (event), err->message);
|
||||
if (!lfb_event_end_feedback_finish (event, res, &err))
|
||||
g_warning ("Failed to end feedback for '%s': %s",
|
||||
lfb_event_get_event (event), err->message);
|
||||
|
||||
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
||||
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +532,7 @@ calls_ringer_get_is_ringing (CallsRinger *self)
|
||||
g_return_val_if_fail (CALLS_IS_RINGER (self), FALSE);
|
||||
|
||||
return self->state == CALLS_RING_STATE_PLAYING ||
|
||||
self->state == CALLS_RING_STATE_REQUEST_STOP;
|
||||
self->state == CALLS_RING_STATE_REQUEST_STOP;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALLS_RINGER_H__
|
||||
#define CALLS_RINGER_H__
|
||||
#pragma once
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
@@ -31,13 +30,11 @@ G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_RINGER (calls_ringer_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsRinger, calls_ringer, CALLS, RINGER, GObject);
|
||||
G_DECLARE_FINAL_TYPE (CallsRinger, calls_ringer, CALLS, RINGER, GObject)
|
||||
|
||||
|
||||
CallsRinger *calls_ringer_new (void);
|
||||
gboolean calls_ringer_get_is_ringing (CallsRinger *self);
|
||||
gboolean calls_ringer_get_ring_is_quiet (CallsRinger *self);
|
||||
CallsRinger *calls_ringer_new (void);
|
||||
gboolean calls_ringer_get_is_ringing (CallsRinger *self);
|
||||
gboolean calls_ringer_get_ring_is_quiet (CallsRinger *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* CALLS_RINGER_H__ */
|
||||
|
||||
@@ -33,4 +33,3 @@
|
||||
const SecretSchema *calls_secret_get_schema (void) G_GNUC_CONST;
|
||||
|
||||
#define CALLS_SECRET_SCHEMA calls_secret_get_schema ()
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ enum {
|
||||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
||||
struct _CallsSettings {
|
||||
GObject parent_instance;
|
||||
GObject parent_instance;
|
||||
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
@@ -33,18 +33,17 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (CallsSettings, calls_settings, CALLS, SETTINGS, GObject)
|
||||
|
||||
CallsSettings *calls_settings_new (void);
|
||||
gboolean calls_settings_get_use_default_origins (CallsSettings *self);
|
||||
void calls_settings_set_use_default_origins (CallsSettings *self,
|
||||
gboolean enable);
|
||||
char *calls_settings_get_country_code (CallsSettings *self);
|
||||
void calls_settings_set_country_code (CallsSettings *self,
|
||||
const char *country_code);
|
||||
char **calls_settings_get_autoload_plugins (CallsSettings *self);
|
||||
void calls_settings_set_autoload_plugins (CallsSettings *self,
|
||||
const char * const *plugins);
|
||||
char **calls_settings_get_preferred_audio_codecs (CallsSettings *self);
|
||||
void calls_settings_set_preferred_audio_codecs (CallsSettings *self,
|
||||
const char * const *codecs);
|
||||
gboolean calls_settings_get_use_default_origins (CallsSettings *self);
|
||||
void calls_settings_set_use_default_origins (CallsSettings *self,
|
||||
gboolean enable);
|
||||
char *calls_settings_get_country_code (CallsSettings *self);
|
||||
void calls_settings_set_country_code (CallsSettings *self,
|
||||
const char *country_code);
|
||||
char **calls_settings_get_autoload_plugins (CallsSettings *self);
|
||||
void calls_settings_set_autoload_plugins (CallsSettings *self,
|
||||
const char * const *plugins);
|
||||
char **calls_settings_get_preferred_audio_codecs (CallsSettings *self);
|
||||
void calls_settings_set_preferred_audio_codecs (CallsSettings *self,
|
||||
const char * const *codecs);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -55,23 +55,22 @@ enum {
|
||||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
static guint signals[N_SIGNALS];
|
||||
|
||||
struct _CallsUiCallData
|
||||
{
|
||||
GObject parent_instance;
|
||||
struct _CallsUiCallData {
|
||||
GObject parent_instance;
|
||||
|
||||
CallsCall *call;
|
||||
CallsCall *call;
|
||||
CallsBestMatch *best_match;
|
||||
|
||||
GTimer *timer;
|
||||
gdouble active_time;
|
||||
guint timer_id;
|
||||
GTimer *timer;
|
||||
gdouble active_time;
|
||||
guint timer_id;
|
||||
|
||||
CuiCallState state;
|
||||
char *origin_id;
|
||||
gboolean silenced;
|
||||
CuiCallState state;
|
||||
char *origin_id;
|
||||
gboolean silenced;
|
||||
|
||||
gboolean ui_active; /* whether a UI should be shown (or the ringer should ring) */
|
||||
guint set_active_id;
|
||||
gboolean ui_active; /* whether a UI should be shown (or the ringer should ring) */
|
||||
guint set_active_id;
|
||||
};
|
||||
|
||||
static void calls_ui_call_data_cui_call_interface_init (CuiCallInterface *iface);
|
||||
@@ -282,6 +281,7 @@ static void
|
||||
on_notify_state (CallsUiCallData *self)
|
||||
{
|
||||
CallsCallState state;
|
||||
|
||||
g_assert (CALLS_IS_UI_CALL_DATA (self));
|
||||
|
||||
state = calls_call_get_state (self->call);
|
||||
@@ -725,6 +725,7 @@ char *
|
||||
calls_ui_call_data_dup_origin_name (CallsUiCallData *self)
|
||||
{
|
||||
CallsOrigin *origin;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), NULL);
|
||||
|
||||
origin = calls_manager_get_origin_by_id (calls_manager_get_default (),
|
||||
|
||||
@@ -37,13 +37,13 @@ G_DECLARE_FINAL_TYPE (CallsUiCallData, calls_ui_call_data, CALLS, UI_CALL_DATA,
|
||||
|
||||
CallsUiCallData *calls_ui_call_data_new (CallsCall *call,
|
||||
const char *origin_id);
|
||||
void calls_ui_call_data_silence_ring (CallsUiCallData *self);
|
||||
gboolean calls_ui_call_data_get_silenced (CallsUiCallData *self);
|
||||
gboolean calls_ui_call_data_get_ui_active (CallsUiCallData *self);
|
||||
CallsCallType calls_ui_call_data_get_call_type (CallsUiCallData *self);
|
||||
const char *calls_ui_call_data_get_origin_id (CallsUiCallData *self);
|
||||
char *calls_ui_call_data_dup_origin_name (CallsUiCallData *self);
|
||||
void calls_ui_call_data_silence_ring (CallsUiCallData *self);
|
||||
gboolean calls_ui_call_data_get_silenced (CallsUiCallData *self);
|
||||
gboolean calls_ui_call_data_get_ui_active (CallsUiCallData *self);
|
||||
CallsCallType calls_ui_call_data_get_call_type (CallsUiCallData *self);
|
||||
const char *calls_ui_call_data_get_origin_id (CallsUiCallData *self);
|
||||
char *calls_ui_call_data_dup_origin_name (CallsUiCallData *self);
|
||||
|
||||
CuiCallState calls_call_state_to_cui_call_state (CallsCallState state);
|
||||
CuiCallState calls_call_state_to_cui_call_state (CallsCallState state);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -42,7 +42,7 @@ enum {
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals [N_SIGNALS];
|
||||
static guint signals[N_SIGNALS];
|
||||
|
||||
static void
|
||||
calls_ussd_default_init (CallsUssdInterface *iface)
|
||||
@@ -107,11 +107,11 @@ calls_ussd_get_state (CallsUssd *self)
|
||||
}
|
||||
|
||||
void
|
||||
calls_ussd_initiate_async (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
calls_ussd_initiate_async (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
@@ -126,9 +126,9 @@ calls_ussd_initiate_async (CallsUssd *self,
|
||||
}
|
||||
|
||||
char *
|
||||
calls_ussd_initiate_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
calls_ussd_initiate_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
@@ -143,11 +143,11 @@ calls_ussd_initiate_finish (CallsUssd *self,
|
||||
}
|
||||
|
||||
void
|
||||
calls_ussd_respond_async (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
calls_ussd_respond_async (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
@@ -162,9 +162,9 @@ calls_ussd_respond_async (CallsUssd *self,
|
||||
}
|
||||
|
||||
char *
|
||||
calls_ussd_respond_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
calls_ussd_respond_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
@@ -179,10 +179,10 @@ calls_ussd_respond_finish (CallsUssd *self,
|
||||
}
|
||||
|
||||
void
|
||||
calls_ussd_cancel_async (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
calls_ussd_cancel_async (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
@@ -196,9 +196,9 @@ calls_ussd_cancel_async (CallsUssd *self,
|
||||
}
|
||||
|
||||
gboolean
|
||||
calls_ussd_cancel_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
calls_ussd_cancel_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
CallsUssdInterface *iface;
|
||||
|
||||
|
||||
@@ -40,61 +40,60 @@ typedef enum
|
||||
CALLS_USSD_STATE_USER_RESPONSE
|
||||
} CallsUssdState;
|
||||
|
||||
struct _CallsUssdInterface
|
||||
{
|
||||
struct _CallsUssdInterface {
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
CallsUssdState (*get_state) (CallsUssd *self);
|
||||
void (*initiate_async) (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *(*initiate_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void (*respond_async) (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *(*respond_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void (*cancel_async) (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*cancel_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
CallsUssdState (*get_state) (CallsUssd *self);
|
||||
void (*initiate_async) (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *(*initiate_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void (*respond_async) (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *(*respond_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void (*cancel_async) (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*cancel_finish) (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
|
||||
CallsUssdState calls_ussd_get_state (CallsUssd *self);
|
||||
void calls_ussd_initiate_async (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_ussd_initiate_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void calls_ussd_respond_async (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_ussd_respond_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void calls_ussd_cancel_async (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean calls_ussd_cancel_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
CallsUssdState calls_ussd_get_state (CallsUssd *self);
|
||||
void calls_ussd_initiate_async (CallsUssd *self,
|
||||
const char *command,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_ussd_initiate_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void calls_ussd_respond_async (CallsUssd *self,
|
||||
const char *response,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
char *calls_ussd_respond_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
void calls_ussd_cancel_async (CallsUssd *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean calls_ussd_cancel_finish (CallsUssd *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
31
src/util.c
31
src/util.c
@@ -28,19 +28,17 @@
|
||||
void
|
||||
calls_object_unref (gpointer object)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
g_object_unref (object);
|
||||
}
|
||||
if (object) {
|
||||
g_object_unref (object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gpointer needle;
|
||||
guint needle_column;
|
||||
typedef struct {
|
||||
gpointer needle;
|
||||
guint needle_column;
|
||||
GtkTreeIter *iter;
|
||||
gboolean found;
|
||||
gboolean found;
|
||||
} ListStoreFindData;
|
||||
|
||||
static gboolean
|
||||
@@ -55,20 +53,19 @@ list_store_find_foreach_cb (GtkTreeModel *model,
|
||||
gtk_tree_model_get (model, iter, find_data->needle_column,
|
||||
&value, -1);
|
||||
|
||||
if (value == find_data->needle)
|
||||
{
|
||||
*find_data->iter = *iter;
|
||||
return (find_data->found = TRUE);
|
||||
}
|
||||
if (value == find_data->needle) {
|
||||
*find_data->iter = *iter;
|
||||
return (find_data->found = TRUE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
calls_list_store_find (GtkListStore *store,
|
||||
gpointer needle,
|
||||
gint needle_column,
|
||||
GtkTreeIter *iter)
|
||||
gpointer needle,
|
||||
gint needle_column,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
ListStoreFindData find_data
|
||||
= { needle, needle_column, iter, FALSE };
|
||||
|
||||
45
src/util.h
45
src/util.h
@@ -111,40 +111,39 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
/** If the GObject object is non-NULL, unref it */
|
||||
void calls_object_unref (gpointer object);
|
||||
void calls_object_unref (gpointer object);
|
||||
|
||||
|
||||
/** Find a particular pointer value in a GtkListStore */
|
||||
gboolean
|
||||
calls_list_store_find (GtkListStore *store,
|
||||
gpointer needle,
|
||||
gint needle_column,
|
||||
GtkTreeIter *iter);
|
||||
calls_list_store_find (GtkListStore *store,
|
||||
gpointer needle,
|
||||
gint needle_column,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/** Append a single character to a GtkEntry's contents */
|
||||
void
|
||||
calls_entry_append (GtkEntry *entry,
|
||||
gchar character);
|
||||
calls_entry_append (GtkEntry *entry,
|
||||
gchar character);
|
||||
|
||||
|
||||
gboolean calls_date_time_is_same_day (GDateTime *a,
|
||||
GDateTime *b);
|
||||
gboolean calls_date_time_is_yesterday (GDateTime *now,
|
||||
GDateTime *t);
|
||||
gboolean calls_date_time_is_same_year (GDateTime *a,
|
||||
GDateTime *b);
|
||||
gboolean calls_number_is_ussd (const char *number);
|
||||
gboolean calls_date_time_is_same_day (GDateTime *a,
|
||||
GDateTime *b);
|
||||
gboolean calls_date_time_is_yesterday (GDateTime *now,
|
||||
GDateTime *t);
|
||||
gboolean calls_date_time_is_same_year (GDateTime *a,
|
||||
GDateTime *b);
|
||||
gboolean calls_number_is_ussd (const char *number);
|
||||
|
||||
gboolean calls_find_in_store (GListModel *list,
|
||||
gpointer item,
|
||||
guint *position);
|
||||
gboolean calls_find_in_store (GListModel *list,
|
||||
gpointer item,
|
||||
guint *position);
|
||||
|
||||
const char* get_protocol_from_address (const char *target);
|
||||
const char* get_protocol_from_address_with_fallback (const char *target);
|
||||
const char *get_protocol_from_address (const char *target);
|
||||
const char *get_protocol_from_address_with_fallback (const char *target);
|
||||
|
||||
gboolean dtmf_tone_key_is_valid (char key);
|
||||
const char *get_call_icon_symbolic_name (gboolean inbound,
|
||||
gboolean missed);
|
||||
gboolean dtmf_tone_key_is_valid (char key);
|
||||
const char *get_call_icon_symbolic_name (gboolean inbound,
|
||||
gboolean missed);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user