예제 #1
0
static void
preferences_languages_save (EmpathyPreferences *preferences)
{
	GtkTreeView       *view;
	GtkTreeModel      *model;

	gchar             *languages = NULL;

	view = GTK_TREE_VIEW (preferences->treeview_spell_checker);
	model = gtk_tree_view_get_model (view);

	gtk_tree_model_foreach (model,
				(GtkTreeModelForeachFunc) preferences_languages_save_foreach,
				&languages);

	/* if user selects no languages, we don't want spell check */
	empathy_conf_set_bool (empathy_conf_get (),
			       EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
			       languages != NULL);

	empathy_conf_set_string (empathy_conf_get (),
				 EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
				 languages ? languages : "");

	g_free (languages);
}
static void
preferences_setup_widgets (EmpathyPreferences *preferences)
{
	guint id;

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_SOUNDS_ENABLED,
					  preferences->checkbutton_sounds_enabled);
	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_SOUNDS_DISABLED_AWAY,
					  preferences->checkbutton_sounds_disabled_away);

	preferences_hookup_sensitivity (preferences,
					EMPATHY_PREFS_SOUNDS_ENABLED,
					preferences->checkbutton_sounds_disabled_away);
	preferences_hookup_sensitivity (preferences,
					EMPATHY_PREFS_SOUNDS_ENABLED,
					preferences->treeview_sounds);

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
					  preferences->checkbutton_separate_chat_windows);

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_UI_SHOW_AVATARS,
					  preferences->checkbutton_show_avatars);

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
					  preferences->checkbutton_compact_contact_list);

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
					  preferences->checkbutton_show_smileys);

	preferences_hookup_string_combo (preferences,
					 EMPATHY_PREFS_CHAT_THEME,
					 preferences->combobox_chat_theme);

	preferences_hookup_radio_button (preferences,
					 EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
					 preferences->radiobutton_contact_list_sort_by_name);

	preferences_hookup_toggle_button (preferences,
					  EMPATHY_PREFS_AUTOCONNECT,
					  preferences->checkbutton_autoconnect);

	id = empathy_conf_notify_add (empathy_conf_get (),
				      EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
				      preferences_compact_contact_list_changed_cb,
				      preferences);
	if (id) {
		preferences_add_id (preferences, id);
	}
	preferences_compact_contact_list_changed_cb (empathy_conf_get (),
						     EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
						     preferences);
}
예제 #3
0
EmpathyStatusIcon *
empathy_status_icon_new (GtkWindow *window, gboolean hide_contact_list)
{
	EmpathyStatusIconPriv *priv;
	EmpathyStatusIcon     *icon;
	gboolean               should_hide;
#ifdef HAVE_LIBINDICATE
	gboolean               use_libindicate;
#endif

	g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);

	icon = g_object_new (EMPATHY_TYPE_STATUS_ICON, NULL);
	priv = GET_PRIV (icon);

	priv->window = g_object_ref (window);
#ifdef HAVE_LIBINDICATE
	priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
	g_signal_connect (priv->indicator_manager, "server-activate",
			  G_CALLBACK (indicate_server_activate_cb),
			  icon);
#endif

	g_signal_connect_after (priv->window, "key-press-event",
			  G_CALLBACK (status_icon_key_press_event_cb),
			  icon);

	g_signal_connect (priv->window, "delete-event",
			  G_CALLBACK (status_icon_delete_event_cb),
			  icon);

	if (!hide_contact_list) {
		empathy_conf_get_bool (empathy_conf_get (),
				       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
			               &should_hide);
	} else {
		should_hide = TRUE;
	}

#ifdef HAVE_LIBINDICATE
	empathy_conf_get_bool (empathy_conf_get (),
			       EMPATHY_PREFS_UI_USE_LIBINDICATE,
		               &use_libindicate);
	status_icon_set_use_libindicate (icon, use_libindicate);
