From 515b142b2ade6ba0c97f42cf17f0b5880306e613 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Thu, 30 Aug 2007 21:05:14 +0000 Subject: Add skeleton for chooser. 2007-08-30 William Jon McCann * configure.ac: * gui/Makefile.am: * gui/simple-chooser/Makefile.am: * gui/simple-chooser/chooser-main.c: (main): * gui/simple-chooser/gdm-host-chooser-dialog.c: (gdm_host_chooser_dialog_get_current_hostname), (gdm_host_chooser_dialog_set_property), (gdm_host_chooser_dialog_get_property), (gdm_host_chooser_dialog_constructor), (gdm_host_chooser_dialog_dispose), (gdm_host_chooser_dialog_class_init), (on_response), (gdm_host_chooser_dialog_init), (gdm_host_chooser_dialog_finalize), (gdm_host_chooser_dialog_new): * gui/simple-chooser/gdm-host-chooser-dialog.h: * gui/simple-chooser/gdm-host-chooser-widget.c: (gdm_host_chooser_widget_refresh), (gdm_host_chooser_widget_get_current_hostname), (gdm_host_chooser_widget_set_property), (gdm_host_chooser_widget_get_property), (gdm_host_chooser_widget_constructor), (gdm_host_chooser_widget_dispose), (gdm_host_chooser_widget_class_init), (on_row_activated), (gdm_host_chooser_widget_init), (gdm_host_chooser_widget_finalize), (gdm_host_chooser_widget_new): * gui/simple-chooser/gdm-host-chooser-widget.h: * libgreeter/gdm-greeter.h: Add skeleton for chooser. svn path=/branches/mccann-gobject/; revision=5205 --- gui/Makefile.am | 1 + gui/simple-chooser/Makefile.am | 40 +++++ gui/simple-chooser/chooser-main.c | 79 ++++++++++ gui/simple-chooser/gdm-host-chooser-dialog.c | 201 ++++++++++++++++++++++++ gui/simple-chooser/gdm-host-chooser-dialog.h | 57 +++++++ gui/simple-chooser/gdm-host-chooser-widget.c | 222 +++++++++++++++++++++++++++ gui/simple-chooser/gdm-host-chooser-widget.h | 62 ++++++++ 7 files changed, 662 insertions(+) create mode 100644 gui/simple-chooser/Makefile.am create mode 100644 gui/simple-chooser/chooser-main.c create mode 100644 gui/simple-chooser/gdm-host-chooser-dialog.c create mode 100644 gui/simple-chooser/gdm-host-chooser-dialog.h create mode 100644 gui/simple-chooser/gdm-host-chooser-widget.c create mode 100644 gui/simple-chooser/gdm-host-chooser-widget.h (limited to 'gui') diff --git a/gui/Makefile.am b/gui/Makefile.am index 5469b811..d141a30c 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -2,5 +2,6 @@ NULL = SUBDIRS = \ modules \ + simple-chooser \ simple-greeter \ $(NULL) diff --git a/gui/simple-chooser/Makefile.am b/gui/simple-chooser/Makefile.am new file mode 100644 index 00000000..8a51167f --- /dev/null +++ b/gui/simple-chooser/Makefile.am @@ -0,0 +1,40 @@ +NULL = + +INCLUDES = \ + -I$(top_srcdir)/common \ + -DAUTHDIR=\""$(authdir)"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DGDMCONFDIR=\"$(gdmconfdir)\" \ + -DDMCONFDIR=\""$(dmconfdir)"\" \ + -DGDMLOCALEDIR=\""$(gdmlocaledir)"\" \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DSBINDIR=\""$(sbindir)"\" \ + -DPIXMAPDIR=\""$(pixmapdir)"\" \ + $(GUI_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(CHOOSER_CFLAGS) \ + $(NULL) + +libexec_PROGRAMS = \ + gdm-simple-chooser + +gdm_simple_chooser_SOURCES = \ + chooser-main.c \ + gdm-host-chooser-widget.c \ + gdm-host-chooser-widget.h \ + gdm-host-chooser-dialog.c \ + gdm-host-chooser-dialog.h \ + $(NULL) + +gdm_simple_chooser_LDADD = \ + $(EXTRA_CHOOSER_LIBS) \ + $(GLIB_LIBS) \ + $(DBUS_LIBS) \ + $(GOBJECT_LIBS) \ + $(GUI_LIBS) \ + $(CHOOSER_LIBS) \ + $(NULL) + +EXTRA_DIST = \ + $(NULL) diff --git a/gui/simple-chooser/chooser-main.c b/gui/simple-chooser/chooser-main.c new file mode 100644 index 00000000..053121bb --- /dev/null +++ b/gui/simple-chooser/chooser-main.c @@ -0,0 +1,79 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#define DBUS_API_SUBJECT_TO_CHANGE +#include +#include + +#include "gdm-common.h" +#include "gdm-log.h" +#include "gdm-settings-client.h" +#include "gdm-settings-keys.h" + +#include "gdm-host-chooser-dialog.h" + +int +main (int argc, char *argv[]) +{ + GtkWidget *chooser; + + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + setlocale (LC_ALL, ""); + + g_type_init (); + + g_debug ("Chooser for display %s xauthority:%s", g_getenv ("DISPLAY"), g_getenv ("XAUTHORITY")); + + /* + * gdm_common_atspi_launch () needs gdk initialized. + * We cannot start gtk before the registry is running + * because the atk-bridge will crash. + */ + gdk_init (&argc, &argv); + /*gdm_common_atspi_launch ();*/ + gtk_init (&argc, &argv); + + chooser = gdm_host_chooser_dialog_new (); + if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT) { + char *hostname; + + hostname = gdm_host_chooser_dialog_get_current_hostname (GDM_HOST_CHOOSER_DIALOG (chooser)); + g_message ("Hostname: %s", hostname); + g_free (hostname); + } + + gtk_widget_destroy (chooser); + + return 0; +} diff --git a/gui/simple-chooser/gdm-host-chooser-dialog.c b/gui/simple-chooser/gdm-host-chooser-dialog.c new file mode 100644 index 00000000..69dbe1fd --- /dev/null +++ b/gui/simple-chooser/gdm-host-chooser-dialog.c @@ -0,0 +1,201 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include + +#include +#include +#include +#include + +#include "gdm-host-chooser-dialog.h" +#include "gdm-host-chooser-widget.h" + +#define GDM_HOST_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_HOST_CHOOSER_DIALOG, GdmHostChooserDialogPrivate)) + +struct GdmHostChooserDialogPrivate +{ + GtkWidget *chooser_widget; +}; + +enum { + PROP_0, +}; + +static void gdm_host_chooser_dialog_class_init (GdmHostChooserDialogClass *klass); +static void gdm_host_chooser_dialog_init (GdmHostChooserDialog *host_chooser_dialog); +static void gdm_host_chooser_dialog_finalize (GObject *object); + +G_DEFINE_TYPE (GdmHostChooserDialog, gdm_host_chooser_dialog, GTK_TYPE_DIALOG) + +char * +gdm_host_chooser_dialog_get_current_hostname (GdmHostChooserDialog *dialog) +{ + char *hostname; + + g_return_val_if_fail (GDM_IS_HOST_CHOOSER_DIALOG (dialog), NULL); + + hostname = gdm_host_chooser_widget_get_current_hostname (GDM_HOST_CHOOSER_WIDGET (dialog->priv->chooser_widget)); + + return hostname; +} +static void +gdm_host_chooser_dialog_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GdmHostChooserDialog *self; + + self = GDM_HOST_CHOOSER_DIALOG (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gdm_host_chooser_dialog_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GdmHostChooserDialog *self; + + self = GDM_HOST_CHOOSER_DIALOG (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gdm_host_chooser_dialog_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GdmHostChooserDialog *host_chooser_dialog; + GdmHostChooserDialogClass *klass; + + klass = GDM_HOST_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_HOST_CHOOSER_DIALOG)); + + host_chooser_dialog = GDM_HOST_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_host_chooser_dialog_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (host_chooser_dialog); +} + +static void +gdm_host_chooser_dialog_dispose (GObject *object) +{ + GdmHostChooserDialog *host_chooser_dialog; + + host_chooser_dialog = GDM_HOST_CHOOSER_DIALOG (object); + + g_debug ("Disposing host_chooser_dialog"); + + G_OBJECT_CLASS (gdm_host_chooser_dialog_parent_class)->dispose (object); +} + +static void +gdm_host_chooser_dialog_class_init (GdmHostChooserDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gdm_host_chooser_dialog_get_property; + object_class->set_property = gdm_host_chooser_dialog_set_property; + object_class->constructor = gdm_host_chooser_dialog_constructor; + object_class->dispose = gdm_host_chooser_dialog_dispose; + object_class->finalize = gdm_host_chooser_dialog_finalize; + + g_type_class_add_private (klass, sizeof (GdmHostChooserDialogPrivate)); +} + +static void +on_response (GdmHostChooserDialog *dialog, + gint response_id) +{ + switch (response_id) { + case GTK_RESPONSE_APPLY: + gdm_host_chooser_widget_refresh (dialog->priv->chooser_widget); + g_signal_stop_emission_by_name (dialog, "response"); + break; + default: + break; + } +} + +static void +gdm_host_chooser_dialog_init (GdmHostChooserDialog *dialog) +{ + + dialog->priv = GDM_HOST_CHOOSER_DIALOG_GET_PRIVATE (dialog); + + dialog->priv->chooser_widget = gdm_host_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_REFRESH, GTK_RESPONSE_APPLY, + 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_host_chooser_dialog_finalize (GObject *object) +{ + GdmHostChooserDialog *host_chooser_dialog; + + g_return_if_fail (object != NULL); + g_return_if_fail (GDM_IS_HOST_CHOOSER_DIALOG (object)); + + host_chooser_dialog = GDM_HOST_CHOOSER_DIALOG (object); + + g_return_if_fail (host_chooser_dialog->priv != NULL); + + G_OBJECT_CLASS (gdm_host_chooser_dialog_parent_class)->finalize (object); +} + +GtkWidget * +gdm_host_chooser_dialog_new (void) +{ + GObject *object; + + object = g_object_new (GDM_TYPE_HOST_CHOOSER_DIALOG, + NULL); + + return GTK_WIDGET (object); +} diff --git a/gui/simple-chooser/gdm-host-chooser-dialog.h b/gui/simple-chooser/gdm-host-chooser-dialog.h new file mode 100644 index 00000000..5ae53fd8 --- /dev/null +++ b/gui/simple-chooser/gdm-host-chooser-dialog.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_HOST_CHOOSER_DIALOG_H +#define __GDM_HOST_CHOOSER_DIALOG_H + +#include +#include + +G_BEGIN_DECLS + +#define GDM_TYPE_HOST_CHOOSER_DIALOG (gdm_host_chooser_dialog_get_type ()) +#define GDM_HOST_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_HOST_CHOOSER_DIALOG, GdmHostChooserDialog)) +#define GDM_HOST_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_HOST_CHOOSER_DIALOG, GdmHostChooserDialogClass)) +#define GDM_IS_HOST_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_HOST_CHOOSER_DIALOG)) +#define GDM_IS_HOST_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_HOST_CHOOSER_DIALOG)) +#define GDM_HOST_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_HOST_CHOOSER_DIALOG, GdmHostChooserDialogClass)) + +typedef struct GdmHostChooserDialogPrivate GdmHostChooserDialogPrivate; + +typedef struct +{ + GtkDialog parent; + GdmHostChooserDialogPrivate *priv; +} GdmHostChooserDialog; + +typedef struct +{ + GtkDialogClass parent_class; +} GdmHostChooserDialogClass; + +GType gdm_host_chooser_dialog_get_type (void); + +GtkWidget * gdm_host_chooser_dialog_new (void); + +char * gdm_host_chooser_dialog_get_current_hostname (GdmHostChooserDialog *dialog); + +G_END_DECLS + +#endif /* __GDM_HOST_CHOOSER_DIALOG_H */ diff --git a/gui/simple-chooser/gdm-host-chooser-widget.c b/gui/simple-chooser/gdm-host-chooser-widget.c new file mode 100644 index 00000000..9edcddb6 --- /dev/null +++ b/gui/simple-chooser/gdm-host-chooser-widget.c @@ -0,0 +1,222 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include + +#include +#include +#include +#include + +#include "gdm-host-chooser-widget.h" + +#define GDM_HOST_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_HOST_CHOOSER_WIDGET, GdmHostChooserWidgetPrivate)) + +struct GdmHostChooserWidgetPrivate +{ + GtkWidget *treeview; +}; + +enum { + PROP_0, +}; + +enum { + HOSTNAME_ACTIVATED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + + +static void gdm_host_chooser_widget_class_init (GdmHostChooserWidgetClass *klass); +static void gdm_host_chooser_widget_init (GdmHostChooserWidget *host_chooser_widget); +static void gdm_host_chooser_widget_finalize (GObject *object); + +G_DEFINE_TYPE (GdmHostChooserWidget, gdm_host_chooser_widget, GTK_TYPE_VBOX) + +void +gdm_host_chooser_widget_refresh (GdmHostChooserWidget *widget) +{ + g_return_if_fail (GDM_IS_HOST_CHOOSER_WIDGET (widget)); +} + +char * +gdm_host_chooser_widget_get_current_hostname (GdmHostChooserWidget *widget) +{ + char *hostname; + + g_return_val_if_fail (GDM_IS_HOST_CHOOSER_WIDGET (widget), NULL); + + hostname = NULL; + + return hostname; +} + +static void +gdm_host_chooser_widget_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GdmHostChooserWidget *self; + + self = GDM_HOST_CHOOSER_WIDGET (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gdm_host_chooser_widget_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GdmHostChooserWidget *self; + + self = GDM_HOST_CHOOSER_WIDGET (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gdm_host_chooser_widget_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GdmHostChooserWidget *host_chooser_widget; + GdmHostChooserWidgetClass *klass; + + klass = GDM_HOST_CHOOSER_WIDGET_CLASS (g_type_class_peek (GDM_TYPE_HOST_CHOOSER_WIDGET)); + + host_chooser_widget = GDM_HOST_CHOOSER_WIDGET (G_OBJECT_CLASS (gdm_host_chooser_widget_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (host_chooser_widget); +} + +static void +gdm_host_chooser_widget_dispose (GObject *object) +{ + GdmHostChooserWidget *host_chooser_widget; + + host_chooser_widget = GDM_HOST_CHOOSER_WIDGET (object); + + g_debug ("Disposing host_chooser_widget"); + + G_OBJECT_CLASS (gdm_host_chooser_widget_parent_class)->dispose (object); +} + +static void +gdm_host_chooser_widget_class_init (GdmHostChooserWidgetClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gdm_host_chooser_widget_get_property; + object_class->set_property = gdm_host_chooser_widget_set_property; + object_class->constructor = gdm_host_chooser_widget_constructor; + object_class->dispose = gdm_host_chooser_widget_dispose; + object_class->finalize = gdm_host_chooser_widget_finalize; + + signals [HOSTNAME_ACTIVATED] = g_signal_new ("hostname-activated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GdmHostChooserWidgetClass, hostname_activated), + NULL, + NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + g_type_class_add_private (klass, sizeof (GdmHostChooserWidgetPrivate)); +} + +static void +on_row_activated (GtkTreeView *tree_view, + GtkTreePath *tree_path, + GtkTreeViewColumn *tree_column, + GdmHostChooserWidget *widget) +{ +} + + +static void +gdm_host_chooser_widget_init (GdmHostChooserWidget *widget) +{ + GtkWidget *scrolled; + + widget->priv = GDM_HOST_CHOOSER_WIDGET_GET_PRIVATE (widget); + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), + GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0); + + widget->priv->treeview = gtk_tree_view_new (); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget->priv->treeview), FALSE); + g_signal_connect (widget->priv->treeview, + "row-activated", + G_CALLBACK (on_row_activated), + widget); + gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->treeview); + +} + +static void +gdm_host_chooser_widget_finalize (GObject *object) +{ + GdmHostChooserWidget *host_chooser_widget; + + g_return_if_fail (object != NULL); + g_return_if_fail (GDM_IS_HOST_CHOOSER_WIDGET (object)); + + host_chooser_widget = GDM_HOST_CHOOSER_WIDGET (object); + + g_return_if_fail (host_chooser_widget->priv != NULL); + + G_OBJECT_CLASS (gdm_host_chooser_widget_parent_class)->finalize (object); +} + +GtkWidget * +gdm_host_chooser_widget_new (void) +{ + GObject *object; + + object = g_object_new (GDM_TYPE_HOST_CHOOSER_WIDGET, + NULL); + + return GTK_WIDGET (object); +} diff --git a/gui/simple-chooser/gdm-host-chooser-widget.h b/gui/simple-chooser/gdm-host-chooser-widget.h new file mode 100644 index 00000000..7b74bef0 --- /dev/null +++ b/gui/simple-chooser/gdm-host-chooser-widget.h @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_HOST_CHOOSER_WIDGET_H +#define __GDM_HOST_CHOOSER_WIDGET_H + +#include +#include + +G_BEGIN_DECLS + +#define GDM_TYPE_HOST_CHOOSER_WIDGET (gdm_host_chooser_widget_get_type ()) +#define GDM_HOST_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_HOST_CHOOSER_WIDGET, GdmHostChooserWidget)) +#define GDM_HOST_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_HOST_CHOOSER_WIDGET, GdmHostChooserWidgetClass)) +#define GDM_IS_HOST_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_HOST_CHOOSER_WIDGET)) +#define GDM_IS_HOST_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_HOST_CHOOSER_WIDGET)) +#define GDM_HOST_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_HOST_CHOOSER_WIDGET, GdmHostChooserWidgetClass)) + +typedef struct GdmHostChooserWidgetPrivate GdmHostChooserWidgetPrivate; + +typedef struct +{ + GtkVBox parent; + GdmHostChooserWidgetPrivate *priv; +} GdmHostChooserWidget; + +typedef struct +{ + GtkVBoxClass parent_class; + + /* signals */ + void (* hostname_activated) (GdmHostChooserWidget *widget, + const char *hostname); +} GdmHostChooserWidgetClass; + +GType gdm_host_chooser_widget_get_type (void); +GtkWidget * gdm_host_chooser_widget_new (void); + +void gdm_host_chooser_widget_refresh (GdmHostChooserWidget *widget); + +char * gdm_host_chooser_widget_get_current_hostname (GdmHostChooserWidget *widget); + +G_END_DECLS + +#endif /* __GDM_HOST_CHOOSER_WIDGET_H */ -- cgit v1.2.1