[display] Remove libglade dependency from display-properties capplet

This commit is contained in:
Felix Riemann 2009-07-09 14:54:25 +02:00 committed by Rodrigo Moya
parent 7c20b2bc3a
commit 622a730e5c
5 changed files with 44 additions and 571 deletions

View file

@ -1,8 +1,8 @@
# This is used in GNOMECC_CAPPLETS_CFLAGS
cappletname = display
gladedir = $(pkgdatadir)/glade
dist_glade_DATA = display-capplet.glade
uidir = $(pkgdatadir)/ui
dist_ui_DATA = display-capplet.ui
bin_PROGRAMS = gnome-display-properties
@ -37,7 +37,7 @@ desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
INCLUDES = $(DISPLAY_CAPPLET_CFLAGS) \
$(GNOMECC_CAPPLETS_CFLAGS) \
-DGLADEDIR="\"$(gladedir)\"" \
-DUIDIR="\"$(uidir)\"" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""

View file

@ -1 +1 @@
gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0 libglade-2.0` -I../ ../randrwrap.c ../monitor-db.c xrandr-capplet.c ../edid-parse.c ../display-name.c scrollarea.c foo-marshal.c -o capplet
gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0` -I../ ../randrwrap.c ../monitor-db.c xrandr-capplet.c ../edid-parse.c ../display-name.c scrollarea.c foo-marshal.c -o capplet

View file