#endif

	if (gtk_window_is_active (priv->window) == should_hide) {
		status_icon_set_visibility (icon, !should_hide, FALSE);
	}

	return icon;
}
예제 #4
0
static void
empathy_status_icon_init (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon,
		EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv);

	icon->priv = priv;
	priv->icon = gtk_status_icon_new ();
	priv->account_manager = empathy_account_manager_dup_singleton ();
	priv->idle = empathy_idle_dup_singleton ();
	priv->event_manager = empathy_event_manager_dup_singleton ();

	g_signal_connect (priv->account_manager,
			  "account-connection-changed",
			  G_CALLBACK (status_icon_connection_changed_cb), icon);

	/* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
	empathy_conf_notify_add (empathy_conf_get (),
				 EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
				 status_icon_notify_visibility_cb,
				 icon);

#ifdef HAVE_LIBINDICATE
	empathy_conf_notify_add (empathy_conf_get (),
				 EMPATHY_PREFS_UI_USE_LIBINDICATE,
				 status_icon_notify_libindicate_cb,
				 icon);
#endif

	status_icon_create_menu (icon);
	status_icon_idle_notify_cb (icon);

	g_signal_connect_swapped (priv->idle, "notify",
				  G_CALLBACK (status_icon_idle_notify_cb),
				  icon);
	g_signal_connect (priv->event_manager, "event-added",
			  G_CALLBACK (status_icon_event_added_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-removed",
			  G_CALLBACK (status_icon_event_removed_cb),
			  icon);
	g_signal_connect (priv->event_manager, "event-updated",
			  G_CALLBACK (status_icon_event_updated_cb),
			  icon);
	g_signal_connect (priv->icon, "activate",
			  G_CALLBACK (status_icon_activate_cb),
			  icon);
	g_signal_connect (priv->icon, "popup-menu",
			  G_CALLBACK (status_icon_popup_menu_cb),
			  icon);
}
예제 #5
0
static void
main_window_view_sort_contacts_cb (GtkRadioAction    *action,
				   GtkRadioAction    *current,
				   EmpathyMainWindow *window)
{
	EmpathyContactListStoreSort value;
	GSList      *group;
	GType        type;
	GEnumClass  *enum_class;
	GEnumValue  *enum_value;

	value = gtk_radio_action_get_current_value (action);
	group = gtk_radio_action_get_group (action);

	/* Get string from index */
	type = empathy_contact_list_store_sort_get_type ();
	enum_class = G_ENUM_CLASS (g_type_class_peek (type));
	enum_value = g_enum_get_value (enum_class, g_slist_index (group, current));

	if (!enum_value) {
		g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioAction index:%d",
			   g_slist_index (group, action));
	} else {
		empathy_conf_set_string (empathy_conf_get (),
					 EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
					 enum_value->value_nick);
	}
	empathy_contact_list_store_set_sort_criterium (window->list_store, value);
}
예제 #6
0
static void
preferences_languages_load (EmpathyPreferences *preferences)
{
	GtkTreeView   *view;
	GtkTreeModel  *model;
	gchar         *value;
	gchar        **vlanguages;

	if (!empathy_conf_get_string (empathy_conf_get (),
				      EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
				      &value) || !value) {
		return;
	}

	vlanguages = g_strsplit (value, ",", -1);
	g_free (value);

	view = GTK_TREE_VIEW (preferences->treeview_spell_checker);
	model = gtk_tree_view_get_model (view);

	gtk_tree_model_foreach (model,
				(GtkTreeModelForeachFunc) preferences_languages_load_foreach,
				vlanguages);

	g_strfreev (vlanguages);
}
예제 #7
0
/* Returns the window to open a new tab in if there is only one window
 * visble, otherwise, returns NULL indicating that a new window should
 * be added.
 */
