typedef struct {
EmpathyAccountSettings *settings;
- GtkWidget *table_common_settings;
+ GtkWidget *grid_common_settings;
GtkWidget *apply_button;
GtkWidget *cancel_button;
GtkWidget *entry_password;
static void
accounts_widget_generic_setup (EmpathyAccountWidget *self,
- GtkWidget *table_common_settings,
- GtkWidget *table_advanced_settings)
+ GtkWidget *grid_common_settings,
+ GtkWidget *grid_advanced_settings)
{
TpConnectionManagerParam *params, *param;
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ guint row_common = 0, row_advanced = 0;
params = empathy_account_settings_get_tp_params (priv->settings);
for (param = params; param != NULL && param->name != NULL; param++)
{
- GtkWidget *table_settings;
- guint n_rows = 0;
+ GtkWidget *grid_settings;
+ guint row;
GtkWidget *widget = NULL;
gchar *param_name_formatted;
if (param->flags & TP_CONN_MGR_PARAM_FLAG_REQUIRED)
- table_settings = table_common_settings;
+ {
+ grid_settings = grid_common_settings;
+ row = row_common++;
+ }
else if (priv->simple)
- return;
+ {
+ return;
+ }
else
- table_settings = table_advanced_settings;
+ {
+ grid_settings = grid_advanced_settings;
+ row = row_advanced++;
+ }
param_name_formatted = account_widget_generic_format_param_name
(param->name);
- g_object_get (table_settings, "n-rows", &n_rows, NULL);
- gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
if (param->dbus_signature[0] == 's')
{
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
g_free (str);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 1,
- n_rows - 1, n_rows,
- GTK_FILL, 0,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid_settings),
+ widget, 0, row, 1, 1);
+
gtk_widget_show (widget);
widget = gtk_entry_new ();
G_CALLBACK (gtk_widget_grab_focus),
NULL);
}
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 1, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
+
+ gtk_grid_attach (GTK_GRID (grid_settings),
+ widget, 1, row, 1, 1);
+
gtk_widget_show (widget);
}
/* int types: ynqiuxt. double type is 'd' */
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
g_free (str);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 1,
- n_rows - 1, n_rows,
- GTK_FILL, 0,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid_settings),
+ widget, 0, row, 1, 1);
gtk_widget_show (widget);
widget = gtk_spin_button_new_with_range (minint, maxint, step);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 1, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid_settings),
+ widget, 1, row, 1, 1);
gtk_widget_show (widget);
}
else if (param->dbus_signature[0] == 'b')
{
widget = gtk_check_button_new_with_label (param_name_formatted);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid_settings),
+ widget, 0, row, 2, 1);
gtk_widget_show (widget);
}
else
static void
account_widget_setup_generic (EmpathyAccountWidget *self)
{
- GtkWidget *table_common_settings;
- GtkWidget *table_advanced_settings;
+ GtkWidget *grid_common_settings;
+ GtkWidget *grid_advanced_settings;
- table_common_settings = GTK_WIDGET (gtk_builder_get_object
- (self->ui_details->gui, "table_common_settings"));
- table_advanced_settings = GTK_WIDGET (gtk_builder_get_object
- (self->ui_details->gui, "table_advanced_settings"));
+ grid_common_settings = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "grid_common_settings"));
+ grid_advanced_settings = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "grid_advanced_settings"));
- accounts_widget_generic_setup (self, table_common_settings,
- table_advanced_settings);
+ accounts_widget_generic_setup (self, grid_common_settings,
+ grid_advanced_settings);
g_object_unref (self->ui_details->gui);
}
GtkWidget *expander_advanced;
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_generic_settings", &self->ui_details->widget,
"expander_advanced_settings", &expander_advanced,
NULL);
static void
account_widget_launch_external_clicked (GtkWidget *button,
TpAccount *account)
+{
+ GdkAppLaunchContext *context = NULL;
+ GdkDisplay *display;
+ GAppInfo *app_info;
+ GError *error = NULL;
+
+ app_info = g_object_get_data (G_OBJECT (button), "app-info");
+
+ g_return_if_fail (G_IS_APP_INFO (app_info));
+
+ display = gdk_display_get_default ();
+ context = gdk_display_get_app_launch_context (display);
+
+ if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
+ &error))
+ {
+ g_critical ("Failed to bisho: %s", error->message);
+ g_clear_error (&error);
+ }
+}
+
+static void
+account_widget_launch_external_clicked_meego (GtkWidget *button,
+ TpAccount *account)
{
if (!tp_strdiff (tp_account_get_storage_provider (account),
"com.meego.libsocialweb"))
TpAccount *account = empathy_account_settings_get_account (settings);
GtkWidget *bar, *widget;
gchar *str;
+ const gchar *provider, *name = NULL;
+ GDesktopAppInfo *desktop_info = NULL;
- self->ui_details->widget = gtk_vbox_new (FALSE, 6);
- priv->table_common_settings = gtk_table_new (1, 2, FALSE);
+ self->ui_details->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ priv->grid_common_settings = gtk_grid_new ();
- if (!tp_strdiff (tp_account_get_storage_provider (account),
- "com.meego.libsocialweb"))
+ provider = tp_account_get_storage_provider (account);
+
+ if (!tp_strdiff (provider, "com.meego.libsocialweb"))
+ {
+ name = _("My Web Accounts");
+ }
+ else if (!tp_strdiff (provider, "org.gnome.OnlineAccounts"))
+ {
+ /* FIXME: we should publish the .desktop file in some general way */
+ desktop_info = g_desktop_app_info_new (
+ "gnome-online-accounts-panel.desktop");
+
+ if (desktop_info == NULL)
+ g_critical ("Could not locate 'gnome-online-accounts-panel.desktop'");
+ else
+ name = g_app_info_get_name (G_APP_INFO (desktop_info));
+ }
+
+ if (name != NULL)
{
- /* we know how to handle this external provider */
str = g_strdup_printf (
- _("The account %s is edited via My Web Accounts."),
- empathy_account_settings_get_display_name (settings));
+ _("The account %s is edited via %s."),
+ empathy_account_settings_get_display_name (settings), name);
}
else
{
widget);
gtk_container_set_border_width (GTK_CONTAINER (bar), 6);
- if (!tp_strdiff (tp_account_get_storage_provider (account),
- "com.meego.libsocialweb"))
+ if (!tp_strdiff (provider, "com.meego.libsocialweb"))
{
/* we know how to handle this external provider */
widget = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
_("Launch My Web Accounts"), RESPONSE_LAUNCH);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (account_widget_launch_external_clicked_meego), account);
+ }
+ else if (desktop_info != NULL)
+ {
+ /* general handler */
+ str = g_strdup_printf (_("Edit %s"), name);
+
+ widget = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
+ str, RESPONSE_LAUNCH);
+
+ g_object_set_data_full (G_OBJECT (widget), "app-info",
+ g_object_ref (desktop_info), g_object_unref);
+
g_signal_connect (widget, "clicked",
G_CALLBACK (account_widget_launch_external_clicked), account);
+
+ g_free (str);
}
gtk_box_pack_start (GTK_BOX (self->ui_details->widget), bar,
FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (self->ui_details->widget),
- priv->table_common_settings, FALSE, TRUE, 0);
+ priv->grid_common_settings, FALSE, TRUE, 0);
gtk_widget_show_all (self->ui_details->widget);
+
+ tp_clear_object (&desktop_info);
}
static void
GtkWidget *expander_advanced;
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_salut_settings", &self->ui_details->widget,
"expander_advanced_settings", &expander_advanced,
NULL);
else
{
priv->irc_network_chooser = empathy_account_widget_irc_build (self,
- filename, &priv->table_common_settings);
+ filename, &priv->grid_common_settings);
}
}
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
empathy_account_widget_sip_build (self, filename,
- &priv->table_common_settings);
+ &priv->grid_common_settings);
if (priv->simple)
{
else
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_msn_settings", &priv->table_common_settings,
+ "grid_common_msn_settings", &priv->grid_common_settings,
"vbox_msn_settings", &self->ui_details->widget,
NULL);
/* Full widget for XMPP, Google Talk and Facebook*/
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_jabber_settings", &self->ui_details->widget,
"spinbutton_port", &spinbutton_port,
"checkbutton_ssl", &checkbutton_ssl,
else
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_icq_settings", &self->ui_details->widget,
"spinbutton_port", &spinbutton_port,
NULL);
else
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_aim_settings", &self->ui_details->widget,
"spinbutton_port", &spinbutton_port,
NULL);
else
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_settings", &priv->table_common_settings,
+ "grid_common_settings", &priv->grid_common_settings,
"vbox_yahoo_settings", &self->ui_details->widget,
NULL);
else
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "table_common_groupwise_settings", &priv->table_common_settings,
+ "grid_common_groupwise_settings", &priv->grid_common_settings,
"vbox_groupwise_settings", &self->ui_details->widget,
NULL);
GError *error = NULL;
TpConnectionPresenceType state;
- if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ if (!tp_proxy_prepare_finish (account_manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
priv->account_manager = tp_account_manager_dup ();
g_object_ref (self);
- tp_account_manager_prepare_async (priv->account_manager, NULL,
+ tp_proxy_prepare_async (priv->account_manager, NULL,
account_manager_ready_cb, self);
/* handle apply and cancel button */
!(storage_restrictions &
TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS))
{
- GtkWidget *hbox = gtk_hbox_new (TRUE, 3);
+ GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
GtkWidget *image;
+ gtk_box_set_homogeneous (hbox, TRUE);
+
/* We can't use the stock button as its accelerator ('C') clashes with
* the Close button. */
priv->cancel_button = gtk_button_new ();
signals[HANDLE_APPLY] =
g_signal_new ("handle-apply", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_BOOLEAN);
signals[ACCOUNT_CREATED] =
g_signal_new ("account-created", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_OBJECT);
signals[CANCELLED] =
g_signal_new ("cancelled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
0);
default_display_name = g_strdup_printf (_("%1$s on %2$s"),
login_id, empathy_irc_network_get_name (network));
}
- else if (service == FACEBOOK_SERVICE)
+ else if (service == FACEBOOK_SERVICE && priv->jid_suffix != NULL)
{
gchar *tmp;