Converted recent plugin
This commit is contained in:
parent
bef171028d
commit
9289b7a0e0
@ -1430,7 +1430,7 @@ class pluginclass( object ):
|
|||||||
self.favorites.append( favButton )
|
self.favorites.append( favButton )
|
||||||
self.favoritesPositionOnGrid( favButton )
|
self.favoritesPositionOnGrid( favButton )
|
||||||
favButton.connect( "drag_data_received", self.onFavButtonDragReorder )
|
favButton.connect( "drag_data_received", self.onFavButtonDragReorder )
|
||||||
#FIX # favButton.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.fromFav, gtk.gdk.ACTION_COPY )
|
#FIX favButton.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, self.fromFav, gtk.gdk.ACTION_COPY )
|
||||||
favButton.connect( "drag_data_get", self.onFavButtonDragReorderGet )
|
favButton.connect( "drag_data_get", self.onFavButtonDragReorderGet )
|
||||||
#FIX # favButton.drag_source_set( gtk.gdk.BUTTON1_MASK, self.toFav, gtk.gdk.ACTION_COPY )
|
#FIX # favButton.drag_source_set( gtk.gdk.BUTTON1_MASK, self.toFav, gtk.gdk.ACTION_COPY )
|
||||||
position += 1
|
position += 1
|
||||||
|
@ -1,107 +1,100 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
|
||||||
<!--*- mode: xml -*-->
|
<!--*- mode: xml -*-->
|
||||||
<glade-interface>
|
<interface>
|
||||||
<widget class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
<property name="title" translatable="yes">window1</property>
|
<property name="title" translatable="yes">window1</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEventBox" id="eventbox1">
|
<object class="GtkEventBox" id="eventbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkNotebook" id="RecentTabs">
|
<object class="GtkNotebook" id="RecentTabs">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="show_tabs">False</property>
|
<property name="show_tabs">False</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkViewport" id="viewport2">
|
<object class="GtkViewport" id="viewport2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVButtonBox" id="RecentApps">
|
<object class="GtkVButtonBox" id="RecentApps">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child type="tab">
|
||||||
<widget class="GtkLabel" id="label2">
|
<object class="GtkLabel" id="label2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Applications</property>
|
<property name="label" translatable="yes">Applications</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="type">tab</property>
|
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkViewport" id="viewport1">
|
<object class="GtkViewport" id="viewport1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVButtonBox" id="RecentBox">
|
<object class="GtkVButtonBox" id="RecentBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child type="tab">
|
||||||
<widget class="GtkLabel" id="label3">
|
<object class="GtkLabel" id="label3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Documents</property>
|
<property name="label" translatable="yes">Documents</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="type">tab</property>
|
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="ClrBtn">
|
<object class="GtkButton" id="ClrBtn">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">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>
|
<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">gtk-clear</property>
|
<property name="label" translatable="yes">gtk-clear</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="response_id">0</property>
|
<signal handler="on_ClrBtn_clicked" name="clicked"/>
|
||||||
<signal name="clicked" handler="on_ClrBtn_clicked"/>
|
</object>
|
||||||
</widget>
|
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</glade-interface>
|
</interface>
|
||||||
|
107
usr/lib/linuxmint/mintMenu/plugins/recent.glade.old
Normal file
107
usr/lib/linuxmint/mintMenu/plugins/recent.glade.old
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
|
<!--*- mode: xml -*-->
|
||||||
|
<glade-interface>
|
||||||
|
<widget class="GtkWindow" id="window1">
|
||||||
|
<property name="title" translatable="yes">window1</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEventBox" id="eventbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkNotebook" id="RecentTabs">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="show_tabs">False</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkViewport" id="viewport2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVButtonBox" id="RecentApps">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Applications</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
<property name="tab_fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkViewport" id="viewport1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVButtonBox" id="RecentBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Documents</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
<property name="tab_fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="ClrBtn">
|
||||||
|
<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>
|
||||||
|
<property name="label" translatable="yes">gtk-clear</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="response_id">0</property>
|
||||||
|
<signal name="clicked" handler="on_ClrBtn_clicked"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</glade-interface>
|
@ -1,19 +1,17 @@
|
|||||||
import gtk
|
import gi
|
||||||
import gtk.glade
|
gi.require_version("Gtk", "2.0")
|
||||||
|
|
||||||
|
from gi.repository import Gtk, Pango
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import gobject
|
import gobject
|
||||||
import datetime
|
import datetime
|
||||||
import mateconf
|
|
||||||
import fcntl
|
import fcntl
|
||||||
import pango
|
from easygsettings import EasyGSettings
|
||||||
from execute import Execute
|
from execute import Execute
|
||||||
from easygconf import *
|
|
||||||
from easyfiles import *
|
from easyfiles import *
|
||||||
from easybuttons import *
|
from easybuttons import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class pluginclass:
|
class pluginclass:
|
||||||
"""This is the main class for the plugin"""
|
"""This is the main class for the plugin"""
|
||||||
"""It MUST be named pluginclass"""
|
"""It MUST be named pluginclass"""
|
||||||
@ -24,20 +22,18 @@ class pluginclass:
|
|||||||
self.toggleButton = toggleButton
|
self.toggleButton = toggleButton
|
||||||
self.de = de
|
self.de = de
|
||||||
|
|
||||||
|
self.builder = Gtk.Builder()
|
||||||
#The Glade file for the plugin
|
#The Glade file for the plugin
|
||||||
self.gladefile = os.path.join( os.path.dirname( __file__ ), "recent.glade" )
|
self.builder.add_from_file (os.path.join( os.path.dirname( __file__ ), "recent.glade" ))
|
||||||
|
|
||||||
#Read GLADE file
|
|
||||||
self.wTree = gtk.glade.XML( self.gladefile, "window1" )
|
|
||||||
|
|
||||||
#Set 'window' property for the plugin (Must be the root widget)
|
#Set 'window' property for the plugin (Must be the root widget)
|
||||||
self.window = self.wTree.get_widget( "window1" )
|
self.window = self.builder.get_object( "window1" )
|
||||||
|
|
||||||
#Set 'heading' property for plugin
|
#Set 'heading' property for plugin
|
||||||
self.heading = _("Recent documents")
|
self.heading = _("Recent documents")
|
||||||
|
|
||||||
#This should be the first item added to the window in glade
|
#This should be the first item added to the window in glade
|
||||||
self.content_holder = self.wTree.get_widget( "eventbox1" )
|
self.content_holder = self.builder.get_object( "eventbox1" )
|
||||||
|
|
||||||
#Specify plugin width
|
#Specify plugin width
|
||||||
self.width = 250
|
self.width = 250
|
||||||
@ -45,53 +41,50 @@ class pluginclass:
|
|||||||
#Plugin icon
|
#Plugin icon
|
||||||
self.icon = 'mate-folder.png'
|
self.icon = 'mate-folder.png'
|
||||||
|
|
||||||
self.gconf_dir = '/apps/mintMenu/plugins/recent'
|
self.settings = EasyGSettings ("com.linuxmint.mintmenu.plugins.recent")
|
||||||
self.client = mateconf.client_get_default()
|
|
||||||
self.client.add_dir( '/apps/mintMenu/plugins/recent', mateconf.CLIENT_PRELOAD_NONE )
|
self.settings.notifyAdd( 'height', self.RegenPlugin )
|
||||||
self.client.notify_add( '/apps/mintMenu/plugins/recent/height', self.RegenPlugin )
|
self.settings.notifyAdd( 'width', self.RegenPlugin )
|
||||||
self.client.notify_add( '/apps/mintMenu/plugins/recent/width', self.RegenPlugin )
|
self.settings.notifyAdd( 'num-recent-docs', self.RegenPlugin )
|
||||||
self.client.notify_add( '/apps/mintMenu/plugins/recent/num_recent_docs_to_show', self.RegenPlugin )
|
self.settings.notifyAdd( 'recent-font-size', self.RegenPlugin )
|
||||||
self.client.notify_add( '/apps/mintMenu/plugins/recent/recent_font_size', self.RegenPlugin )
|
|
||||||
|
|
||||||
self.FileList=[]
|
self.FileList=[]
|
||||||
self.RecManagerInstance = gtk.recent_manager_get_default()
|
self.RecManagerInstance = Gtk.RecentManager.get_default()
|
||||||
self.RecManagerInstance.connect("changed",self.DoRecent)
|
self.RecManagerInstance.connect("changed", self.DoRecent)
|
||||||
|
|
||||||
|
|
||||||
self.RegenPlugin()
|
self.RegenPlugin()
|
||||||
self.wTree.get_widget( "RecentTabs" ).set_current_page(1)
|
self.builder.get_object( "RecentTabs" ).set_current_page(1)
|
||||||
|
|
||||||
#Connect event handlers
|
#Connect event handlers
|
||||||
dic = { "on_ClrBtn_clicked" : self.clrmenu}
|
self.builder.get_object("ClrBtn").connect("clicked", self.clrmenu)
|
||||||
self.wTree.signal_autoconnect( dic )
|
|
||||||
|
|
||||||
def wake (self) :
|
def wake (self) :
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def RegenPlugin( self, *args, **kargs ):
|
def RegenPlugin( self, *args, **kargs ):
|
||||||
self.GetGconfEntries()
|
self.GetGSettingsEntries()
|
||||||
|
|
||||||
def GetGconfEntries( self ):
|
def GetGSettingsEntries( self ):
|
||||||
self.gconf = EasyGConf( "/apps/mintMenu/plugins/recent/" )
|
self.recenth = self.settings.get( 'int', 'height' )
|
||||||
self.recenth = self.gconf.get( 'int', 'height', 385 )
|
self.recentw = self.settings.get( 'int', 'width' )
|
||||||
self.recentw = self.gconf.get( 'int', 'width', 250 )
|
self.numentries = self.settings.get( 'int', 'num-recent-docs' )
|
||||||
self.numentries = self.gconf.get( 'int', 'num_recent_docs_to_show', 10 )
|
self.recentfontsize = self.settings.get( 'int', 'recent-font-size' )
|
||||||
self.recentfontsize = self.gconf.get( 'int', 'recent_font_size', 9 )
|
|
||||||
|
|
||||||
# Hide vertical dotted separator
|
# Hide vertical dotted separator
|
||||||
self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
|
self.hideseparator = self.settings.get( "bool", "hide-separator" )
|
||||||
# Plugin icon
|
# Plugin icon
|
||||||
self.icon = self.gconf.get( "string", 'icon', "mate-fs-directory" )
|
self.icon = self.settings.get( "string", 'icon' )
|
||||||
# Allow plugin to be minimized to the left plugin pane
|
# Allow plugin to be minimized to the left plugin pane
|
||||||
self.sticky = self.gconf.get( "bool", "sticky", False )
|
self.sticky = self.settings.get( "bool", "sticky" )
|
||||||
self.minimized = self.gconf.get( "bool", "minimized", False )
|
self.minimized = self.settings.get( "bool", "minimized" )
|
||||||
self.RebuildPlugin()
|
self.RebuildPlugin()
|
||||||
|
|
||||||
def SetHidden( self, state ):
|
def SetHidden( self, state ):
|
||||||
if state == True:
|
if state == True:
|
||||||
self.gconf.set( "bool", "minimized", True )
|
self.settings.set( "bool", "minimized", True )
|
||||||
else:
|
else:
|
||||||
self.gconf.set( "bool", "minimized", False )
|
self.settings.set( "bool", "minimized", False )
|
||||||
|
|
||||||
|
|
||||||
def RebuildPlugin(self):
|
def RebuildPlugin(self):
|
||||||
@ -100,16 +93,16 @@ class pluginclass:
|
|||||||
|
|
||||||
|
|
||||||
def DoRecent( self, *args, **kargs ):
|
def DoRecent( self, *args, **kargs ):
|
||||||
for i in self.wTree.get_widget( "RecentBox" ).get_children():
|
for i in self.builder.get_object( "RecentBox" ).get_children():
|
||||||
i.destroy()
|
i.destroy()
|
||||||
|
|
||||||
self.wTree.get_widget( "vbox1" ).set_size_request( self.recentw, self.recenth )
|
self.builder.get_object( "vbox1" ).set_size_request( self.recentw, self.recenth )
|
||||||
if len( self.wTree.get_widget( "RecentBox" ).get_children() ) < self.numentries:
|
if len( self.builder.get_object( "RecentBox" ).get_children() ) < self.numentries:
|
||||||
n=len( self.wTree.get_widget( "RecentBox" ).get_children() )-1
|
n=len( self.builder.get_object( "RecentBox" ).get_children() )-1
|
||||||
else:
|
else:
|
||||||
n=self.numentries-1
|
n=self.numentries-1
|
||||||
while n >= 0:
|
while n >= 0:
|
||||||
self.wTree.get_widget( "RecentBox" ).remove( self.wTree.get_widget( "RecentBox" ).get_children()[n] )
|
self.builder.get_object( "RecentBox" ).remove( self.builder.get_object( "RecentBox" ).get_children()[n] )
|
||||||
n-=1
|
n-=1
|
||||||
|
|
||||||
self.FileList, self.IconList = self.GetRecent()
|
self.FileList, self.IconList = self.GetRecent()
|
||||||
@ -128,27 +121,30 @@ class pluginclass:
|
|||||||
def AddRecentBtn( self, Name, RecentImage ):
|
def AddRecentBtn( self, Name, RecentImage ):
|
||||||
DispName=os.path.basename( Name )
|
DispName=os.path.basename( Name )
|
||||||
|
|
||||||
AButton = gtk.Button( "", "ok", True )
|
AButton = Gtk.Button( "", "ok", True )
|
||||||
AButton.remove( AButton.get_children()[0] )
|
AButton.remove( AButton.get_children()[0] )
|
||||||
AButton.set_size_request( 200, -1 )
|
AButton.set_size_request( 200, -1 )
|
||||||
AButton.set_relief( gtk.RELIEF_NONE )
|
AButton.set_relief( Gtk.ReliefStyle.NONE )
|
||||||
AButton.connect( "clicked", self.callback, Name )
|
AButton.connect( "clicked", self.callback, Name )
|
||||||
|
|
||||||
Align1 = gtk.Alignment( 0, 0.5, 0, 0 )
|
Align1 = Gtk.Alignment()
|
||||||
|
Align1.set( 0, 0.5, 0, 0)
|
||||||
Align1.set_padding( 0, 0, 0, 0 )
|
Align1.set_padding( 0, 0, 0, 0 )
|
||||||
HBox1 = gtk.HBox( False, 5 )
|
HBox1 = Gtk.HBox( False, 5 )
|
||||||
VBox1 = gtk.VBox( False, 2 )
|
VBox1 = Gtk.VBox( False, 2 )
|
||||||
|
|
||||||
VBox1.show()
|
VBox1.show()
|
||||||
|
|
||||||
|
req = Gtk.Requisition()
|
||||||
|
AButton.size_request(req)
|
||||||
|
|
||||||
Label1 = gtk.Label( DispName )
|
Label1 = Gtk.Label( DispName )
|
||||||
Label1.set_size_request( AButton.size_request()[0]-20, -1 )
|
Label1.set_size_request( req.width-20, -1 )
|
||||||
Label1.set_ellipsize( pango.ELLIPSIZE_END )
|
Label1.set_ellipsize( Pango.EllipsizeMode.END )
|
||||||
Label1.show()
|
Label1.show()
|
||||||
VBox1.add( Label1 )
|
VBox1.add( Label1 )
|
||||||
|
|
||||||
ButtonIcon = gtk.Image()
|
ButtonIcon = Gtk.Image()
|
||||||
ButtonIcon.set_from_pixbuf(RecentImage)
|
ButtonIcon.set_from_pixbuf(RecentImage)
|
||||||
HBox1.add( ButtonIcon )
|
HBox1.add( ButtonIcon )
|
||||||
|
|
||||||
@ -160,18 +156,18 @@ class pluginclass:
|
|||||||
AButton.add( Align1 )
|
AButton.add( Align1 )
|
||||||
AButton.show()
|
AButton.show()
|
||||||
|
|
||||||
self.wTree.get_widget( "RecentBox" ).pack_start( AButton, False, True, 0 )
|
self.builder.get_object( "RecentBox" ).pack_start( AButton, False, True, 0 )
|
||||||
|
|
||||||
def callback(self, widget, filename=None):
|
def callback(self, widget, filename=None):
|
||||||
self.Win.hide()
|
self.Win.hide()
|
||||||
|
|
||||||
x = os.system("gvfs-open \""+filename+"\"")
|
x = os.system("gvfs-open \""+filename+"\"")
|
||||||
if x == 256:
|
if x == 256:
|
||||||
dia = gtk.Dialog('File not found!',
|
dia = Gtk.Dialog('File not found!',
|
||||||
None, #the toplevel wgt of your app
|
None, #the toplevel wgt of your app
|
||||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, #binary flags or'ed together
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, #binary flags or'ed together
|
||||||
("Ok", 77))
|
("Ok", 77))
|
||||||
dia.vbox.pack_start(gtk.Label('The location or file could not be found!'))
|
dia.vbox.pack_start(Gtk.Label('The location or file could not be found!'), False, False, 0)
|
||||||
dia.vbox.show_all()
|
dia.vbox.show_all()
|
||||||
dia.show()
|
dia.show()
|
||||||
result = dia.run()
|
result = dia.run()
|
||||||
@ -191,7 +187,7 @@ class pluginclass:
|
|||||||
MaxEntries=len(RecentInfo)
|
MaxEntries=len(RecentInfo)
|
||||||
for items in RecentInfo:
|
for items in RecentInfo:
|
||||||
FileString.append(items.get_uri_display())
|
FileString.append(items.get_uri_display())
|
||||||
IconString.append(items.get_icon(gtk.ICON_SIZE_MENU))
|
IconString.append(items.get_icon(Gtk.IconSize.MENU))
|
||||||
count+=1
|
count+=1
|
||||||
if count >= MaxEntries:
|
if count >= MaxEntries:
|
||||||
break
|
break
|
||||||
|
@ -405,9 +405,58 @@
|
|||||||
<summary></summary>
|
<summary></summary>
|
||||||
<description></description>
|
<description></description>
|
||||||
</key>
|
</key>
|
||||||
|
</schema>
|
||||||
|
|
||||||
|
<schema id="com.linuxmint.mintmenu.plugins.recent" path="/com/linuxmint/mintmenu/plugins/recent/">
|
||||||
|
|
||||||
|
<key type="i" name="width">
|
||||||
|
<default>250</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="i" name="height">
|
||||||
|
<default>385</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="i" name="num-recent-docs">
|
||||||
|
<default>10</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="i" name="recent-font-size">
|
||||||
|
<default>9</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="b" name="hide-separator">
|
||||||
|
<default>false</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="s" name="icon">
|
||||||
|
<default>"mate-fs-directory"</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="b" name="sticky">
|
||||||
|
<default>false</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key type="b" name="minimized">
|
||||||
|
<default>false</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
|
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
Loading…
Reference in New Issue
Block a user