EmpathyChatWindow *
empathy_chat_window_get_default (void)
{
	GList    *l;
	gboolean  separate_windows = TRUE;

	empathy_conf_get_bool (empathy_conf_get (),
			      EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
			      &separate_windows);

	if (separate_windows) {
		/* Always create a new window */
		return NULL;
	}

	for (l = chat_windows; l; l = l->next) {
		EmpathyChatWindow *chat_window;
		GtkWidget         *dialog;

		chat_window = l->data;

		dialog = empathy_chat_window_get_dialog (chat_window);
		if (empathy_window_get_is_visible (GTK_WINDOW (GTK_WINDOW (dialog)))) {
			/* Found a visible window on this desktop */
			return chat_window;
		}
	}

	return NULL;
}
예제 #8
0
static void
status_icon_set_visibility (EmpathyStatusIcon *icon,
			    gboolean           visible,
			    gboolean           store)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);

	if (store) {
		empathy_conf_set_bool (empathy_conf_get (),
				       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, !visible);
	}

	if (!visible) {
		empathy_window_iconify (priv->window, priv->icon);
	} else {
		GList *accounts;
		GList *l;
		gboolean one_enabled = FALSE;

		empathy_window_present (GTK_WINDOW (priv->window), TRUE);

		/* Show the accounts dialog if there is no enabled accounts */
		accounts = empathy_account_manager_dup_accounts (priv->account_manager);
		for (l = accounts ; l != NULL ; l = g_list_next (l)) {
			one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data))
				|| one_enabled;
			g_object_unref (l->data);
		}
		g_list_free (accounts);
		if (!one_enabled) {
			DEBUG ("No enabled account, Showing account dialog");
			empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
		}
	}
}
static void
chat_text_view_finalize (GObject *object)
{
	EmpathyChatTextView     *view;
	EmpathyChatTextViewPriv *priv;
	
	view = EMPATHY_CHAT_TEXT_VIEW (object);
	priv = GET_PRIV (view);
	
	DEBUG ("%p", object);
	
	empathy_conf_notify_remove (empathy_conf_get (), priv->notify_system_fonts_id);
	
	if (priv->last_contact) {
		g_object_unref (priv->last_contact);
	}
	if (priv->scroll_time) {
		g_timer_destroy (priv->scroll_time);
	}
	if (priv->scroll_timeout) {
		g_source_remove (priv->scroll_timeout);
	}
	
	G_OBJECT_CLASS (empathy_chat_text_view_parent_class)->finalize (object);
}
예제 #10
0
static void
preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
{
	gchar *value;

	if (empathy_conf_get_string (empathy_conf_get (), key, &value) && value) {
		if (GTK_IS_ENTRY (widget)) {
			gtk_entry_set_text (GTK_ENTRY (widget), value);
		} else if (GTK_IS_RADIO_BUTTON (widget)) {
			if (strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) {
				GType        type;
				GEnumClass  *enum_class;
				GEnumValue  *enum_value;
				GSList      *list;
				GtkWidget   *toggle_widget;
				
				/* Get index from new string */
				type = empathy_contact_list_store_sort_get_type ();
				enum_class = G_ENUM_CLASS (g_type_class_peek (type));
				enum_value = g_enum_get_value_by_nick (enum_class, value);
				
				if (enum_value) { 
					list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
					toggle_widget = g_slist_nth_data (list, enum_value->value);
					gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_widget), TRUE);
				}
			} else {
				g_warning ("Unhandled key:'%s' just had string change", key);
			}
		}

		g_free (value);
	}
}
예제 #11
0
static void
chat_text_view_insert_text_with_emoticons (EmpathyChatTextView *view,
					   GtkTextIter         *iter,
					   const gchar         *str)
{
	EmpathyChatTextViewPriv *priv = GET_PRIV (view);
	gboolean                 use_smileys = FALSE;
	GSList                  *smileys, *l;

	empathy_conf_get_bool (empathy_conf_get (),
			       EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
			       &use_smileys);

	if (!use_smileys) {
		gtk_text_buffer_insert (priv->buffer, iter, str, -1);
		return;
	}

	smileys = empathy_smiley_manager_parse (priv->smiley_manager, str);
	for (l = smileys; l; l = l->next) {
		EmpathySmiley *smiley;

		smiley = l->data;
		if (smiley->pixbuf) {
			gtk_text_buffer_insert_pixbuf (priv->buffer, iter, smiley->pixbuf);
		} else {
			gtk_text_buffer_insert (priv->buffer, iter, smiley->str, -1);
		}
		empathy_smiley_free (smiley);
	}
	g_slist_free (smileys);
}
예제 #12
0
gboolean
empathy_notification_is_enabled (void)
{
	EmpathyConf *conf;
	gboolean res;

	conf = empathy_conf_get ();
	res = FALSE;

	empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, &res);

	if (!res) {
		return FALSE;
	}

	if (!empathy_check_available_state ()) {
		empathy_conf_get_bool (conf,
				       EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY,
				       &res);
		if (res) {
			return FALSE;
		}
	}

	return TRUE;
}
예제 #13
0
static void
avatar_chooser_response_cb (GtkWidget            *widget,
			    gint                  response,
			    EmpathyAvatarChooser *chooser)
{
	EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);

	priv->chooser_dialog = NULL;

	if (response == GTK_RESPONSE_OK) {
		gchar *filename;
		gchar *path;

		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
		avatar_chooser_set_image_from_file (chooser, filename);
		g_free (filename);

		path = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (widget));
		if (path) {
			empathy_conf_set_string (empathy_conf_get (),
						 EMPATHY_PREFS_UI_AVATAR_DIRECTORY,
						 path);
			g_free (path);
		}
	}
	else if (response == GTK_RESPONSE_NO) {
		/* This corresponds to "No Image", not to "Cancel" */
		avatar_chooser_clear_image (chooser);
	}

	gtk_widget_destroy (widget);
}
static void
preferences_sound_cell_toggled_cb (GtkCellRendererToggle *toggle,
				   char *path_string,
				   EmpathyPreferences *preferences)
{
	GtkTreePath *path;
	gboolean toggled, instore;
	GtkTreeIter iter;
	GtkTreeView *view;
	GtkTreeModel *model;
	char *key;

	view = GTK_TREE_VIEW (preferences->treeview_sounds);
	model = gtk_tree_view_get_model (view);

	path = gtk_tree_path_new_from_string (path_string);
	toggled = gtk_cell_renderer_toggle_get_active (toggle);

	gtk_tree_model_get_iter (model, &iter, path);
	gtk_tree_model_get (model, &iter, COL_SOUND_KEY, &key,
			    COL_SOUND_ENABLED, &instore, -1);

	instore ^= 1;

	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
			    COL_SOUND_ENABLED, instore, -1);

	empathy_conf_set_bool (empathy_conf_get (), key, instore);

	gtk_tree_path_free (path);
}
예제 #15
0
static void
preferences_hookup_string_combo (EmpathyPreferences *preferences,
				 const gchar       *key,
				 GtkWidget         *widget)
{
	guint id;

	preferences_widget_sync_string_combo (key, widget);

	g_object_set_data_full (G_OBJECT (widget), "key",
				g_strdup (key), g_free);

	g_signal_connect (widget,
			  "changed",
			  G_CALLBACK (preferences_string_combo_changed_cb),
			  NULL);

	id = empathy_conf_notify_add (empathy_conf_get (),
				      key,
				      preferences_notify_string_combo_cb,
				      widget);
	if (id) {
		preferences_add_id (preferences, id);
	}
}
예제 #16
0
static void
preferences_hookup_radio_button (EmpathyPreferences *preferences,
				 const gchar       *key,
				 GtkWidget         *widget)
{
	GSList *group, *l;
	guint   id;

	preferences_widget_sync_string (key, widget);

	group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
	for (l = group; l; l = l->next) {
		g_signal_connect (l->data,
				  "toggled",
				  G_CALLBACK (preferences_radio_button_toggled_cb),
				  NULL);

		g_object_set_data_full (G_OBJECT (l->data), "key",
					g_strdup (key), g_free);
	}

	id = empathy_conf_notify_add (empathy_conf_get (),
				     key,
				     preferences_notify_string_cb,
				     widget);
	if (id) {
		preferences_add_id (preferences, id);
	}
}
static void
status_icon_set_visibility (EmpathyStatusIcon *icon,
                            gboolean           visible,
                            gboolean           store)
{
    EmpathyStatusIconPriv *priv = GET_PRIV (icon);

    if (store) {
        empathy_conf_set_bool (empathy_conf_get (),
                               EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, !visible);
    }

    if (!visible) {
        empathy_window_iconify (priv->window, priv->icon);
    } else {
        GList *accounts;

        empathy_window_present (GTK_WINDOW (priv->window), TRUE);

        /* Show the accounts dialog if there is no enabled accounts */
        accounts = mc_accounts_list_by_enabled (TRUE);
        if (accounts) {
            mc_accounts_list_free (accounts);
        } else {
            DEBUG ("No enabled account, Showing account dialog");
            empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
        }
    }
}
예제 #18
0
static void
empathy_chat_text_view_init (EmpathyChatTextView *view)
{
	EmpathyChatTextViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (view,
		EMPATHY_TYPE_CHAT_TEXT_VIEW, EmpathyChatTextViewPriv);

	view->priv = priv;	
	priv->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
	priv->last_timestamp = 0;
	priv->allow_scrolling = TRUE;
	priv->smiley_manager = empathy_smiley_manager_dup_singleton ();
	
	g_object_set (view,
		      "wrap-mode", GTK_WRAP_WORD_CHAR,
		      "editable", FALSE,
		      "cursor-visible", FALSE,
		      NULL);
	
	priv->notify_system_fonts_id =
		empathy_conf_notify_add (empathy_conf_get (),
					 "/desktop/gnome/interface/document_font_name",
					 chat_text_view_notify_system_font_cb,
					 view);
	chat_text_view_system_font_update (view);
	chat_text_view_create_tags (view);

	g_signal_connect (view,
			  "populate-popup",
			  G_CALLBACK (chat_text_view_populate_popup),
			  NULL);
}
예제 #19
0
static void
spell_setup_languages (void)
{
	gchar  *str;

	if (!empathy_conf_notify_inited) {
		empathy_conf_notify_add (empathy_conf_get (),
					 EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
					 spell_notify_languages_cb, NULL);

		empathy_conf_notify_inited = TRUE;
	}

	if (languages) {
		return;
	}

	if (empathy_conf_get_string (empathy_conf_get (),
				     EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
				     &str) && str) {
		gchar **strv;
		gint    i;

		strv = g_strsplit (str, ",", -1);

		i = 0;
		while (strv && strv[i]) {
			SpellLanguage *lang;

			DEBUG ("Setting up language:'%s'", strv[i]);

			lang = g_slice_new0 (SpellLanguage);

			lang->config = enchant_broker_init ();
			lang->speller = enchant_broker_request_dict (lang->config, strv[i]);

			languages = g_list_append (languages, lang);
			i++;
		}

		if (strv) {
			g_strfreev (strv);
		}

		g_free (str);
	}
}
예제 #20
0
static void
preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
{
	gboolean value;

	if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
	}
}
예제 #21
0
static void
theme_boxes_finalize (GObject *object)
{
	EmpathyThemeBoxesPriv *priv = GET_PRIV (object);

	empathy_conf_notify_remove (empathy_conf_get (),
				    priv->notify_show_avatars_id);

	G_OBJECT_CLASS (empathy_theme_boxes_parent_class)->finalize (object);
}
예제 #22
0
/* Salut account creation. The TpAccountManager first argument
 * must already be prepared when calling this function. */
