Commit 1d6d2e1b authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Add skeleton for user switcher widget.

2007-10-02  William Jon McCann  <mccann@jhu.edu>

	* gui/simple-greeter/Makefile.am:
	* gui/simple-greeter/gdm-language-chooser-widget.c:
	* gui/simple-greeter/gdm-session-chooser-dialog.c:
	(gdm_session_chooser_dialog_init):
	* gui/simple-greeter/gdm-session-chooser-widget.c:
	* gui/simple-greeter/gdm-simple-greeter.c: (create_greeter):
	* gui/simple-greeter/gdm-user-chooser-dialog.c:
	(gdm_user_chooser_dialog_get_current_user_name),
	(gdm_user_chooser_dialog_set_property),
	(gdm_user_chooser_dialog_get_property),
	(gdm_user_chooser_dialog_constructor),
	(gdm_user_chooser_dialog_dispose),
	(gdm_user_chooser_dialog_class_init), (on_response),
	(gdm_user_chooser_dialog_init), (gdm_user_chooser_dialog_finalize),
	(gdm_user_chooser_dialog_new):
	* gui/simple-greeter/gdm-user-chooser-dialog.h:
	* gui/simple-greeter/gdm-user-chooser-widget.c:
	(chooser_user_free),
	(gdm_user_chooser_widget_get_current_user_name), (select_name),
	(gdm_user_chooser_widget_set_current_user_name),
	(gdm_user_chooser_widget_set_property),
	(gdm_user_chooser_widget_get_property),
	(gdm_user_chooser_widget_constructor),
	(gdm_user_chooser_widget_dispose),
	(gdm_user_chooser_widget_class_init), (on_selection_changed),
	(collect_users), (on_item_activated), (add_user_to_model),
	(get_pixbuf_for_user), (populate_model), (separator_func),
	(compare_user_names), (compare_user),
	(gdm_user_chooser_widget_init), (gdm_user_chooser_widget_finalize),
	(gdm_user_chooser_widget_new):
	* gui/simple-greeter/gdm-user-chooser-widget.h:
	* gui/simple-greeter/greeter-main.c: (activate_power_manager):
	* gui/simple-greeter/test-user-chooser.c: (main):
	Add skeleton for user switcher widget.