@ -1,541 +0,0 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Display Preferences</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="helpbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="apply_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-apply</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-10</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;Drag the monitors to set their place&lt;/i&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="align">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="clone_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Mirror screens</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="detect_displays_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Detect Monitors</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEventBox" id="current_monitor_event_box">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<child>
<widget class="GtkLabel" id="current_monitor_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Monitor&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">5</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkCheckButton" id="panel_checkbox">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Include _panel</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Resolution:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="mnemonic-widget">resolution_combo</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">Re_fresh rate:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="mnemonic-widget">refresh_combo</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">R_otation:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="mnemonic-widget">rotation_combo</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="resolution_combo">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="refresh_combo">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="rotation_combo">
<property name="visible">True</property>
<property name="items" translatable="yes">Normal
Left
Right
Upside-down
</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">3</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkRadioButton" id="monitor_on_radio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">On</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="monitor_off_radio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Off</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">monitor_on_radio</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">5</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Panel icon&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkCheckButton" id="show_notification_icon">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Show displays in panel</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -21,7 +21,6 @@
#include <config.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <string.h>
#include <stdlib.h>
#include "scrollarea.h"
@ -2110,38 +2109,47 @@ apply_button_clicked_cb (GtkButton *button, gpointer data)
app->apply_button_clicked_timestamp = gtk_get_current_event_time ();
}
static GtkWidget*
_gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
{
return GTK_WIDGET (gtk_builder_get_object (builder, name));
}
static void
run_application (App *app)
{
#ifndef GLADEDIR
#define GLADEDIR "."
#ifndef UIDIR
#define UIDIR "."
#endif
#define GLADE_FILE GLADEDIR "/display-capplet.glade"
GladeXML *xml;
#define UI_FILE UIDIR "/display-capplet.ui"
GtkBuilder *builder;
GtkWidget *align;
GError *error;
xml = glade_xml_new (GLADE_FILE, NULL, NULL);
if (!xml)
error = NULL;
builder = gtk_builder_new ();
if (gtk_builder_add_from_file (builder, UI_FILE, &error) == 0)
{
g_warning ("Could not open " GLADE_FILE);
g_warning ("Could not parse UI definition: %s", error->message);
g_error_free (error);
g_object_unref (builder);
return;
}
error = NULL;
app->screen = gnome_rr_screen_new (gdk_screen_get_default (),
on_screen_changed, app, &error);
if (!app->screen)
{
error_message (NULL, _("Could not get screen information"), error->message);
g_error_free (error);
g_object_unref (xml);
g_object_unref (builder);
return;
}
app->client = gconf_client_get_default ();
app->dialog = glade_xml_get_widget (xml, "dialog");
app->dialog = _gtk_builder_get_widget (builder, "dialog");
g_signal_connect_after (app->dialog, "map-event",
G_CALLBACK (dialog_map_event_cb), app);
@ -2149,43 +2157,49 @@ run_application (App *app)
gtk_window_set_icon_name (GTK_WINDOW (app->dialog),
"gnome-display-properties");
app->current_monitor_event_box = glade_xml_get_widget (xml, "current_monitor_event_box");
app->current_monitor_label = glade_xml_get_widget (xml, "current_monitor_label");
app->current_monitor_event_box = _gtk_builder_get_widget (builder,
"current_monitor_event_box");
app->current_monitor_label = _gtk_builder_get_widget (builder,
"current_monitor_label");
app->monitor_on_radio = glade_xml_get_widget (xml, "monitor_on_radio");
app->monitor_off_radio = glade_xml_get_widget (xml, "monitor_off_radio");
app->monitor_on_radio = _gtk_builder_get_widget (builder,
"monitor_on_radio");
app->monitor_off_radio = _gtk_builder_get_widget (builder,
"monitor_off_radio");
g_signal_connect (app->monitor_on_radio, "toggled",
G_CALLBACK (monitor_on_off_toggled_cb), app);
g_signal_connect (app->monitor_off_radio, "toggled",
G_CALLBACK (monitor_on_off_toggled_cb), app);
app->resolution_combo = glade_xml_get_widget (xml, "resolution_combo");
app->resolution_combo = _gtk_builder_get_widget (builder,
"resolution_combo");
g_signal_connect (app->resolution_combo, "changed",
G_CALLBACK (on_resolution_changed), app);
app->refresh_combo = glade_xml_get_widget (xml, "refresh_combo");
app->refresh_combo = _gtk_builder_get_widget (builder, "refresh_combo");
g_signal_connect (app->refresh_combo, "changed",
G_CALLBACK (on_rate_changed), app);
app->rotation_combo = glade_xml_get_widget (xml, "rotation_combo");
app->rotation_combo = _gtk_builder_get_widget (builder, "rotation_combo");
g_signal_connect (app->rotation_combo, "changed",
G_CALLBACK (on_rotation_changed), app);
app->clone_checkbox = glade_xml_get_widget (xml, "clone_checkbox");
app->clone_checkbox = _gtk_builder_get_widget (builder, "clone_checkbox");
g_signal_connect (app->clone_checkbox, "toggled",
G_CALLBACK (on_clone_changed), app);
g_signal_connect (glade_xml_get_widget (xml, "detect_displays_button"),
g_signal_connect (_gtk_builder_get_widget (builder, "detect_displays_button"),
"clicked", G_CALLBACK (on_detect_displays), app);
app->show_icon_checkbox = glade_xml_get_widget (xml, "show_notification_icon");
app->show_icon_checkbox = _gtk_builder_get_widget (builder,
"show_notification_icon");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->show_icon_checkbox),
gconf_client_get_bool (app->client, SHOW_ICON_KEY, NULL));
g_signal_connect (app->show_icon_checkbox, "toggled", G_CALLBACK (on_show_icon_toggled), app);
app->panel_checkbox = glade_xml_get_widget (xml, "panel_checkbox");
app->panel_checkbox = _gtk_builder_get_widget (builder, "panel_checkbox");
make_text_combo (app->resolution_combo, 4);
make_text_combo (app->refresh_combo, 3);
@ -2206,20 +2220,20 @@ run_application (App *app)
g_signal_connect (app->area, "viewport_changed",
G_CALLBACK (on_viewport_changed), app);
align = glade_xml_get_widget (xml, "align");
align = _gtk_builder_get_widget (builder, "align");
gtk_container_add (GTK_CONTAINER (align), app->area);
/* Until we have help to show, we'll just hide the Help button */
hide_help_button (app);
app->apply_button = glade_xml_get_widget (xml, "apply_button");
app->apply_button = _gtk_builder_get_widget (builder, "apply_button");
g_signal_connect (app->apply_button, "clicked",
G_CALLBACK (apply_button_clicked_cb), app);
on_screen_changed (app->screen, app);
g_object_unref (xml);
g_object_unref (builder);
restart:
switch (gtk_dialog_run (GTK_DIALOG (app->dialog)))

View file

@ -38,7 +38,7 @@ capplets/default-applications/gnome-at-session.desktop.in.in
capplets/default-applications/gnome-da-capplet.c
capplets/default-applications/gnome-default-applications-properties.glade
capplets/default-applications/gnome-default-applications.xml.in
capplets/display/display-capplet.glade
[type: gettext/glade]capplets/display/display-capplet.ui
capplets/display/display-properties.desktop.in.in
capplets/display/xrandr-capplet.c
capplets/keybindings/00-multimedia-key.xml.in