Awn

[patch] Allow Font Face selection

Bug #129977 reported by Ryan Rushton
2
Affects Status Importance Assigned to Milestone
Awn
Fix Released
Undecided
Unassigned
Awn Extras
Fix Released
Undecided
Unassigned

Bug Description

A patch to allow font face selection, it removes bold/itailic/and font size. and replaces them all with a font dialog.

=== modified file 'avant-preferences/avant-preferences.in.py'
--- avant-preferences/avant-preferences.in.py 2007-08-01 12:37:48 +0000
+++ avant-preferences/avant-preferences.in.py 2007-08-02 16:57:37 +0000
@@ -82,6 +82,7 @@
 TITLE_ITALIC = "/apps/avant-window-navigator/title/italic" #bool
 TITLE_BOLD = "/apps/avant-window-navigator/title/bold" #bool
 TITLE_FONT_SIZE = "/apps/avant-window-navigator/title/font_size" #float
+TITLE_FONT_FACE = "/apps/avant-window-navigator/title/font_face" #string

 DATA_DIR = "@PKGDATADIR@"

@@ -149,8 +150,6 @@
                self.setup_bool (BAR_RENDER_PATTERN, self.wTree.get_widget("patterncheck"))
                self.setup_bool (BAR_ROUNDED_CORNERS, self.wTree.get_widget("roundedcornerscheck"))
                self.setup_bool (WINMAN_SHOW_ALL_WINS, self.wTree.get_widget("allwindowscheck"))
- self.setup_bool (TITLE_ITALIC, self.wTree.get_widget ("italiccheck"))
- self.setup_bool (TITLE_BOLD, self.wTree.get_widget("boldcheck"))
                self.setup_bool (BAR_SHOW_SEPARATOR, self.wTree.get_widget("separatorcheck"))
                self.setup_bool (APP_TASKS_H_ARROWS, self.wTree.get_widget("arrowcheck"))
                self.setup_bool (APP_FADE_EFFECT, self.wTree.get_widget("fadeeffect"))
@@ -158,7 +157,7 @@
                self.setup_chooser(APP_ACTIVE_PNG, self.wTree.get_widget("activefilechooser"))
                self.setup_chooser(BAR_PATTERN_URI, self.wTree.get_widget("patternchooserbutton"))

- self.setup_spin(TITLE_FONT_SIZE, self.wTree.get_widget("fontsizespin"))
+ self.setup_font(TITLE_FONT_FACE, self.wTree.get_widget("selectfontface"))

                self.setup_scale(BAR_PATTERN_ALPHA, self.wTree.get_widget("patternscale"))

@@ -281,7 +280,14 @@
                self.client.set_bool(key, check.get_active())
                print "toggled"

-
+ def setup_font(self, key, font_btn):
+ """sets up font chooser"""
+ font_btn.set_font_name(self.client.get_string(key))
+ font_btn.connect("font-set", self.font_changed, key)
+
+ def font_changed(self, font_btn, key):
+ self.client.set_string(key, font_btn.get_font_name())
+
 if __name__ == "__main__":
        gettext.textdomain(I18N_DOMAIN)
        gtk.glade.bindtextdomain(I18N_DOMAIN, "/usr/share/locale")

=== modified file 'avant-preferences/window.glade'
--- avant-preferences/window.glade 2007-07-30 23:21:37 +0000
+++ avant-preferences/window.glade 2007-08-02 16:57:37 +0000
@@ -471,226 +471,36 @@
                              <property name="fill">True</property>
                            </packing>
                          </child>
-
- <child>
- <widget class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Font size:</property>
- <property name="use_underline">False</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkSpinButton" id="fontsizespin">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">True</property>
- <property name="update_policy">GTK_UPDATE_IF_VALID</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</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="italiccheck">
- <property name="visible">True</property>
- <property name="can_focus">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>
- <signal name="toggled" handler="on_italiccheck_toggled" last_modification_time="Tue, 23 Jan 2007 17:42:57 GMT"/>
-
- <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">0</property>
- <property name="yscale">0</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>
- <widget class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-italic</property>
- <property name="icon_size">4</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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Italic</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="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>
- </widget>
- </child>
- </widget>
- </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="boldcheck">
- <property name="visible">True</property>
- <property name="can_focus">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>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</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>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-bold</property>
- <property name="icon_size">4</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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bold</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="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>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox_font">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label_font">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Font:</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkFontButton" id="selectfontface">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
                        </widget>
                      </child>
                    </widget>

=== modified file 'avant-preferences/window.glade.h'
--- avant-preferences/window.glade.h 2007-07-30 23:21:37 +0000
+++ avant-preferences/window.glade.h 2007-08-02 16:57:37 +0000
@@ -11,16 +11,14 @@
 char *s = N_("Avant Preferences");
 char *s = N_("Background color:");
 char *s = N_("Bar Appearence");
-char *s = N_("Bold");
 char *s = N_("Color:");
 char *s = N_("Enable pattern");
 char *s = N_("Enable rounded corners");
 char *s = N_("First step color:");
-char *s = N_("Font size:");
+char *s = N_("Font:");
 char *s = N_("General");
 char *s = N_("Glass Engine");
 char *s = N_("Internal border:");
-char *s = N_("Italic");
 char *s = N_("Main border:");
 char *s = N_("Pattern Engine");
 char *s = N_("Second step color:");

=== modified file 'src/awn-gconf.c'
--- src/awn-gconf.c 2007-07-30 23:21:37 +0000
+++ src/awn-gconf.c 2007-08-02 16:57:37 +0000
@@ -68,6 +68,7 @@
 #define TITLE_ITALIC TITLE_PATH "/italic" /*bool*/
 #define TITLE_BOLD TITLE_PATH "/bold" /*bool*/
 #define TITLE_FONT_SIZE TITLE_PATH "/font_size" /*bool*/
+#define TITLE_FONT_FACE TITLE_PATH "/font_face" /*string*/

 /* globals */
 static AwnSettings *settings = NULL;
@@ -157,17 +158,14 @@
        awn_load_color(client, TITLE_TEXT_COLOR, &s->text_color, "FFFFFFFF");
        awn_load_color(client, TITLE_SHADOW_COLOR, &s->shadow_color, "1B3B12E1");
        awn_load_color(client, TITLE_BACKGROUND, &s->background, "000000AA");
- awn_load_bool(client, TITLE_ITALIC, &s->italic, FALSE);
- awn_load_bool(client, TITLE_BOLD, &s->bold, FALSE);
- awn_load_float(client, TITLE_FONT_SIZE, &s->font_size, 15.0);
-
+ awn_load_string(client, TITLE_FONT_FACE, &s->font_face, "Sans 15");

        load_monitor (s);
        s->task_width = 60;

        /* make the custom icons directory */
        gchar *path = g_build_filename (g_get_home_dir (),
- ".awn/custom-icons",
+ ".config/awn/custom-icons",
                                        NULL);
        g_mkdir_with_parents (path, 0755);
        g_free (path);

=== modified file 'src/awn-gconf.h'
--- src/awn-gconf.h 2007-07-30 23:21:37 +0000
+++ src/awn-gconf.h 2007-08-02 16:57:37 +0000
@@ -103,7 +103,7 @@
        AwnColor background;
        gboolean italic;
        gboolean bold;
- gfloat font_size;
+ gchar *font_face;

        gboolean btest;

=== modified file 'src/awn-title.c'
--- src/awn-title.c 2007-07-30 23:21:37 +0000
+++ src/awn-title.c 2007-08-02 16:57:37 +0000
@@ -181,7 +181,7 @@
        }

        /* get a new pango-description */
- pDesc = pango_font_description_new ();
+ pDesc = pango_font_description_from_string(settings->font_face);
        if (!pDesc)
        {
                g_print ("demo_textpath(): ");
@@ -190,18 +190,6 @@
                return;
        }

- int font_slant = PANGO_STYLE_NORMAL;
- int font_weight = PANGO_WEIGHT_NORMAL;
- if (settings->italic)
- font_slant = PANGO_STYLE_ITALIC;
- if (settings->bold)
- font_weight = PANGO_WEIGHT_BOLD;
-
-
- pango_font_description_set_absolute_size (pDesc, PANGO_SCALE*settings->font_size);
- pango_font_description_set_family_static (pDesc, "Sans");
- pango_font_description_set_weight (pDesc, font_weight);
- pango_font_description_set_style (pDesc, font_slant);
        pango_layout_set_font_description (pLayout, pDesc);
        pango_font_description_free (pDesc);

Revision history for this message
Miika-Petteri Matikainen (mpmatikainen) wrote :

This patch also affects also to Awn manager. We need feedback from other developers before merging this.

Changed in awn:
status: New → In Progress
Revision history for this message
Ryan Rushton (ryancr) wrote :

This is already integrated into AWN Manager, I just wanted to get it into the current awn-preferences so when AWN Manager was moved over all the gconf entries would be there.

Revision history for this message
Miika-Petteri Matikainen (mpmatikainen) wrote :

Alright. Could you make a new patch which applies against the current bzr revision? Please add it as an attachment or send it to Patch manager because inlining it to a message seems to lose the indentations.

Revision history for this message
Ryan Rushton (ryancr) wrote :

Ok here is the updated patch, created via: bzr diff

Revision history for this message
Miika-Petteri Matikainen (mpmatikainen) wrote :

Thanks. Patch committed.

Changed in awn-extras:
status: New → Fix Released
Changed in awn:
status: In Progress → Fix Released
Revision history for this message
haytjes (h4writer) wrote :

wouldn't it be better if the default font face is 'sans 11' instead of 'sans 15'. I think it's now to big...

Revision history for this message
Miika-Petteri Matikainen (mpmatikainen) wrote :

You are right. I'll change it to 11.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.