svn path=/branches/mccann-gobject/; revision=5326
parent c67fd11b
2007-10-02 William Jon McCann <mccann@jhu.edu>
* gui/simple-greeter/Makefile.am:
* gui/simple-greeter/gdm-language-chooser-widget.c:
* gui/simple-greeter/gdm-session-chooser-dialog.c:
(gdm_session_chooser_dialog_init):
* gui/simple-greeter/gdm-session-chooser-widget.c:
* gui/simple-greeter/gdm-simple-greeter.c: (create_greeter):
* gui/simple-greeter/gdm-user-chooser-dialog.c:
(gdm_user_chooser_dialog_get_current_user_name),
(gdm_user_chooser_dialog_set_property),
(gdm_user_chooser_dialog_get_property),
(gdm_user_chooser_dialog_constructor),
(gdm_user_chooser_dialog_dispose),
(gdm_user_chooser_dialog_class_init), (on_response),
(gdm_user_chooser_dialog_init), (gdm_user_chooser_dialog_finalize),
(gdm_user_chooser_dialog_new):
* gui/simple-greeter/gdm-user-chooser-dialog.h:
* gui/simple-greeter/gdm-user-chooser-widget.c:
(chooser_user_free),
(gdm_user_chooser_widget_get_current_user_name), (select_name),
(gdm_user_chooser_widget_set_current_user_name),
(gdm_user_chooser_widget_set_property),
(gdm_user_chooser_widget_get_property),
(gdm_user_chooser_widget_constructor),
(gdm_user_chooser_widget_dispose),
(gdm_user_chooser_widget_class_init), (on_selection_changed),
(collect_users), (on_item_activated), (add_user_to_model),
(get_pixbuf_for_user), (populate_model), (separator_func),
(compare_user_names), (compare_user),
(gdm_user_chooser_widget_init), (gdm_user_chooser_widget_finalize),
(gdm_user_chooser_widget_new):
* gui/simple-greeter/gdm-user-chooser-widget.h:
* gui/simple-greeter/greeter-main.c: (activate_power_manager):
* gui/simple-greeter/test-user-chooser.c: (main):
Add skeleton for user switcher widget.
2007-10-01 William Jon McCann <mccann@jhu.edu>
* gui/simple-greeter/gdm-session-chooser-widget.c:
......
......@@ -27,6 +27,7 @@ noinst_PROGRAMS = \
test-greeter-panel \
test-language-chooser \
test-session-chooser \
test-user-chooser \
$(NULL)
test_greeter_background_SOURCES = \
......@@ -76,6 +77,18 @@ test_session_chooser_LDADD = \
$(GUI_LIBS) \
$(NULL)
test_user_chooser_SOURCES = \
test-user-chooser.c \
gdm-user-chooser-widget.h \
gdm-user-chooser-widget.c \
gdm-user-chooser-dialog.h \
gdm-user-chooser-dialog.c \
$(NULL)
test_user_chooser_LDADD = \
$(GUI_LIBS) \
$(NULL)
libexec_PROGRAMS = \
gdm-simple-greeter
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 1998, 1999, 2000 Martin K, Petersen <mkp@mkp.net>
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
......
......@@ -154,7 +154,6 @@ gdm_session_chooser_dialog_init (GdmSessionChooserDialog *dialog)
dialog->priv = GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE (dialog);
dialog->priv->chooser_widget = gdm_session_chooser_widget_new ();
gdm_session_chooser_widget_set_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget), g_getenv ("LANG"));
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 1998, 1999, 2000 Martin K, Petersen <mkp@mkp.net>
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
......
......@@ -416,21 +416,21 @@ create_greeter (GdmSimpleGreeter *greeter)
#if 0
error = NULL;
g_spawn_command_line_async ("gtk-window-decorator", &error);
g_spawn_command_line_async ("gtk-window-decorator --replace", &error);
if (error != NULL) {
g_warning ("Error starting WM: %s", error->message);
g_error_free (error);
}
error = NULL;
g_spawn_command_line_async ("compiz", &error);
g_spawn_command_line_async ("compiz --replace", &error);
if (error != NULL) {
g_warning ("Error starting WM: %s", error->message);
g_error_free (error);
}
#else
error = NULL;
g_spawn_command_line_async ("metacity", &error);
g_spawn_command_line_async ("metacity --replace", &error);
if (error != NULL) {
g_warning ("Error starting WM: %s", error->message);
g_error_free (error);
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gdm-user-chooser-widget.h"
#include "gdm-user-chooser-dialog.h"
#define GDM_USER_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogPrivate))
struct GdmUserChooserDialogPrivate
{
GtkWidget *chooser_widget;
};
enum {
PROP_0,
};
static void gdm_user_chooser_dialog_class_init (GdmUserChooserDialogClass *klass);
static void gdm_user_chooser_dialog_init (GdmUserChooserDialog *user_chooser_dialog);
static void gdm_user_chooser_dialog_finalize (GObject *object);
G_DEFINE_TYPE (GdmUserChooserDialog, gdm_user_chooser_dialog, GTK_TYPE_DIALOG)
char *
gdm_user_chooser_dialog_get_current_user_name (GdmUserChooserDialog *dialog)
{
char *user_name;
g_return_val_if_fail (GDM_IS_USER_CHOOSER_DIALOG (dialog), NULL);
user_name = gdm_user_chooser_widget_get_current_user_name (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget));
return user_name;
}
static void
gdm_user_chooser_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdmUserChooserDialog *self;
self = GDM_USER_CHOOSER_DIALOG (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gdm_user_chooser_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdmUserChooserDialog *self;
self = GDM_USER_CHOOSER_DIALOG (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GObject *
gdm_user_chooser_dialog_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GdmUserChooserDialog *user_chooser_dialog;
GdmUserChooserDialogClass *klass;
klass = GDM_USER_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_USER_CHOOSER_DIALOG));
user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->constructor (type,
n_construct_properties,
construct_properties));
return G_OBJECT (user_chooser_dialog);
}
static void
gdm_user_chooser_dialog_dispose (GObject *object)
{
GdmUserChooserDialog *user_chooser_dialog;
user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (object);
G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->dispose (object);
}
static void
gdm_user_chooser_dialog_class_init (GdmUserChooserDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gdm_user_chooser_dialog_get_property;
object_class->set_property = gdm_user_chooser_dialog_set_property;
object_class->constructor = gdm_user_chooser_dialog_constructor;
object_class->dispose = gdm_user_chooser_dialog_dispose;
object_class->finalize = gdm_user_chooser_dialog_finalize;
g_type_class_add_private (klass, sizeof (GdmUserChooserDialogPrivate));
}
static void
on_response (GdmUserChooserDialog *dialog,
gint response_id)
{
switch (response_id) {
default:
break;
}
}
static void
gdm_user_chooser_dialog_init (GdmUserChooserDialog *dialog)
{
dialog->priv = GDM_USER_CHOOSER_DIALOG_GET_PRIVATE (dialog);
dialog->priv->chooser_widget = gdm_user_chooser_widget_new ();
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog,
"response",
G_CALLBACK (on_response),
dialog);
gtk_widget_show_all (GTK_WIDGET (dialog));
}
static void
gdm_user_chooser_dialog_finalize (GObject *object)
{
GdmUserChooserDialog *user_chooser_dialog;
g_return_if_fail (object != NULL);
g_return_if_fail (GDM_IS_USER_CHOOSER_DIALOG (object));
user_chooser_dialog = GDM_USER_CHOOSER_DIALOG (object);
g_return_if_fail (user_chooser_dialog->priv != NULL);
G_OBJECT_CLASS (gdm_user_chooser_dialog_parent_class)->finalize (object);
}
GtkWidget *
gdm_user_chooser_dialog_new (void)
{
GObject *object;
object = g_object_new (GDM_TYPE_USER_CHOOSER_DIALOG,
NULL);
return GTK_WIDGET (object);
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_USER_CHOOSER_DIALOG_H
#define __GDM_USER_CHOOSER_DIALOG_H
#include <glib-object.h>
#include <gtk/gtkdialog.h>
G_BEGIN_DECLS
#define GDM_TYPE_USER_CHOOSER_DIALOG (gdm_user_chooser_dialog_get_type ())
#define GDM_USER_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialog))
#define GDM_USER_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogClass))
#define GDM_IS_USER_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_CHOOSER_DIALOG))
#define GDM_IS_USER_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_CHOOSER_DIALOG))
#define GDM_USER_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_CHOOSER_DIALOG, GdmUserChooserDialogClass))
typedef struct GdmUserChooserDialogPrivate GdmUserChooserDialogPrivate;
typedef struct
{
GtkDialog parent;
GdmUserChooserDialogPrivate *priv;
} GdmUserChooserDialog;
typedef struct
{
GtkDialogClass parent_class;
} GdmUserChooserDialogClass;
GType gdm_user_chooser_dialog_get_type (void);
GtkWidget * gdm_user_chooser_dialog_new (void);
char * gdm_user_chooser_dialog_get_current_user_name (GdmUserChooserDialog *dialog);
G_END_DECLS
#endif /* __GDM_USER_CHOOSER_DIALOG_H */
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_USER_CHOOSER_WIDGET_H
#define __GDM_USER_CHOOSER_WIDGET_H
#include <glib-object.h>
#include <gtk/gtkvbox.h>
G_BEGIN_DECLS
#define GDM_TYPE_USER_CHOOSER_WIDGET (gdm_user_chooser_widget_get_type ())
#define GDM_USER_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidget))
#define GDM_USER_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetClass))
#define GDM_IS_USER_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_CHOOSER_WIDGET))
#define GDM_IS_USER_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_CHOOSER_WIDGET))
#define GDM_USER_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetClass))
typedef struct GdmUserChooserWidgetPrivate GdmUserChooserWidgetPrivate;
typedef struct
{
GtkVBox parent;
GdmUserChooserWidgetPrivate *priv;
} GdmUserChooserWidget;
typedef struct
{
GtkVBoxClass parent_class;
/* signals */
void (* user_activated) (GdmUserChooserWidget *widget);
} GdmUserChooserWidgetClass;
GType gdm_user_chooser_widget_get_type (void);
GtkWidget * gdm_user_chooser_widget_new (void);
char * gdm_user_chooser_widget_get_current_user_name (GdmUserChooserWidget *widget);
void gdm_user_chooser_widget_set_current_user_name (GdmUserChooserWidget *widget,
const char *user_name);
G_END_DECLS
#endif /* __GDM_USER_CHOOSER_WIDGET_H */
......@@ -337,7 +337,7 @@ activate_power_manager (void)
g_debug ("Activating power management");
error = NULL;
res = g_spawn_command_line_async ("gnome-power-manager --no-daemon --verbose", &error);
res = g_spawn_command_line_async ("gnome-power-manager --no-daemon", &error);
if (! res) {
g_warning ("Unable to activate power management: %s", error->message);
g_error_free (error);
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "gdm-user-chooser-dialog.h"
int
main (int argc, char *argv[])
{
GtkWidget *dialog;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
setlocale (LC_ALL, "");
gtk_init (&argc, &argv);
dialog = gdm_user_chooser_dialog_new ();
/*gtk_widget_set_size_request (dialog, 480, 128);*/
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
char *name;
name = gdm_user_chooser_dialog_get_current_user_name (GDM_USER_CHOOSER_DIALOG (dialog));
g_message ("User: %s", name ? name : "(null)");
g_free (name);
}
gtk_widget_destroy (dialog);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment