]> git.pld-linux.org Git - packages/control-center.git/blob - control-center-dpi.patch
- tadaaaam... DPI autodetection can be disabled
[packages/control-center.git] / control-center-dpi.patch
1 diff -Nuard control-center-2.4.0.orig/capplets/font/font-properties.glade control-center-2.4.0/capplets/font/font-properties.glade
2 --- control-center-2.4.0.orig/capplets/font/font-properties.glade       2003-08-04 17:33:22.000000000 +0200
3 +++ control-center-2.4.0/capplets/font/font-properties.glade    2003-11-14 00:12:09.000000000 +0100
4 @@ -723,6 +723,24 @@
5                       <property name="fill">False</property>
6                     </packing>
7                   </child>
8 +
9 +                 <child>
10 +                   <widget class="GtkCheckButton" id="dpi_calculate">
11 +                     <property name="visible">True</property>
12 +                     <property name="can_focus">True</property>
13 +                     <property name="label" translatable="yes">Calculate DPI</property>
14 +                     <property name="use_underline">True</property>
15 +                     <property name="relief">GTK_RELIEF_NORMAL</property>
16 +                     <property name="active">False</property>
17 +                     <property name="inconsistent">False</property>
18 +                     <property name="draw_indicator">True</property>
19 +                   </widget>
20 +                   <packing>
21 +                     <property name="padding">0</property>
22 +                     <property name="expand">False</property>
23 +                     <property name="fill">False</property>
24 +                   </packing>
25 +                 </child>
26                 </widget>
27               </child>
28             </widget>
29 diff -Nuard control-center-2.4.0.orig/capplets/font/main.c control-center-2.4.0/capplets/font/main.c
30 --- control-center-2.4.0.orig/capplets/font/main.c      2003-08-02 18:02:47.000000000 +0200
31 +++ control-center-2.4.0/capplets/font/main.c   2003-11-14 00:17:10.000000000 +0100
32 @@ -38,6 +38,7 @@
33  #define FONT_HINTING_KEY      FONT_RENDER_DIR "/hinting"
34  #define FONT_RGBA_ORDER_KEY   FONT_RENDER_DIR "/rgba_order"
35  #define FONT_DPI_KEY          FONT_RENDER_DIR "/dpi"
36 +#define FONT_CALCULATE_DPI_KEY          FONT_RENDER_DIR "/calculate_dpi"
37  
38  #endif /* HAVE_XFT2 */
39  static gboolean in_change = FALSE;
40 @@ -749,6 +750,33 @@
41  }
42  
43  static void
44 +dpi_toggle_changed (GtkToggleButton *toggle,
45 +                  GtkWidget   *spinner)
46 +{
47 +       GConfClient *client = gconf_client_get_default ();
48 +       GdkScreen *screen = gdk_screen_get_default ();
49 +       gboolean active = gtk_toggle_button_get_active (toggle);
50 +        int width_mm, width_px, dpi;
51 +        double xres;
52 +       
53 +       gconf_client_set_bool (client, FONT_CALCULATE_DPI_KEY, active, NULL);
54 +       
55 +       if (active)
56 +         gtk_widget_set_sensitive( GTK_WIDGET(spinner) , FALSE);
57 +        else
58 +         gtk_widget_set_sensitive( GTK_WIDGET(spinner) , TRUE);
59 +       
60 +        width_mm = gdk_screen_get_width_mm(screen);
61 +        width_px  = gdk_screen_get_width(screen);
62 +
63 +        xres = ((((double)width_px) * 25.4) / ((double)width_mm));
64 +        dpi = (int)(xres + 0.5);
65 +
66 +       gtk_spin_button_set_value ( GTK_SPIN_BUTTON (spinner), dpi);
67 +
68 +}
69 +
70 +static void
71  dpi_value_changed (GtkSpinButton *spinner,
72                    GConfClient   *client)
73  {
74 @@ -790,7 +818,7 @@
75         if (!details_dialog) {
76                 GConfClient *client = gconf_client_get_default ();
77                 GladeXML *dialog = glade_xml_new (GLADEDIR "/font-properties.glade", "render_details", NULL);
78 -               GtkWidget *dpi_spinner;
79 +               GtkWidget *dpi_spinner, *dpi_toggle;
80                 GnomeVFSURI *uri;
81  
82                 details_dialog = WID ("render_details");
83 @@ -809,9 +837,16 @@
84                 g_signal_connect (dpi_spinner, "value_changed",
85                                   G_CALLBACK (dpi_value_changed), client);
86  
87 +               dpi_toggle = WID ("dpi_calculate");
88 +               g_signal_connect (GTK_TOGGLE_BUTTON (dpi_toggle), "toggled",
89 +                                 G_CALLBACK (dpi_toggle_changed), dpi_spinner);
90 +
91 +               gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (dpi_toggle), gconf_client_get_bool (client, FONT_CALCULATE_DPI_KEY, NULL));
92 +
93                 gconf_client_notify_add (client, FONT_DPI_KEY,
94                                          dpi_changed,
95                                          dpi_spinner, NULL, NULL);
96 +                                        
97  
98                 setup_font_sample (WID ("antialias_none_sample"),      ANTIALIAS_NONE,      HINT_FULL);
99                 setup_font_sample (WID ("antialias_grayscale_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL);
100 diff -Nuard control-center-2.4.0.orig/schemas/desktop_gnome_font_rendering.schemas control-center-2.4.0/schemas/desktop_gnome_font_rendering.schemas
101 --- control-center-2.4.0.orig/schemas/desktop_gnome_font_rendering.schemas      2003-09-08 16:58:39.000000000 +0200
102 +++ control-center-2.4.0/schemas/desktop_gnome_font_rendering.schemas   2003-11-13 22:29:49.000000000 +0100
103 @@ -1,6 +1,21 @@
104  <?xml version="1.0"?>
105  <gconfschemafile>
106      <schemalist>
107 +       <schema>
108 +           <key>/schemas/desktop/gnome/font_rendering/calculate_dpi</key>
109 +           <applyto>/desktop/gnome/font_rendering/calculate_dpi</applyto>
110 +            <owner>gnome</owner>
111 +           <type>bool</type>
112 +            <default>false</default>
113 +            <locale name="C">
114 +               <short>Automatic DPI calculation</short>
115 +                <long>Automaticac DPI calculation</long>
116 +            </locale>
117 +            <locale name="pl">
118 +               <short>Automatyczne obliczanie DPI</short>
119 +                <long>Automatyczne obliczanie DPI</long>
120 +            </locale>
121 +       </schema>
122         <schema>
123             <key>/schemas/desktop/gnome/font_rendering/dpi</key>
124             <applyto>/desktop/gnome/font_rendering/dpi</applyto>
This page took 0.038129 seconds and 4 git commands to generate.