Changeset bfa2a8e581a3f08de461847ee2464910797e4df0

Show
Ignore:
Timestamp:
12/17/08 18:01:11 (3 years ago)
Author:
Lincoln de Sousa <lincoln@…>
Children:
1b28919150c5c24b2c61d27ecb4cb96a187c2400
Parents:
dc6d6ff67aa9be656398ff38c2dc74af60162cc2
git-committer:
Lincoln de Sousa <lincoln@…> (12/17/08 18:01:11)
Message:

Adding an option to hide the tray icon.

Now, the user can choose if the tray icon should be shown or not
through an option added to the preferences window.

And the statusicon.py file was removed, now guake does not depends on
eggtrayicon but can only be used with gtk2.10+.

This patch is modification of a contribution made by Pierre-Yves aka
pingou =)

Files:
1 removed
5 modified

Legend:

Unmodified
Added
Removed
  • data/guake.schemas

    rf900ed0 rbfa2a8e  
    2525            </locale> 
    2626        </schema> 
    27          
     27 
     28        <schema> 
     29            <key>/schemas/apps/guake/general/use_tray</key> 
     30            <applyto>/apps/guake/general/use_tray</applyto> 
     31            <owner>guake</owner> 
     32            <type>bool</type> 
     33            <default>true</default> 
     34            <locale name="C"> 
     35                <short>Sets the tray visibility.</short> 
     36                <long>When true tray is visible.</long> 
     37            </locale> 
     38        </schema>         
     39 
    2840        <schema> 
    2941            <key>/schemas/apps/guake/general/default_shell</key> 
  • data/prefs.glade

    rf900ed0 rbfa2a8e  
    11<?xml version="1.0"?> 
    22<glade-interface> 
     3  <requires-version lib="gtk+" version="2.12"/> 
    34  <widget class="GtkWindow" id="config-window"> 
    45    <property name="width_request">460</property> 
     
    256257                                  </packing> 
    257258                                </child> 
     259                                <child> 
     260                                  <widget class="GtkCheckButton" id="show-trayicon-checkbutton"> 
     261                                    <property name="visible">True</property> 
     262                                    <property name="can_focus">True</property> 
     263                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     264                                    <property name="label" translatable="yes">Show tray</property> 
     265                                    <property name="response_id">0</property> 
     266                                    <property name="draw_indicator">True</property> 
     267                                    <signal name="toggled" handler="on_show_trayicon_checkbutton_toggled"/> 
     268                                  </widget> 
     269                                  <packing> 
     270                                    <property name="position">4</property> 
     271                                  </packing> 
     272                                </child> 
    258273                              </widget> 
    259274                            </child> 
     
    353368                                <property name="homogeneous">True</property> 
    354369                                <child> 
     370                                  <widget class="GtkColorButton" id="font-colorbutton"> 
     371                                    <property name="visible">True</property> 
     372                                    <property name="response_id">0</property> 
     373                                    <property name="title" translatable="yes">Choose some color</property> 
     374                                    <signal name="color_set" handler="on_font_colorbutton_color_set"/> 
     375                                  </widget> 
     376                                  <packing> 
     377                                    <property name="left_attach">1</property> 
     378                                    <property name="right_attach">2</property> 
     379                                    <property name="top_attach">1</property> 
     380                                    <property name="bottom_attach">2</property> 
     381                                  </packing> 
     382                                </child> 
     383                                <child> 
     384                                  <widget class="GtkFontButton" id="fontbutton"> 
     385                                    <property name="visible">True</property> 
     386                                    <property name="focus_on_click">False</property> 
     387                                    <property name="response_id">0</property> 
     388                                    <property name="title" translatable="yes">Choose some font</property> 
     389                                    <signal name="font_set" handler="on_fontbutton_font_set"/> 
     390                                  </widget> 
     391                                  <packing> 
     392                                    <property name="left_attach">1</property> 
     393                                    <property name="right_attach">2</property> 
     394                                  </packing> 
     395                                </child> 
     396                                <child> 
     397                                  <widget class="GtkLabel" id="label11"> 
     398                                    <property name="visible">True</property> 
     399                                    <property name="xalign">0</property> 
     400                                    <property name="label" translatable="yes">Color:</property> 
     401                                    <property name="use_markup">True</property> 
     402                                    <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
     403                                    <property name="single_line_mode">True</property> 
     404                                  </widget> 
     405                                  <packing> 
     406                                    <property name="top_attach">1</property> 
     407                                    <property name="bottom_attach">2</property> 
     408                                  </packing> 
     409                                </child> 
     410                                <child> 
    355411                                  <widget class="GtkLabel" id="label10"> 
    356412                                    <property name="visible">True</property> 
     
    361417                                    <property name="single_line_mode">True</property> 
    362418                                  </widget> 
    363                                 </child> 
    364                                 <child> 
    365                                   <widget class="GtkLabel" id="label11"> 
    366                                     <property name="visible">True</property> 
    367                                     <property name="xalign">0</property> 
    368                                     <property name="label" translatable="yes">Color:</property> 
    369                                     <property name="use_markup">True</property> 
    370                                     <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
    371                                     <property name="single_line_mode">True</property> 
    372                                   </widget> 
    373                                   <packing> 
    374                                     <property name="top_attach">1</property> 
    375                                     <property name="bottom_attach">2</property> 
    376                                   </packing> 
    377                                 </child> 
    378                                 <child> 
    379                                   <widget class="GtkFontButton" id="fontbutton"> 
    380                                     <property name="visible">True</property> 
    381                                     <property name="focus_on_click">False</property> 
    382                                     <property name="response_id">0</property> 
    383                                     <property name="title" translatable="yes">Choose some font</property> 
    384                                     <signal name="font_set" handler="on_fontbutton_font_set"/> 
    385                                   </widget> 
    386                                   <packing> 
    387                                     <property name="left_attach">1</property> 
    388                                     <property name="right_attach">2</property> 
    389                                   </packing> 
    390                                 </child> 
    391                                 <child> 
    392                                   <widget class="GtkColorButton" id="font-colorbutton"> 
    393                                     <property name="visible">True</property> 
    394                                     <property name="response_id">0</property> 
    395                                     <property name="title" translatable="yes">Choose some color</property> 
    396                                     <signal name="color_set" handler="on_font_colorbutton_color_set"/> 
    397                                   </widget> 
    398                                   <packing> 
    399                                     <property name="left_attach">1</property> 
    400                                     <property name="right_attach">2</property> 
    401                                     <property name="top_attach">1</property> 
    402                                     <property name="bottom_attach">2</property> 
    403                                   </packing> 
    404419                                </child> 
    405420                              </widget> 
     
    442457                                <property name="homogeneous">True</property> 
    443458                                <child> 
    444                                   <widget class="GtkLabel" id="label3"> 
    445                                     <property name="visible">True</property> 
    446                                     <property name="xalign">0</property> 
    447                                     <property name="label" translatable="yes">Color:</property> 
    448                                     <property name="use_markup">True</property> 
    449                                     <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
    450                                     <property name="single_line_mode">True</property> 
    451                                   </widget> 
    452                                 </child> 
    453                                 <child> 
    454                                   <widget class="GtkLabel" id="label4"> 
    455                                     <property name="visible">True</property> 
    456                                     <property name="xalign">0</property> 
    457                                     <property name="label" translatable="yes">Image:</property> 
    458                                     <property name="use_markup">True</property> 
    459                                     <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
    460                                     <property name="single_line_mode">True</property> 
    461                                   </widget> 
    462                                   <packing> 
    463                                     <property name="top_attach">1</property> 
    464                                     <property name="bottom_attach">2</property> 
    465                                   </packing> 
    466                                 </child> 
    467                                 <child> 
    468                                   <widget class="GtkLabel" id="label14"> 
    469                                     <property name="visible">True</property> 
    470                                     <property name="xalign">0</property> 
    471                                     <property name="label" translatable="yes">Desaturation:</property> 
    472                                     <property name="use_markup">True</property> 
    473                                     <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
    474                                     <property name="single_line_mode">True</property> 
    475                                   </widget> 
    476                                   <packing> 
    477                                     <property name="top_attach">2</property> 
    478                                     <property name="bottom_attach">3</property> 
    479                                   </packing> 
    480                                 </child> 
    481                                 <child> 
    482                                   <widget class="GtkLabel" id="label2"> 
    483                                     <property name="visible">True</property> 
    484                                     <property name="xalign">0</property> 
    485                                     <property name="label" translatable="yes">Background Transparent:</property> 
    486                                     <property name="use_markup">True</property> 
    487                                     <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
    488                                     <property name="single_line_mode">True</property> 
    489                                   </widget> 
    490                                   <packing> 
    491                                     <property name="top_attach">3</property> 
    492                                     <property name="bottom_attach">4</property> 
    493                                   </packing> 
    494                                 </child> 
    495                                 <child> 
    496                                   <widget class="GtkColorButton" id="bg-colorbutton"> 
    497                                     <property name="visible">True</property> 
    498                                     <property name="response_id">0</property> 
    499                                     <property name="title" translatable="yes">Choose some color</property> 
    500                                     <signal name="color_set" handler="on_bg_colorbutton_color_set"/> 
    501                                   </widget> 
    502                                   <packing> 
    503                                     <property name="left_attach">1</property> 
    504                                     <property name="right_attach">2</property> 
    505                                   </packing> 
    506                                 </child> 
    507                                 <child> 
    508                                   <widget class="GtkFileChooserButton" id="bgimage-filechooserbutton"> 
    509                                     <property name="visible">True</property> 
    510                                     <signal name="selection_changed" handler="on_bgimage_filechooserbutton_selection_changed"/> 
    511                                   </widget> 
    512                                   <packing> 
    513                                     <property name="left_attach">1</property> 
    514                                     <property name="right_attach">2</property> 
    515                                     <property name="top_attach">1</property> 
    516                                     <property name="bottom_attach">2</property> 
    517                                   </packing> 
    518                                 </child> 
    519                                 <child> 
    520                                   <widget class="GtkHScale" id="transparency-hscale"> 
    521                                     <property name="visible">True</property> 
    522                                     <property name="can_focus">True</property> 
    523                                     <property name="adjustment">0 0 100 1 10 10</property> 
    524                                     <property name="draw_value">False</property> 
    525                                     <property name="value_pos">GTK_POS_RIGHT</property> 
    526                                     <signal name="value_changed" handler="on_transparency_hscale_value_changed"/> 
    527                                   </widget> 
    528                                   <packing> 
    529                                     <property name="left_attach">1</property> 
    530                                     <property name="right_attach">2</property> 
    531                                     <property name="top_attach">2</property> 
    532                                     <property name="bottom_attach">3</property> 
    533                                   </packing> 
    534                                 </child> 
    535                                 <child> 
    536459                                  <widget class="GtkCheckButton" id="chk_bg_transparent"> 
    537460                                    <property name="visible">True</property> 
     
    551474                                    <property name="bottom_attach">4</property> 
    552475                                  </packing> 
     476                                </child> 
     477                                <child> 
     478                                  <widget class="GtkHScale" id="transparency-hscale"> 
     479                                    <property name="visible">True</property> 
     480                                    <property name="can_focus">True</property> 
     481                                    <property name="adjustment">0 0 100 1 10 10</property> 
     482                                    <property name="draw_value">False</property> 
     483                                    <property name="value_pos">GTK_POS_RIGHT</property> 
     484                                    <signal name="value_changed" handler="on_transparency_hscale_value_changed"/> 
     485                                  </widget> 
     486                                  <packing> 
     487                                    <property name="left_attach">1</property> 
     488                                    <property name="right_attach">2</property> 
     489                                    <property name="top_attach">2</property> 
     490                                    <property name="bottom_attach">3</property> 
     491                                  </packing> 
     492                                </child> 
     493                                <child> 
     494                                  <widget class="GtkFileChooserButton" id="bgimage-filechooserbutton"> 
     495                                    <property name="visible">True</property> 
     496                                    <signal name="selection_changed" handler="on_bgimage_filechooserbutton_selection_changed"/> 
     497                                  </widget> 
     498                                  <packing> 
     499                                    <property name="left_attach">1</property> 
     500                                    <property name="right_attach">2</property> 
     501                                    <property name="top_attach">1</property> 
     502                                    <property name="bottom_attach">2</property> 
     503                                  </packing> 
     504                                </child> 
     505                                <child> 
     506                                  <widget class="GtkColorButton" id="bg-colorbutton"> 
     507                                    <property name="visible">True</property> 
     508                                    <property name="response_id">0</property> 
     509                                    <property name="title" translatable="yes">Choose some color</property> 
     510                                    <signal name="color_set" handler="on_bg_colorbutton_color_set"/> 
     511                                  </widget> 
     512                                  <packing> 
     513                                    <property name="left_attach">1</property> 
     514                                    <property name="right_attach">2</property> 
     515                                  </packing> 
     516                                </child> 
     517                                <child> 
     518                                  <widget class="GtkLabel" id="label2"> 
     519                                    <property name="visible">True</property> 
     520                                    <property name="xalign">0</property> 
     521                                    <property name="label" translatable="yes">Background Transparent:</property> 
     522                                    <property name="use_markup">True</property> 
     523                                    <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
     524                                    <property name="single_line_mode">True</property> 
     525                                  </widget> 
     526                                  <packing> 
     527                                    <property name="top_attach">3</property> 
     528                                    <property name="bottom_attach">4</property> 
     529                                  </packing> 
     530                                </child> 
     531                                <child> 
     532                                  <widget class="GtkLabel" id="label14"> 
     533                                    <property name="visible">True</property> 
     534                                    <property name="xalign">0</property> 
     535                                    <property name="label" translatable="yes">Desaturation:</property> 
     536                                    <property name="use_markup">True</property> 
     537                                    <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
     538                                    <property name="single_line_mode">True</property> 
     539                                  </widget> 
     540                                  <packing> 
     541                                    <property name="top_attach">2</property> 
     542                                    <property name="bottom_attach">3</property> 
     543                                  </packing> 
     544                                </child> 
     545                                <child> 
     546                                  <widget class="GtkLabel" id="label4"> 
     547                                    <property name="visible">True</property> 
     548                                    <property name="xalign">0</property> 
     549                                    <property name="label" translatable="yes">Image:</property> 
     550                                    <property name="use_markup">True</property> 
     551                                    <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
     552                                    <property name="single_line_mode">True</property> 
     553                                  </widget> 
     554                                  <packing> 
     555                                    <property name="top_attach">1</property> 
     556                                    <property name="bottom_attach">2</property> 
     557                                  </packing> 
     558                                </child> 
     559                                <child> 
     560                                  <widget class="GtkLabel" id="label3"> 
     561                                    <property name="visible">True</property> 
     562                                    <property name="xalign">0</property> 
     563                                    <property name="label" translatable="yes">Color:</property> 
     564                                    <property name="use_markup">True</property> 
     565                                    <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property> 
     566                                    <property name="single_line_mode">True</property> 
     567                                  </widget> 
    553568                                </child> 
    554569                              </widget> 
     
    661676                                <property name="row_spacing">6</property> 
    662677                                <child> 
     678                                  <widget class="GtkLabel" id="delete-binding-combobox-label"> 
     679                                    <property name="visible">True</property> 
     680                                    <property name="xalign">0</property> 
     681                                    <property name="label" translatable="yes">_Delete key generates:</property> 
     682                                    <property name="use_underline">True</property> 
     683                                    <property name="justify">GTK_JUSTIFY_CENTER</property> 
     684                                    <property name="mnemonic_widget">delete-binding-combobox</property> 
     685                                  </widget> 
     686                                  <packing> 
     687                                    <property name="top_attach">1</property> 
     688                                    <property name="bottom_attach">2</property> 
     689                                    <property name="x_options">GTK_FILL</property> 
     690                                    <property name="y_options"></property> 
     691                                  </packing> 
     692                                </child> 
     693                                <child> 
     694                                  <widget class="GtkLabel" id="backspace-binding-combobox-label"> 
     695                                    <property name="visible">True</property> 
     696                                    <property name="xalign">0</property> 
     697                                    <property name="label" translatable="yes">_Backspace key generates:</property> 
     698                                    <property name="use_underline">True</property> 
     699                                    <property name="justify">GTK_JUSTIFY_CENTER</property> 
     700                                    <property name="mnemonic_widget">backspace-binding-combobox</property> 
     701                                  </widget> 
     702                                  <packing> 
     703                                    <property name="x_options">GTK_FILL</property> 
     704                                    <property name="y_options"></property> 
     705                                  </packing> 
     706                                </child> 
     707                                <child> 
     708                                  <widget class="GtkComboBox" id="backspace-binding-combobox"> 
     709                                    <property name="visible">True</property> 
     710                                    <property name="items" translatable="yes">ASCII DEL 
     711Escape sequence 
     712Control-H</property> 
     713                                    <signal name="changed" handler="on_backspace_binding_combobox_changed"/> 
     714                                  </widget> 
     715                                  <packing> 
     716                                    <property name="left_attach">1</property> 
     717                                    <property name="right_attach">3</property> 
     718                                    <property name="y_options">GTK_FILL</property> 
     719                                  </packing> 
     720                                </child> 
     721                                <child> 
    663722                                  <widget class="GtkComboBox" id="delete-binding-combobox"> 
    664723                                    <property name="visible">True</property> 
     
    674733                                    <property name="bottom_attach">2</property> 
    675734                                    <property name="y_options">GTK_FILL</property> 
    676                                   </packing> 
    677                                 </child> 
    678                                 <child> 
    679                                   <widget class="GtkComboBox" id="backspace-binding-combobox"> 
    680                                     <property name="visible">True</property> 
    681                                     <property name="items" translatable="yes">ASCII DEL 
    682 Escape sequence 
    683 Control-H</property> 
    684                                     <signal name="changed" handler="on_backspace_binding_combobox_changed"/> 
    685                                   </widget> 
    686                                   <packing> 
    687                                     <property name="left_attach">1</property> 
    688                                     <property name="right_attach">3</property> 
    689                                     <property name="y_options">GTK_FILL</property> 
    690                                   </packing> 
    691                                 </child> 
    692                                 <child> 
    693                                   <widget class="GtkLabel" id="backspace-binding-combobox-label"> 
    694                                     <property name="visible">True</property> 
    695                                     <property name="xalign">0</property> 
    696                                     <property name="label" translatable="yes">_Backspace key generates:</property> 
    697                                     <property name="use_underline">True</property> 
    698                                     <property name="justify">GTK_JUSTIFY_CENTER</property> 
    699                                     <property name="mnemonic_widget">backspace-binding-combobox</property> 
    700                                   </widget> 
    701                                   <packing> 
    702                                     <property name="x_options">GTK_FILL</property> 
    703                                     <property name="y_options"></property> 
    704                                   </packing> 
    705                                 </child> 
    706                                 <child> 
    707                                   <widget class="GtkLabel" id="delete-binding-combobox-label"> 
    708                                     <property name="visible">True</property> 
    709                                     <property name="xalign">0</property> 
    710                                     <property name="label" translatable="yes">_Delete key generates:</property> 
    711                                     <property name="use_underline">True</property> 
    712                                     <property name="justify">GTK_JUSTIFY_CENTER</property> 
    713                                     <property name="mnemonic_widget">delete-binding-combobox</property> 
    714                                   </widget> 
    715                                   <packing> 
    716                                     <property name="top_attach">1</property> 
    717                                     <property name="bottom_attach">2</property> 
    718                                     <property name="x_options">GTK_FILL</property> 
    719                                     <property name="y_options"></property> 
    720735                                  </packing> 
    721736                                </child> 
  • src/Makefile.am

    r767310e0 rbfa2a8e  
    1010        simplegladeapp.py \ 
    1111        dbusiface.py \ 
    12         statusicon.py \ 
     12        prefs.py \ 
    1313        guake_globals.py 
    1414 
  • src/guake.py

    r1fa4120 rbfa2a8e  
    4141import globalhotkeys 
    4242from simplegladeapp import SimpleGladeApp, bindtextdomain 
    43 from statusicon import GuakeStatusIcon 
    4443from prefs import PrefsDialog, GHOTKEYS 
    4544from common import * 
     
    105104 
    106105        # trayicon! 
    107         tray_icon = GuakeStatusIcon() 
    108         tray_icon.connect('popup-menu', self.show_menu) 
    109         tray_icon.connect('activate', self.show_hide) 
    110         tray_icon.show_all() 
     106        img = pixmapfile('guake-tray.png') 
     107        self.tray_icon = gtk.status_icon_new_from_file(img) 
     108        self.tray_icon.set_tooltip(_('Guake-Terminal')) 
     109        self.tray_icon.connect('popup-menu', self.show_menu) 
     110        self.tray_icon.connect('activate', self.show_hide) 
    111111 
    112112        # adding images from a different path. 
     
    164164        self.add_tab() 
    165165        self.toggle_ontop() 
     166        self.toggle_trayicon() 
    166167 
    167168        # Pop-up that shows that guake is working properly (if not 
     
    439440        b = self.client.get_bool(GCONF_PATH+'general/window_ontop') 
    440441        self.window.set_keep_above(b) 
     442 
     443    def toggle_trayicon(self): 
     444        visible = self.client.get_bool(GCONF_PATH+'general/use_trayicon') 
     445        self.tray_icon.set_visible(visible) 
    441446 
    442447    # -- format functions -- 
  • src/prefs.py

    rf900ed0 rbfa2a8e  
    179179        self.get_widget('show-scrollbar-checkbutton').set_active(ac) 
    180180 
     181        # Tray icon 
     182        ac = self.client.get_bool(GCONF_PATH + 'general/use_trayicon') 
     183        self.get_widget('show-trayicon-checkbutton').set_active(ac) 
     184 
    181185        # hide on lost focus 
    182186        ac = self.client.get_bool(GCONF_PATH + 'general/hide_on_lost_focus') 
     
    299303        self.client.set_bool(GCONF_PATH + 'general/use_scrollbar', fbool) 
    300304        self.guake.toggle_scrollbars() 
     305 
     306    def on_show_trayicon_checkbutton_toggled(self, chk): 
     307        fbool = chk.get_active() 
     308        self.client.set_bool(GCONF_PATH + 'general/use_trayicon', fbool) 
     309        self.guake.toggle_trayicon() 
     310 
     311    def on_show_popup_checkbutton_toggled(self, chk): 
     312        fbool = chk.get_active() 
     313        self.client.set_bool(GCONF_PATH + 'general/use_popup', fbool) 
    301314         
    302315    def on_chk_lostfocus_toggled(self, chk):