Commit 2650556c authored by Bastien Nocera's avatar Bastien Nocera

user-accounts: Remove dead code

That wasn't completely removed in:
parent 05dd38ce
......@@ -58,27 +58,6 @@ enum {
static void
cancel_language_dialog (GtkButton *button,
UmLanguageDialog *um)
if (um->force_setting)
um_user_set_language (um->user, um->language);
gtk_widget_hide (um->dialog);
um_language_dialog_set_user (um, NULL);
static void
accept_language_dialog (GtkButton *button,
UmLanguageDialog *um)
um_user_set_language (um->user, um->language);
gtk_widget_hide (um->dialog);
um_language_dialog_set_user (um, NULL);
gchar *
um_language_chooser_get_language (GtkWidget *chooser)
......@@ -159,14 +138,6 @@ um_get_iter_for_language (GtkTreeModel *model,
return FALSE;
static void
select_language (UmLanguageDialog *um,
const gchar *lang)
if (um->chooser)
gtk_widget_hide (um->chooser);
static void
row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
......@@ -396,160 +367,3 @@ um_language_chooser_new (void)
return chooser;
static void
language_combo_changed (GtkComboBox *combo,
UmLanguageDialog *um)
GtkTreeIter iter;
char *lang;
if (!gtk_combo_box_get_active_iter (combo, &iter))
gtk_tree_model_get (GTK_TREE_MODEL (um->dialog_store), &iter, LOCALE_COL, &lang, -1);
if (lang) {
g_free (um->language);
um->language = lang;
#if 0
if (!um->chooser)
setup_language_chooser (um);
gtk_window_present (GTK_WINDOW (um->chooser));
gtk_widget_grab_focus (um->chooser_list);
gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
UmLanguageDialog *
um_language_dialog_new (void)
GtkBuilder *builder;
GtkWidget *widget;
UmLanguageDialog *um;
const gchar *filename;
GtkListStore *store;
GError *error = NULL;
builder = gtk_builder_new ();
filename = UIDIR "/language-dialog.ui";
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
filename = "../data/language-dialog.ui";
if (!gtk_builder_add_from_file (builder, filename, &error)) {
g_error ("%s", error->message);
g_error_free (error);
return NULL;
um = g_new0 (UmLanguageDialog, 1);
widget = (GtkWidget *) gtk_builder_get_object (builder, "dialog");
g_signal_connect (widget, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
um->dialog = widget;
widget = (GtkWidget *) gtk_builder_get_object (builder, "cancel-button");
g_signal_connect (widget, "clicked",
G_CALLBACK (cancel_language_dialog), um);
widget = (GtkWidget *) gtk_builder_get_object (builder, "ok-button");
g_signal_connect (widget, "clicked",
G_CALLBACK (accept_language_dialog), um);
gtk_widget_grab_default (widget);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
sort_languages, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
um->dialog_store = store;
widget = (GtkWidget *) gtk_builder_get_object (builder, "language-combobox");
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
g_signal_connect (widget, "changed",
G_CALLBACK (language_combo_changed), um);
um->dialog_combo = widget;
um->user_icon = (GtkWidget *) gtk_builder_get_object (builder, "user-icon");
um->user_name = (GtkWidget *) gtk_builder_get_object (builder, "user-name");
return um;
um_language_dialog_free (UmLanguageDialog *um)
gtk_widget_destroy (um->dialog);
if (um->chooser)
gtk_widget_destroy (um->chooser);
g_free (um->language);
if (um->user)
g_object_unref (um->user);
g_free (um);
um_language_dialog_set_user (UmLanguageDialog *um,
UmUser *user)
GdkPixbuf *pixbuf;
const gchar *name;
if (um->user) {
g_object_unref (um->user);
um->user = NULL;
if (um->language) {
g_free (um->language);
um->language = NULL;
um->force_setting = FALSE;
um->user = user;
if (um->user) {
const gchar *language;
g_object_ref (user);
pixbuf = um_user_render_icon (user, FALSE, 48);
gtk_image_set_from_pixbuf (GTK_IMAGE (um->user_icon), pixbuf);
g_object_unref (pixbuf);
name = um_user_get_real_name (user);
gtk_label_set_label (GTK_LABEL (um->user_name), name);
um_add_user_languages (gtk_combo_box_get_model (GTK_COMBO_BOX (um->dialog_combo)));
language = um_user_get_language (user);
if (language) {
select_language (um, language);
} else if (um_user_get_uid (user) == getuid ()) {
gchar *lang;
lang = um_get_current_language ();
select_language (um, lang);
g_free (lang);
um->force_setting = TRUE;
um_language_dialog_show (UmLanguageDialog *um,
GtkWindow *parent)
gtk_window_set_transient_for (GTK_WINDOW (um->dialog), parent);
gtk_window_present (GTK_WINDOW (um->dialog));
gtk_widget_grab_focus (um->dialog_combo);
......@@ -29,12 +29,6 @@ G_BEGIN_DECLS
typedef struct _UmLanguageDialog UmLanguageDialog;
UmLanguageDialog *um_language_dialog_new (void);
void um_language_dialog_free (UmLanguageDialog *dialog);
void um_language_dialog_set_user (UmLanguageDialog *dialog,
UmUser *user);
void um_language_dialog_show (UmLanguageDialog *dialog,
GtkWindow *parent);
void um_add_user_languages (GtkTreeModel *model);
gchar *um_get_current_language (void);
gboolean um_get_iter_for_language (GtkTreeModel *model,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment