add capplets/gnome-network-preferences.

2002-04-19  Mark McLoughlin  <mark@skynet.ie>

        * capplets/Makefile.am, configure.in: add
        capplets/gnome-network-preferences.

2002-04-19  Mark McLoughlin  <mark@skynet.ie>

        * gconf-property-editor.[ch]: (peditor_integer_value_changed),
        (peditor_integer_widget_changed), (gconf_peditor_new_integer_valist),
        (gconf_peditor_new_integer): implement GtkEntry based integer
        peditor.

2002-04-22  Mark McLoughlin  <mark@skynet.ie>

        * POTFILES.in: add network preferences capplet
        files.
This commit is contained in:
Mark McLoughlin 2002-04-22 17:49:22 +00:00 committed by Mark McLoughlin
parent 2d155bd839
commit 200282b7e0
12 changed files with 594 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2002-04-19 Mark McLoughlin <mark@skynet.ie>
* capplets/Makefile.am, configure.in: add
capplets/gnome-network-preferences.
2002-04-21 Rachel Hestilow <hestilow@ximian.com> 2002-04-21 Rachel Hestilow <hestilow@ximian.com>
* *.c: s/Richard/Rachel * *.c: s/Richard/Rachel

View file

@ -3,6 +3,6 @@ always_built_SUBDIRS = \
desktop-links \ desktop-links \
background keyboard mouse sound \ background keyboard mouse sound \
file-types theme-switcher ui-properties \ file-types theme-switcher ui-properties \
keybindings keybindings network
SUBDIRS = $(always_built_SUBDIRS) SUBDIRS = $(always_built_SUBDIRS)

View file

@ -1,3 +1,10 @@
2002-04-19 Mark McLoughlin <mark@skynet.ie>
* gconf-property-editor.[ch]: (peditor_integer_value_changed),
(peditor_integer_widget_changed), (gconf_peditor_new_integer_valist),
(gconf_peditor_new_integer): implement GtkEntry based integer
peditor.
2002-04-21 Rachel Hestilow <hestilow@ximian.com> 2002-04-21 Rachel Hestilow <hestilow@ximian.com>
* gconf-property-editor.c * gconf-property-editor.c

View file