static gboolean
should_create_salut_account (TpAccountManager *manager)
{
  gboolean salut_created = FALSE;
  GList *accounts, *l;

  /* Check if we already created a salut account */
  empathy_conf_get_bool (empathy_conf_get (),
      EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
      &salut_created);

  if (salut_created)
    {
      DEBUG ("Gconf says we already created a salut account once");
      return FALSE;
    }

  accounts = tp_account_manager_get_valid_accounts (manager);

  for (l = accounts; l != NULL;  l = g_list_next (l))
    {
      TpAccount *account = TP_ACCOUNT (l->data);

      if (!tp_strdiff (tp_account_get_protocol (account), "local-xmpp"))
        {
          salut_created = TRUE;
          break;
        }
    }

  g_list_free (accounts);

  if (salut_created)
    {
      DEBUG ("Existing salut account already exists, flagging so in gconf");
      empathy_conf_set_bool (empathy_conf_get (),
          EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
          TRUE);
    }

  return !salut_created;
}
예제 #23
0
static void
preferences_widget_sync_int (const gchar *key, GtkWidget *widget)
{
	gint value;

	if (empathy_conf_get_int (empathy_conf_get (), key, &value)) {
		if (GTK_IS_SPIN_BUTTON (widget)) {
			gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
		}
	}
}
예제 #24
0
static void
preferences_hookup_sensitivity (EmpathyPreferences *preferences,
				const gchar       *key,
				GtkWidget         *widget)
{
	gboolean value;
	guint    id;

	if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
		gtk_widget_set_sensitive (widget, value);
	}

	id = empathy_conf_notify_add (empathy_conf_get (),
				      key,
				      preferences_notify_sensitivity_cb,
				      widget);
	if (id) {
		preferences_add_id (preferences, id);
	}
}
예제 #25
0
static void
preferences_entry_value_changed_cb (GtkWidget *entry,
				    gpointer   user_data)
{
	const gchar *key;

	key = g_object_get_data (G_OBJECT (entry), "key");

	empathy_conf_set_string (empathy_conf_get (),
				 key,
				 gtk_entry_get_text (GTK_ENTRY (entry)));
}
예제 #26
0
static void
preferences_spin_button_value_changed_cb (GtkWidget *button,
					  gpointer   user_data)
{
	const gchar *key;

	key = g_object_get_data (G_OBJECT (button), "key");

	empathy_conf_set_int (empathy_conf_get (),
			      key,
			      gtk_spin_button_get_value (GTK_SPIN_BUTTON (button)));
}
예제 #27
0
static void
preferences_toggle_button_toggled_cb (GtkWidget *button,
				      gpointer   user_data)
{
	const gchar *key;

	key = g_object_get_data (G_OBJECT (button), "key");

	empathy_conf_set_bool (empathy_conf_get (),
			       key,
			       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
예제 #28
0
static void
main_window_view_contacts_list_size_cb (GtkRadioAction    *action,
					GtkRadioAction    *current,
					EmpathyMainWindow *window)
{
	gint     value;

	value = gtk_radio_action_get_current_value (action);

	empathy_conf_set_bool (empathy_conf_get (),
			       EMPATHY_PREFS_UI_SHOW_AVATARS,
			       value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
	empathy_conf_set_bool (empathy_conf_get (),
			       EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
			       value == CONTACT_LIST_COMPACT_SIZE);

	empathy_contact_list_store_set_show_avatars (window->list_store,
						     value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
	empathy_contact_list_store_set_is_compact (window->list_store,
						   value == CONTACT_LIST_COMPACT_SIZE);
}
예제 #29
0
static void
preferences_compact_contact_list_changed_cb (EmpathyConf *conf,
					     const gchar *key,
					     gpointer     user_data)
{
	EmpathyPreferences *preferences = user_data;
	gboolean            value;

	if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
		gtk_widget_set_sensitive (preferences->checkbutton_show_avatars,
					  !value);
	}
}
예제 #30
0
static void
account_manager_ready_cb (GObject *source_object,
    GAsyncResult *result,
    gpointer user_data)
{
  TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
  GError *error = NULL;
  EmpathyIdle *idle;
  EmpathyConnectivity *connectivity;
  gboolean autoconnect = TRUE;

  if (!tp_account_manager_prepare_finish (manager, result, &error))
    {
      DEBUG ("Failed to prepare account manager: %s", error->message);
      g_error_free (error);
      return;
    }

  /* Autoconnect */
  idle = empathy_idle_dup_singleton ();
  connectivity = empathy_connectivity_dup_singleton ();

  empathy_conf_get_bool (empathy_conf_get (),
      EMPATHY_PREFS_AUTOCONNECT, &autoconnect);
  if (autoconnect && !no_connect &&
      tp_connection_presence_type_cmp_availability
          (empathy_idle_get_state (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
            <= 0)
      /* if current state is Offline, then put it online */
      empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);

  if (should_create_salut_account (manager)
      || !empathy_import_mc4_has_imported ())
    {
      EmpathyConnectionManagers *managers;
      managers = empathy_connection_managers_dup_singleton ();

      if (!check_connection_managers_ready (managers))
        {
          g_signal_connect (managers, "notify::ready",
            G_CALLBACK (connection_managers_ready_cb), NULL);
        }
    }
  else if (!start_hidden)
    {
      maybe_show_account_assistant ();
    }

  g_object_unref (idle);
  g_object_unref (connectivity);
}