-#include <strings.h>
+/* testmultidisplay.c
+ * Copyright (C) 2001 Sun Microsystems Inc.
+ * Author: Erwann Chenede <erwann.chenede@sun.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
#include <gtk/gtk.h>
-#include <gtk/gtkstock.h>
-#include <gdk/gdk.h>
gchar *screen2_name = NULL;
{
if (response_id == GTK_RESPONSE_DELETE_EVENT)
return;
- if (screen2_name)
- g_free (screen2_name);
+ g_free (screen2_name);
screen2_name = g_strdup (gtk_entry_get_text (entry));
}
GtkWidget * other_entry)
{
GtkWidget *window, *vbox;
+ GtkWidget *content_area;
MyDoubleGtkEntry *double_entry = g_new (MyDoubleGtkEntry, 1);
double_entry->e1 = GTK_ENTRY (entry);
double_entry->e2 = GTK_ENTRY (other_entry);
if (!screen)
screen = gdk_screen_get_default ();
- window = gtk_widget_new (GTK_TYPE_DIALOG,
+ window = g_object_new (GTK_TYPE_DIALOG,
"screen", screen,
"user_data", NULL,
"type", GTK_WINDOW_TOPLEVEL,
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
- vbox = gtk_widget_new (GTK_TYPE_VBOX,
+ vbox = g_object_new (GTK_TYPE_BOX,
"border_width", 5,
+ "orientation", GTK_ORIENTATION_VERTICAL,
NULL);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
gtk_widget_grab_focus (entry);
{
GtkWidget *dialog, *display_entry, *dialog_label;
GtkWidget *entry, *entry2;
+ GtkWidget *content_area;
GdkDisplay *dpy2;
GdkScreen *scr2 = NULL; /* Quiet GCC */
gboolean correct_second_display = FALSE;
dialog_label =
gtk_label_new ("Please enter the name of\nthe second display\n");
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog_label);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
- display_entry);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
+ gtk_container_add (GTK_CONTAINER (content_area), display_entry);
g_signal_connect (dialog, "response",
G_CALLBACK (get_screen_response), display_entry);
gtk_widget_grab_focus (display_entry);
- gtk_widget_show_all (GTK_BIN (dialog)->child);
+ gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
while (!correct_second_display)
{
gtk_widget_destroy (dialog);
- entry = gtk_widget_new (GTK_TYPE_ENTRY,
+ entry = g_object_new (GTK_TYPE_ENTRY,
"activates_default", TRUE,
"visible", TRUE,
NULL);
- entry2 = gtk_widget_new (GTK_TYPE_ENTRY,
+ entry2 = g_object_new (GTK_TYPE_ENTRY,
"activates_default", TRUE,
"visible", TRUE,
NULL);