• # j'ai oublier le principal ;)

    Posté par . En réponse au message Question au développeur. Évalué à 1.

    Patch modifier :

    From 4cf2986d43abc62c23c8be490867f7f8c9d52f8b Mon Sep 17 00:00:00 2001
    From: William Jon McCann <jmccann@redhat.com>
    Date: 2009年8月22日 18:37:57 -0400
    Subject: [PATCH 1/3] Remove interface tab
    Fixes http://bugzilla.gnome.org/show_bug.cgi?id=592756
    ---
     capplets/appearance/Makefile.am | 2 +
     capplets/appearance/appearance-main.c | 2 +
     capplets/appearance/appearance-ui.c | 239 ++++++++++++++++++++
     capplets/appearance/appearance-ui.h | 21 ++
     capplets/appearance/data/appearance.ui | 364 ++++++++++++++++++++++++++++++++
     5 files changed, 628 insertions(+), 0 deletions(-)
     add mode 100644 capplets/appearance/appearance-ui.c
     add mode 100644 capplets/appearance/appearance-ui.h
    diff --git a/capplets/appearance/Makefile.am b/capplets/appearance/Makefile.am
    index 226e4ec..b940d73 100644
    +++ a/capplets/appearance/Makefile.am
    --- b/capplets/appearance/Makefile.am
    @@ +16,6 -16,8 @@ gnome_appearance_properties_SOURCES = \
     appearance-themes.h \
     appearance-style.c \
     appearance-style.h \
    + appearance-ui.c \
    + appearance-ui.h \
     gedit-message-area.c \
     gedit-message-area.h \
     gnome-wp-info.c \
    diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
    index 369af02..fcf3b95 100644
    +++ a/capplets/appearance/appearance-main.c
    --- b/capplets/appearance/appearance-main.c
    @@ +24,6 -24,7 @@
     #include "appearance-font.h"
     #include "appearance-themes.h"
     #include "appearance-style.h"
    +#include "appearance-ui.h"
     #include "theme-installer.h"
     #include "theme-thumbnail.h"
     #include "activate-settings-daemon.h"
    @@ +174,7 -171,6 @@ main (int argc, char **argv)
     themes_init (data);
     style_init (data);
     desktop_init (data, (const gchar **) wallpaper_files);
     g_strfreev (wallpaper_files);
     font_init (data);
    + ui_init (data);
     /* prepare the main window */
     w = appearance_capplet_get_widget (data, "appearance_window");
    diff --git a/capplets/appearance/appearance-ui.c b/capplets/appearance/appearance-ui.c
    add file mode 100644
    index 1bec903..0000000
    --- /dev/null
    +++ a/capplets/appearance/appearance-ui.c
    @@ -0,0 +1,239 @@
    +/*
    + * Copyright (C) 2007 The GNOME Foundation
    + * Written by Jonathan Blandford <jrb@gnome.org>
    + * Jens Granseuer <jensgr@gmx.net>
    + * All Rights Reserved
    + *
    + * 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.,
    + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    + */
    +
    +#include "appearance.h"
    +
    +#include "gconf-property-editor.h"
    +
    +static GConfEnumStringPair toolbar_style_enums[] = {
    + { 0, "both" },
    + { 1, "both-horiz" },
    + { 2, "icons" },
    + { 3, "text" },
    + { -1, NULL }
    +};
    +
    +
    +static void
    +show_handlebar (AppearanceData *data, gboolean show)
    +{
    + GtkWidget *handlebox = appearance_capplet_get_widget (data, "toolbar_handlebox");
    + GtkWidget *toolbar = appearance_capplet_get_widget (data, "toolbar_toolbar");
    + GtkWidget *align = appearance_capplet_get_widget (data, "toolbar_align");
    +
    + g_object_ref (handlebox);
    + g_object_ref (toolbar);
    +
    + if (GTK_BIN (align)->child)
    + gtk_container_remove (GTK_CONTAINER (align), GTK_BIN (align)->child);
    +
    + if (GTK_BIN (handlebox)->child)
    + gtk_container_remove (GTK_CONTAINER (handlebox), GTK_BIN (handlebox)->child);
    +
    + if (show) {
    + gtk_container_add (GTK_CONTAINER (align), handlebox);
    + gtk_container_add (GTK_CONTAINER (handlebox), toolbar);
    + g_object_unref (handlebox);
    + } else {
    + gtk_container_add (GTK_CONTAINER (align), toolbar);
    + }
    +
    + g_object_unref (toolbar);
    +}
    +
    +static void
    +set_toolbar_style (AppearanceData *data, const char *value)
    +{
    + static const GtkToolbarStyle gtk_toolbar_styles[] =
    + { GTK_TOOLBAR_BOTH, GTK_TOOLBAR_BOTH_HORIZ, GTK_TOOLBAR_ICONS, GTK_TOOLBAR_TEXT };
    +
    + int enum_val;
    +
    + if (!gconf_string_to_enum (toolbar_style_enums, value, &enum_val))
    + enum_val = 0;
    +
    + gtk_toolbar_set_style (GTK_TOOLBAR (appearance_capplet_get_widget (data, "toolbar_toolbar")),
    + gtk_toolbar_styles[enum_val]);
    +}
    +
    +static void
    +set_have_icons (AppearanceData *data, gboolean value)
    +{
    + static const char *menu_item_names[] = {
    + "menu_item_1",
    + "menu_item_2",
    + "menu_item_3",
    + "menu_item_4",
    + "menu_item_5",
    + "cut",
    + "copy",
    + "paste",
    + NULL
    + };
    +
    + const char **name;
    +
    + for (name = menu_item_names; *name != NULL; name++) {
    + GtkImageMenuItem *item = GTK_IMAGE_MENU_ITEM (appearance_capplet_get_widget (data, *name));
    + GtkWidget *image;
    +
    + if (value) {
    + image = g_object_get_data (G_OBJECT (item), "image");
    + if (image) {
    + gtk_image_menu_item_set_image (item, image);
    + g_object_unref (image);
    + }
    + } else {
    + image = gtk_image_menu_item_get_image (item);
    + g_object_set_data (G_OBJECT (item), "image", image);
    + g_object_ref (image);
    + gtk_image_menu_item_set_image (item, NULL);
    + }
    + }
    +}
    +
    +/** GConf Callbacks and Conversions **/
    +
    +static GConfValue *
    +toolbar_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
    +{
    + GConfValue *new_value;
    +
    + new_value = gconf_value_new (GCONF_VALUE_STRING);
    + gconf_value_set_string (new_value,
    + gconf_enum_to_string (toolbar_style_enums,
    + gconf_value_get_int (value)));
    +
    + return new_value;
    +}
    +
    +static GConfValue *
    +toolbar_to_widget (GConfPropertyEditor *peditor, GConfValue *value)
    +{
    + GConfValue *new_value;
    + const gchar *str;
    + gint val;
    +
    + str = (value && (value->type == GCONF_VALUE_STRING)) ?
    + gconf_value_get_string (value) : NULL;
    +
    + if (!gconf_string_to_enum (toolbar_style_enums, str, &val))
    + val = 0;
    +
    + new_value = gconf_value_new (GCONF_VALUE_INT);
    + gconf_value_set_int (new_value, val);
    + return new_value;
    +}
    +
    +static void
    +toolbar_style_cb (GConfPropertyEditor *peditor,
    + gchar *key,
    + GConfValue *value,
    + AppearanceData *data)
    +{
    + set_toolbar_style (data, gconf_value_get_string (value));
    +}
    +
    +static void
    +menus_have_icons_cb (GConfPropertyEditor *peditor,
    + gchar *key,
    + GConfValue *value,
    + AppearanceData *data)
    +{
    + set_have_icons (data, gconf_value_get_bool (value));
    +}
    +
    +static void
    +toolbar_detachable_cb (GConfClient *client,
    + guint id,
    + GConfEntry *entry,
    + AppearanceData *data)
    +{
    + show_handlebar (data, gconf_value_get_bool (entry->value));
    +}
    +
    +/** GUI Callbacks **/
    +
    +static gint
    +button_press_block_cb (GtkWidget *toolbar,
    + GdkEvent *event,
    + gpointer data)
    +{
    + return TRUE;
    +}
    +
    +/** Public Functions **/
    +
    +void
    +ui_init (AppearanceData *data)
    +{
    + GObject *peditor;
    + char *toolbar_style;
    +
    + gconf_client_add_dir (data->client, "/desktop/gnome/interface",
    + GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
    +
    + peditor = gconf_peditor_new_boolean
    + (NULL, "/desktop/gnome/interface/can_change_accels",
    + appearance_capplet_get_widget (data, "menu_accel_toggle"), NULL);
    +
    + peditor = gconf_peditor_new_boolean
    + (NULL, "/desktop/gnome/interface/menus_have_icons",
    + appearance_capplet_get_widget (data, "menu_icons_toggle"), NULL);
    + g_signal_connect (peditor, "value_changed",
    + (GCallback) menus_have_icons_cb, data);
    +
    + set_have_icons (data,
    + gconf_client_get_bool (data->client,
    + "/desktop/gnome/interface/menus_have_icons",
    + NULL));
    +
    + peditor = gconf_peditor_new_combo_box
    + (NULL, "/desktop/gnome/interface/toolbar_style",
    + appearance_capplet_get_widget (data, "toolbar_style_select"),
    + "conv-to-widget-cb", toolbar_to_widget,
    + "conv-from-widget-cb", toolbar_from_widget,
    + NULL);
    + g_signal_connect (peditor, "value_changed",
    + (GCallback) toolbar_style_cb, data);
    +
    + g_signal_connect (appearance_capplet_get_widget (data, "toolbar_handlebox"),
    + "button_press_event",
    + (GCallback) button_press_block_cb, NULL);
    +
    + show_handlebar (data,
    + gconf_client_get_bool (data->client,
    + "/desktop/gnome/interface/toolbar_detachable",
    + NULL));
    +
    + toolbar_style = gconf_client_get_string
    + (data->client,
    + "/desktop/gnome/interface/toolbar_style",
    + NULL);
    + set_toolbar_style (data, toolbar_style);
    + g_free (toolbar_style);
    +
    + /* no ui for detachable toolbars */
    + gconf_client_notify_add (data->client,
    + "/desktop/gnome/interface/toolbar_detachable",
    + (GConfClientNotifyFunc) toolbar_detachable_cb,
    + data, NULL, NULL);
    +}
    diff --git a/capplets/appearance/appearance-ui.h b/capplets/appearance/appearance-ui.h
    add file mode 100644
    index 5817a73..0000000
    --- /dev/null
    +++ a/capplets/appearance/appearance-ui.h
    @@ -0,0 +1,21 @@
    +/*
    + * Copyright (C) 2007 The GNOME Foundation
    + * Written by Jens Granseuer <jensgr@gmx.net>
    + * All Rights Reserved
    + *
    + * 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.,
    + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    + */
    +
    +void ui_init (AppearanceData *data);
    diff --git a/capplets/appearance/data/appearance.ui b/capplets/appearance/data/appearance.ui
    index 42274f8..0ebee5d 100644
    +++ a/capplets/appearance/data/appearance.ui
    --- b/capplets/appearance/data/appearance.ui
    @@ -1601,6 +1601,370 @@
     <property name="tab_fill">False</property>
     </packing>
     </child>
    + <child>
    + <object class="GtkVBox" id="interface_vbox">
    + <property name="visible">True</property>
    + <property name="border_width">12</property>
    + <property name="orientation">vertical</property>
    + <property name="spacing">18</property>
    + <child>
    + <object class="GtkVBox" id="vbox23">
    + <property name="visible">True</property>
    + <property name="orientation">vertical</property>
    + <property name="spacing">6</property>
    + <child>
    + <object class="GtkLabel" id="label35">
    + <property name="visible">True</property>
    + <property name="xalign">0</property>
    + <property name="label" translatable="yes">Menus and Toolbars</property>
    + <attributes>
    + <attribute name="weight" value="bold"/>
    + </attributes>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkHBox" id="hbox10">
    + <property name="visible">True</property>
    + <child>
    + <object class="GtkLabel" id="label36">
    + <property name="visible">True</property>
    + <property name="label"> </property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkVBox" id="vbox24">
    + <property name="visible">True</property>
    + <property name="orientation">vertical</property>
    + <property name="spacing">6</property>
    + <child>
    + <object class="GtkCheckButton" id="menu_icons_toggle">
    + <property name="label" translatable="yes">Show _icons in menus</property>
    + <property name="visible">True</property>
    + <property name="can_focus">True</property>
    + <property name="receives_default">False</property>
    + <property name="use_underline">True</property>
    + <property name="active">True</property>
    + <property name="draw_indicator">True</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkCheckButton" id="menu_accel_toggle">
    + <property name="label" translatable="yes">_Editable menu shortcut keys</property>
    + <property name="visible">True</property>
    + <property name="can_focus">True</property>
    + <property name="receives_default">False</property>
    + <property name="use_underline">True</property>
    + <property name="draw_indicator">True</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">2</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkHBox" id="hbox11">
    + <property name="visible">True</property>
    + <property name="spacing">12</property>
    + <child>
    + <object class="GtkLabel" id="label37">
    + <property name="visible">True</property>
    + <property name="label" translatable="yes">Toolbar _button labels:</property>
    + <property name="use_underline">True</property>
    + <property name="justify">center</property>
    + <property name="mnemonic_widget">toolbar_style_select</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkComboBox" id="toolbar_style_select">
    + <property name="visible">True</property>
    + <property name="model">toolbar_style_liststore</property>
    + <child>
    + <object class="GtkCellRendererText" id="cellrenderertext3"/>
    + <attributes>
    + <attribute name="text">0</attribute>
    + </attributes>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">4</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkVBox" id="vbox25">
    + <property name="visible">True</property>
    + <property name="orientation">vertical</property>
    + <property name="spacing">6</property>
    + <child>
    + <object class="GtkLabel" id="label38">
    + <property name="visible">True</property>
    + <property name="xalign">0</property>
    + <property name="label" translatable="yes">Preview</property>
    + <attributes>
    + <attribute name="weight" value="bold"/>
    + </attributes>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkHBox" id="hbox12">
    + <property name="visible">True</property>
    + <child>
    + <object class="GtkLabel" id="label39">
    + <property name="visible">True</property>
    + <property name="label"> </property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkVBox" id="vbox26">
    + <property name="visible">True</property>
    + <property name="orientation">vertical</property>
    + <child>
    + <object class="GtkMenuBar" id="menubar">
    + <property name="visible">True</property>
    + <child>
    + <object class="GtkMenuItem" id="File Menu">
    + <property name="visible">True</property>
    + <property name="label" translatable="yes">_File</property>
    + <property name="use_underline">True</property>
    + <child type="submenu">
    + <object class="GtkMenu" id="File Menu_menu">
    + <child>
    + <object class="GtkImageMenuItem" id="menu_item_1">
    + <property name="label">_New</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="menu_item_2">
    + <property name="label">_Open</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="menu_item_3">
    + <property name="label">_Save</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkMenuItem" id="separator1">
    + <property name="visible">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="menu_item_4">
    + <property name="label">_Print</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkMenuItem" id="separator2">
    + <property name="visible">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="menu_item_5">
    + <property name="label">_Quit</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + </object>
    + </child>
    + </object>
    + </child>
    + <child>
    + <object class="GtkMenuItem" id="edit">
    + <property name="visible">True</property>
    + <property name="label" translatable="yes">Edit</property>
    + <property name="use_underline">True</property>
    + <child type="submenu">
    + <object class="GtkMenu" id="edit1_menu">
    + <child>
    + <object class="GtkImageMenuItem" id="cut">
    + <property name="label">C_ut</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="copy">
    + <property name="label">_Copy</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + <child>
    + <object class="GtkImageMenuItem" id="paste">
    + <property name="label">_Paste</property>
    + <property name="visible">True</property>
    + <property name="use_underline">True</property>
    + <property name="use_stock">True</property>
    + </object>
    + </child>
    + </object>
    + </child>
    + </object>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="fill">False</property>
    + <property name="position">0</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkAlignment" id="toolbar_align">
    + <property name="visible">True</property>
    + <child>
    + <object class="GtkHandleBox" id="toolbar_handlebox">
    + <property name="visible">True</property>
    + <child>
    + <object class="GtkToolbar" id="toolbar_toolbar">
    + <property name="visible">True</property>
    + <property name="toolbar_style">both</property>
    + <child>
    + <object class="GtkToolButton" id="button2">
    + <property name="visible">True</property>
    + <property name="is_important">True</property>
    + <property name="stock_id">gtk-new</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="homogeneous">True</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkToolButton" id="button4">
    + <property name="visible">True</property>
    + <property name="stock_id">gtk-open</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="homogeneous">True</property>
    + </packing>
    + </child>
    + <child>
    + <object class="GtkToolButton" id="save_button">
    + <property name="visible">True</property>
    + <property name="stock_id">gtk-save</property>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="homogeneous">True</property>
    + </packing>
    + </child>
    + </object>
    + </child>
    + </object>
    + </child>
    + </object>
    + <packing>
    + <property name="expand">False</property>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="position">1</property>
    + </packing>
    + </child>
    + </object>
    + <packing>
    + <property name="position">3</property>
    + </packing>
    + </child>
    + <child type="tab">
    + <object class="GtkLabel" id="label40">
    + <property name="visible">True</property>
    + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    + <property name="label" translatable="yes">Interface</property>
    + </object>
    + <packing>
    + <property name="position">3</property>
    + <property name="tab_fill">False</property>
    + </packing>
    + </child>
     </object>
     <packing>
     <property name="position">1</property>
    ++ 
    1.6.4
    
    

    « Les Français veulent l'égalité, et quand ils ne la trouvent pas dans la liberté, ils la souhaitent dans l'esclavage. » (Alexis de Tocqueville)