@ -463,6 +463,102 @@ gconf_peditor_new_boolean (GConfChangeSet *changeset,
return peditor; return peditor;
} }
static void
peditor_integer_value_changed (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
GConfPropertyEditor *peditor)
{
GConfValue *value, *value_wid;
const char *entry_current_text;
int entry_current_integer;
if (peditor->p->changeset != NULL)
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
value = gconf_entry_get_value (entry);
if (value != NULL) {
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control));
entry_current_integer = strtol (entry_current_text, NULL, 10);
if (entry_current_integer != gconf_value_get_int (value)) {
char *buf = g_strdup_printf ("%d", gconf_value_get_int (value_wid));
gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), buf);
g_free (buf);
}
gconf_value_free (value_wid);
}
}
static void
peditor_integer_widget_changed (GConfPropertyEditor *peditor,
GtkEntry *entry)
{
GConfValue *value, *value_wid;
if (!peditor->p->inited) return;
value_wid = gconf_value_new (GCONF_VALUE_INT);
gconf_value_set_int (value_wid, strtol (gtk_entry_get_text (entry), NULL, 10));
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
peditor_set_gconf_value (peditor, peditor->p->key, value);
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
gconf_value_free (value_wid);
gconf_value_free (value);
}
static GObject *
gconf_peditor_new_integer_valist (GConfChangeSet *changeset,
gchar *key,
GtkWidget *entry,
gchar *first_property_name,
va_list var_args)
{
GObject *peditor;
peditor = gconf_peditor_new
(key,
(GConfClientNotifyFunc) peditor_integer_value_changed,
changeset,
G_OBJECT (entry),
first_property_name,
var_args, NULL);
g_signal_connect_swapped (G_OBJECT (entry), "changed",
(GCallback) peditor_integer_widget_changed, peditor);
return peditor;
}
GObject *
gconf_peditor_new_integer (GConfChangeSet *changeset,
gchar *key,
GtkWidget *entry,
gchar *first_property_name,
...)
{
GObject *peditor;
va_list var_args;
g_return_val_if_fail (key != NULL, NULL);
g_return_val_if_fail (entry != NULL, NULL);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
va_start (var_args, first_property_name);
peditor = gconf_peditor_new_integer_valist
(changeset, key, entry,
first_property_name, var_args);
va_end (var_args);
return peditor;
}
static void static void
peditor_string_value_changed (GConfClient *client, peditor_string_value_changed (GConfClient *client,
guint cnxn_id, guint cnxn_id,

View file

@ -83,6 +83,11 @@ GObject *gconf_peditor_new_enum_toggle (GConfChangeSet *changeset,
gchar *first_property_name, gchar *first_property_name,
...); ...);
GObject *gconf_peditor_new_integer (GConfChangeSet *changeset,
gchar *key,
GtkWidget *entry,
gchar *first_property_name,
...);
GObject *gconf_peditor_new_string (GConfChangeSet *changeset, GObject *gconf_peditor_new_string (GConfChangeSet *changeset,
gchar *key, gchar *key,
GtkWidget *entry, GtkWidget *entry,

View file

@ -0,0 +1,18 @@
bin_PROGRAMS = gnome-network-preferences
gnome_network_preferences_SOURCES = gnome-network-preferences.c
gnome_network_preferences_LDADD = \
$(GNOMECC_CAPPLETS_LIBS)
@INTLTOOL_DESKTOP_RULE@
gladedir = $(GNOMECC_GLADE_DIR)
glade_DATA = gnome-network-preferences.glade
desktopdir = $(GNOMECC_DESKTOP_DIR)
desktop_in_files = gnome-network-preferences.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
EXTRA_DIST = $(glade_DATA) $(desktop_in_files)

View file

@ -0,0 +1,116 @@
/* gnome-network-preferences.c: network preferences capplet
*
* Copyright (C) 2002 Sun Microsystems Inc.
*
* Written by: Mark McLoughlin <mark@skynet.ie>
*
* 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, 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.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <libgnome/libgnome.h>
#include <gconf/gconf-client.h>
#include <glade/glade.h>
#include "capplet-util.h"
#include "gconf-property-editor.h"
#define USE_PROXY_KEY "/system/gnome-vfs/use-http-proxy"
#define PROXY_HOST_KEY "/system/gnome-vfs/http-proxy-host"
#define PROXY_PORT_KEY "/system/gnome-vfs/http-proxy-port"
#define USE_AUTH_KEY "/system/gnome-vfs/use-http-proxy-authorization"
#define AUTH_USER_KEY "/system/gnome-vfs/http-proxy-authorization-user"
#define AUTH_PASSWD_KEY "/system/gnome-vfs/http-proxy-authorization-password"
static void
dialog_response (GtkWidget *widget,
int response_id)
{
switch (response_id)
{
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
default:
gtk_main_quit ();
break;
}
}
static void
setup_dialog (GladeXML *dialog)
{
GConfPropertyEditor *peditor;
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean (
NULL, USE_PROXY_KEY, WID ("proxy_toggle"), NULL));
gconf_peditor_widget_set_guard (peditor, WID ("host_port_table"));
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string (
NULL, PROXY_HOST_KEY, WID ("host_entry"), NULL));
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_integer (
NULL, PROXY_PORT_KEY, WID ("port_entry"), NULL));
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_boolean (
NULL, USE_AUTH_KEY, WID ("proxy_auth_toggle"), NULL));
gconf_peditor_widget_set_guard (peditor, WID ("username_password_table"));
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string (
NULL, AUTH_USER_KEY, WID ("user_entry"), NULL));
peditor = GCONF_PROPERTY_EDITOR (gconf_peditor_new_string (
NULL, AUTH_PASSWD_KEY, WID ("passwd_entry"), NULL));
/* FIXME: remove when I fix libglade */
gtk_entry_set_invisible_char (GTK_ENTRY (WID ("passwd_entry")), '*');
g_signal_connect (WID ("network_dialog"), "response",
G_CALLBACK (dialog_response), NULL);
}
int
main (int argc, char **argv)
{
GladeXML *dialog;
GConfClient *client;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gnome_program_init (argv [0], VERSION, LIBGNOMEUI_MODULE,
argc, argv, GNOME_PARAM_NONE);
client = gconf_client_get_default ();
gconf_client_add_dir (client, "/system/gnome-vfs",
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-network-preferences.glade",
"network_dialog", NULL);
setup_dialog (dialog);
gtk_widget_show_all (WID ("network_dialog"));
gtk_main ();
g_object_unref (client);
return 0;
}

View file

@ -0,0 +1,8 @@
[Desktop Entry]
_Name=Network
_Comment=Network Preferences
Exec=gnome-network-preferences
Icon=gnome-networktool.png
Terminal=0
Type=Application
Categories=Application;Settings;

View file

@ -0,0 +1,329 @@
<?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="network_dialog">
<property name="title" translatable="yes">Network 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="has_separator">False</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Network Preferences</atkproperty>
</accessibility>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">10</property>
<child>
<widget class="GtkButton" id="button3">
<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="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="GtkFrame" id="frame3">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="label" translatable="yes">HTTP Proxy Settings</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkVBox" id="vbox12">
<property name="border_width">8</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkCheckButton" id="proxy_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Use HTTP proxy</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</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="GtkTable" id="host_port_table">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">4</property>
<property name="column_spacing">4</property>
<child>
<widget class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="label" translatable="yes">_Location:</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.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="host_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label19">
<property name="visible">True</property>
<property name="label" translatable="yes">P_ort:</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.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="port_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</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="y_options"></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="GtkCheckButton" id="proxy_auth_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Pro_xy requires a username and password</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</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="GtkTable" id="username_password_table">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">4</property>
<property name="column_spacing">4</property>
<child>
<widget class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="label" translatable="yes">User_name:</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.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">user_entry</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="label" translatable="yes">Pass_word:</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.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">passwd_entry</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="user_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="passwd_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</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="y_options"></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>
<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

@ -207,6 +207,7 @@ capplets/theme-switcher/Makefile
capplets/ui-properties/Makefile capplets/ui-properties/Makefile
capplets/accessibility/Makefile capplets/accessibility/Makefile
capplets/accessibility/keyboard/Makefile capplets/accessibility/keyboard/Makefile
capplets/network/Makefile
schemas/Makefile schemas/Makefile
help/Makefile help/Makefile
help/C/Makefile help/C/Makefile

View file

@ -1,3 +1,8 @@
2002-04-22 Mark McLoughlin <mark@skynet.ie>
* POTFILES.in: add network preferences capplet
files.
2002-04-23 Abel Cheung <maddog@linux.org.hk> 2002-04-23 Abel Cheung <maddog@linux.org.hk>
* zh_TW.po: Recommit an error-free file. * zh_TW.po: Recommit an error-free file.

View file

@ -84,6 +84,9 @@ capplets/wm-properties/wm-desktops/Scwm.desktop.in.in
capplets/wm-properties/wm-desktops/twm.desktop.in.in capplets/wm-properties/wm-desktops/twm.desktop.in.in
capplets/wm-properties/wm-desktops/WindowMaker.desktop.in.in capplets/wm-properties/wm-desktops/WindowMaker.desktop.in.in
capplets/wm-properties/wm-properties-capplet.c capplets/wm-properties/wm-properties-capplet.c
capplets/network/gnome-network-preferences.c
capplets/network/gnome-network-preferences.glade
capplets/network/gnome-network-preferences.desktop.in
control-center/capplet-dir.c control-center/capplet-dir.c
control-center/capplet-dir-view.c control-center/capplet-dir-view.c
control-center/capplet-dir-view-list.c control-center/capplet-dir-view-list.c