8 コミット e1b1d628f9 ... 59c98c4e55

作者 SHA1 メッセージ 日付
  alimiracle e1b1d628f9 add new gui 2 年 前
  masaylighto 59c98c4e55 fix typos && fix logical error && add messagebox 2 年 前
  alimiracle 06ec1332bd Merge branch 'cleancode' of MasayLighto/uruk-cleaner into master 2 年 前
  Masaylighto 7b6342c194 unify message 2 年 前
  alimiracle 9a4534e9ba Merge branch 'cleancode' of MasayLighto/uruk-cleaner into master 2 年 前
  alimiracle e8411124e7 Merge branch 'cleancode' of MasayLighto/uruk-cleaner into master 2 年 前
  Masaylighto a32ac46e5c add message to clean log apt cache pkg remove 2 年 前
  Masaylighto 3b30984171 cleaning the code 2 年 前
8 ファイル変更762 行追加264 行削除
  1. 8 3
      cleaner.css
  2. 190 186
      cleaner.glade
  3. 4 1
      dbus.ucleaner
  4. 45 0
      messagebox.css
  5. 189 0
      messagebox.glade
  6. BIN
      ucleaner.png
  7. 206 0
      ucleaner.svg
  8. 120 74
      uruk-cleaner

+ 8 - 3
cleaner.css

@@ -83,13 +83,18 @@ background-color: white;
 
 .close{
     background-color: #fe653b;
-  
+    min-width: 1px;
+    min-height: 3px;
+
 }
 .minimize{
     background-color: #88e1ff;
-    
+    min-width: 1px;
+    min-height: 3px;
+
 }
 .maximize{
     background-color: #eabaf0;
-  
+    min-width: 1px;
+    min-height: 3px;
 }

+ 190 - 186
cleaner.glade

@@ -1,25 +1,158 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.22.2 -->
 <interface>
   <requires lib="gtk+" version="3.24"/>
   <!-- interface-css-provider-path cleaner.css -->
   <object class="GtkWindow" id="TopWindow">
-    <property name="can-focus">False</property>
+    <property name="can_focus">False</property>
+    <child type="titlebar">
+      <object class="GtkBox" id="header">
+        <property name="height_request">20</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="valign">start</property>
+        <property name="vexpand">True</property>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="valign">start</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <style>
+              <class name="bg-transparent"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="valign">start</property>
+            <property name="margin_end">5</property>
+            <property name="margin_top">5</property>
+            <property name="vexpand">True</property>
+            <property name="spacing">1</property>
+            <property name="homogeneous">True</property>
+            <child>
+              <object class="GtkButton" id="minimizebtn">
+                <property name="width_request">16</property>
+                <property name="height_request">16</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="vexpand">True</property>
+                <property name="resize_mode">immediate</property>
+                <signal name="clicked" handler="minimize" swapped="no"/>
+                <style>
+                  <class name="no-shadow"/>
+                  <class name="no-border"/>
+                  <class name="full-rounded"/>
+                  <class name="close"/>
+                  <class name="minimize"/>
+                  <class name="sm-font"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="maximizebtn">
+                <property name="width_request">16</property>
+                <property name="height_request">16</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="resize_mode">immediate</property>
+                <signal name="clicked" handler="maximize" swapped="no"/>
+                <style>
+                  <class name="no-shadow"/>
+                  <class name="no-border"/>
+                  <class name="full-rounded"/>
+                  <class name="maximize"/>
+                  <class name="sm-font"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="closebtn">
+                <property name="width_request">16</property>
+                <property name="height_request">16</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="resize_mode">immediate</property>
+                <signal name="clicked" handler="close" swapped="no"/>
+                <style>
+                  <class name="no-shadow"/>
+                  <class name="no-border"/>
+                  <class name="full-rounded"/>
+                  <class name="close"/>
+                  <class name="sm-font"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <style>
+              <class name="bg-transparent"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <style>
+          <class name="bg-white"/>
+          <class name="no-border"/>
+          <class name="rounded-top"/>
+        </style>
+      </object>
+    </child>
     <child>
       <object class="GtkBox">
-        <property name="width-request">500</property>
-        <property name="height-request">300</property>
+        <property name="width_request">500</property>
+        <property name="height_request">300</property>
         <property name="visible">True</property>
-        <property name="can-focus">False</property>
+        <property name="can_focus">False</property>
         <property name="halign">center</property>
         <property name="valign">center</property>
         <property name="orientation">vertical</property>
         <child>
           <object class="GtkLabel">
-            <property name="height-request">60</property>
+            <property name="height_request">60</property>
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="margin-top">15</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">15</property>
             <property name="label" translatable="yes">Uruk Cleaner</property>
             <property name="justify">center</property>
             <attributes>
@@ -38,9 +171,9 @@
         <child>
           <object class="GtkLabel">
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="margin-top">30</property>
-            <property name="margin-bottom">30</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">30</property>
+            <property name="margin_bottom">30</property>
             <property name="label" translatable="yes">Chose what to clean</property>
             <attributes>
               <attribute name="size" value="12000"/>
@@ -56,116 +189,115 @@
           </packing>
         </child>
         <child>
-          <!-- n-columns=2 n-rows=3 -->
           <object class="GtkGrid" id="Chechgrid">
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
+            <property name="can_focus">False</property>
             <property name="halign">center</property>
-            <property name="margin-start">20</property>
-            <property name="margin-end">20</property>
-            <property name="margin-top">20</property>
-            <property name="margin-bottom">20</property>
+            <property name="margin_start">20</property>
+            <property name="margin_end">20</property>
+            <property name="margin_top">20</property>
+            <property name="margin_bottom">20</property>
             <property name="hexpand">True</property>
-            <property name="row-spacing">20</property>
-            <property name="column-spacing">40</property>
-            <property name="row-homogeneous">True</property>
-            <property name="column-homogeneous">True</property>
+            <property name="row_spacing">20</property>
+            <property name="column_spacing">40</property>
+            <property name="row_homogeneous">True</property>
+            <property name="column_homogeneous">True</property>
             <child>
               <object class="GtkCheckButton" id="AptCacheChk">
                 <property name="label" translatable="yes">Apt Cache</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="draw-indicator">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
                 <style>
                   <class name="CheckBtn"/>
                   <class name="CheckBtn-Blue"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">0</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
             <child>
               <object class="GtkCheckButton" id="ThumbnailsChk">
                 <property name="label" translatable="yes">Thumbnails</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="draw-indicator">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
                 <style>
                   <class name="CheckBtn"/>
                   <class name="CheckBtn-Pink"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">1</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkCheckButton" id="LogsChk">
                 <property name="label" translatable="yes">System Logs</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="draw-indicator">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
                 <style>
                   <class name="CheckBtn"/>
                   <class name="CheckBtn-Orange"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">1</property>
-                <property name="top-attach">1</property>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkCheckButton" id="UnUsedPkgsChk">
                 <property name="label" translatable="yes">Unused Packages</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="draw-indicator">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
                 <style>
                   <class name="CheckBtn"/>
                   <class name="CheckBtn-Purple"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">1</property>
-                <property name="top-attach">0</property>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
             <child>
               <object class="GtkCheckButton" id="FireFoxChk">
                 <property name="label" translatable="yes">FireFox Cache</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="draw-indicator">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
                 <style>
                   <class name="CheckBtn"/>
                   <class name="CheckBtn-Green"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">2</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
               </packing>
             </child>
             <child>
               <object class="GtkSeparator">
                 <property name="visible">True</property>
-                <property name="can-focus">False</property>
+                <property name="can_focus">False</property>
                 <style>
                   <class name="bg-transparent"/>
                 </style>
               </object>
               <packing>
-                <property name="left-attach">1</property>
-                <property name="top-attach">2</property>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
               </packing>
             </child>
           </object>
@@ -178,11 +310,11 @@
         <child>
           <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
+            <property name="can_focus">False</property>
             <property name="halign">center</property>
             <property name="valign">end</property>
-            <property name="margin-top">40</property>
-            <property name="margin-bottom">20</property>
+            <property name="margin_top">40</property>
+            <property name="margin_bottom">20</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
             <property name="spacing">17</property>
@@ -191,8 +323,8 @@
               <object class="GtkButton" id="AboutBtn">
                 <property name="label" translatable="yes">About</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
                 <style>
                   <class name="text-white"/>
                   <class name="bg-orange"/>
@@ -210,11 +342,11 @@
             <child>
               <object class="GtkButton" id="CleanBtn">
                 <property name="label" translatable="yes">Clean</property>
-                <property name="width-request">100</property>
-                <property name="height-request">40</property>
+                <property name="width_request">100</property>
+                <property name="height_request">40</property>
                 <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
                 <signal name="clicked" handler="Clean" swapped="no"/>
                 <style>
                   <class name="text-white"/>
@@ -242,134 +374,6 @@
         </style>
       </object>
     </child>
-    <child type="titlebar">
-      <object class="GtkBox" id="header">
-        <property name="height-request">20</property>
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="valign">start</property>
-        <property name="vexpand">True</property>
-        <child>
-          <object class="GtkSeparator">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="valign">start</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
-            <style>
-              <class name="bg-transparent"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="halign">end</property>
-            <property name="valign">start</property>
-            <property name="margin-end">5</property>
-            <property name="margin-top">5</property>
-            <property name="vexpand">True</property>
-            <property name="spacing">2</property>
-            <property name="homogeneous">True</property>
-            <child>
-              <object class="GtkButton" id="minimizebtn">
-                <property name="width-request">20</property>
-                <property name="height-request">20</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="valign">center</property>
-                <property name="vexpand">True</property>
-                <property name="resize-mode">immediate</property>
-                <signal name="clicked" handler="minimize" swapped="no"/>
-                <style>
-                  <class name="no-shadow"/>
-                  <class name="no-border"/>
-                  <class name="full-rounded"/>
-                  <class name="close"/>
-                  <class name="minimize"/>
-                  <class name="sm-font"/>
-                </style>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="maximizebtn">
-                <property name="width-request">20</property>
-                <property name="height-request">20</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="valign">center</property>
-                <property name="vexpand">True</property>
-                <property name="resize-mode">immediate</property>
-                <signal name="clicked" handler="maximize" swapped="no"/>
-                <style>
-                  <class name="no-shadow"/>
-                  <class name="no-border"/>
-                  <class name="full-rounded"/>
-                  <class name="maximize"/>
-                  <class name="sm-font"/>
-                </style>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="closebtn">
-                <property name="width-request">20</property>
-                <property name="height-request">20</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="valign">center</property>
-                <property name="vexpand">True</property>
-                <property name="resize-mode">immediate</property>
-                <signal name="clicked" handler="close" swapped="no"/>
-                <style>
-                  <class name="no-shadow"/>
-                  <class name="no-border"/>
-                  <class name="full-rounded"/>
-                  <class name="close"/>
-                  <class name="sm-font"/>
-                </style>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <style>
-              <class name="bg-transparent"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <style>
-          <class name="bg-white"/>
-          <class name="no-border"/>
-          <class name="rounded-top"/>
-        </style>
-      </object>
-    </child>
     <style>
       <class name="bg-white"/>
       <class name="rounded-bottom"/>

+ 4 - 1
dbus.ucleaner

@@ -20,19 +20,22 @@ class Ucleaner(dbus.service.Object):
         dbus.service.Object.__init__(self, bus_name, OPATH)
 
     @dbus.service.method(IFACE, out_signature='s')
+
     def clean_apt_cache(self):
         dir_name = "/var/cache/apt/archives"
         test_dir = os.listdir(dir_name)
+
         for item in test_dir:
             if item.endswith(".deb"):
                 os.remove(os.path.join(dir_name, item))
         return ""
     @dbus.service.method(IFACE, out_signature='s')
+
     def clean_logs(self):
         os.system("/usr/bin/log-c.sh")
         return ""
     @dbus.service.method(IFACE, out_signature='s')
-    def remove_unused_packages(self):
+    def auto_remove_pkgs(self):
         os.system("apt-get purge autoremove -y")
         return ""
 

+ 45 - 0
messagebox.css

@@ -0,0 +1,45 @@
+.bg-white
+{
+background-color: white;
+
+}
+.bg-transparent{
+
+    background-color: transparent;
+}
+.no-border{
+    border: none;
+}
+.no-shadow{
+    box-shadow: none;
+}
+.rounded{
+    border-radius:10px ;
+}
+
+.rounded-top{
+
+    border-top-left-radius:10px ;
+    border-top-right-radius:10px ;
+}
+.rounded-bottom{
+
+    border-bottom-left-radius:10px ;
+    border-bottom-right-radius:10px ;
+}
+.full-rounded{
+    border-radius: 100px;
+}
+.sm-font{
+    font-size: 8px;
+
+}
+
+.close{
+    background-color: #f34c4c;
+    min-width: 1px;
+    min-height: 3px;
+}
+.bg-blue{
+    background-color: #78cdf6;
+}

+ 189 - 0
messagebox.glade

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2 -->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <!-- interface-css-provider-path messagebox.css -->
+  <object class="GtkDialog" id="TopWindow">
+    <property name="width_request">400</property>
+    <property name="height_request">300</property>
+    <property name="can_focus">False</property>
+    <property name="type_hint">dialog</property>
+    <child type="titlebar">
+      <object class="GtkBox" id="header">
+        <property name="height_request">20</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="valign">start</property>
+        <property name="vexpand">True</property>
+        <child>
+          <object class="GtkLabel" id="TitleLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">label</property>
+            <property name="justify">center</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="valign">start</property>
+            <property name="margin_right">5</property>
+            <property name="margin_end">5</property>
+            <property name="margin_top">5</property>
+            <property name="vexpand">True</property>
+            <property name="spacing">1</property>
+            <property name="homogeneous">True</property>
+            <child>
+              <object class="GtkButton" id="closebtn">
+                <property name="width_request">17</property>
+                <property name="height_request">17</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="resize_mode">immediate</property>
+                <property name="relief">none</property>
+                <style>
+                  <class name="no-shadow"/>
+                  <class name="no-border"/>
+                  <class name="full-rounded"/>
+                  <class name="close"/>
+                  <class name="sm-font"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <style>
+              <class name="bg-transparent"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <style>
+          <class name="bg-white"/>
+          <class name="no-border"/>
+          <class name="rounded-top"/>
+        </style>
+      </object>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton">
+                <property name="label" translatable="yes">Ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <signal name="clicked" handler="ok_btn_click" swapped="no"/>
+                <style>
+                  <class name="bg-blue"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <child>
+              <object class="GtkLabel" id="MessageLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="label" translatable="yes">message content</property>
+                <property name="justify">center</property>
+                <property name="wrap">True</property>
+                <attributes>
+                  <attribute name="size" value="15000"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <style>
+              <class name="bg-transparent"/>
+              <class name="no-shadow"/>
+              <class name="no-border"/>
+            </style>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <style>
+      <class name="bg-white"/>
+      <class name="rounded-bottom"/>
+      <class name="no-border"/>
+    </style>
+  </object>
+</interface>

BIN
ucleaner.png


ファイルの差分が大きいため隠しています
+ 206 - 0
ucleaner.svg


+ 120 - 74
uruk-cleaner

@@ -1,74 +1,120 @@
-import gi
-gi.require_version("Gtk", "3.0")
-from gi.repository import Gtk
-gi.require_version('Gdk', '3.0')
-from gi.repository import Gdk
-import dbus
-from _dbus_bindings import BUS_DAEMON_IFACE, BUS_DAEMON_NAME, BUS_DAEMON_PATH
-import os
-class Cleaner:
-  def __init__(self):
-    timeout = 60
-    flags = 0
-    bus_name = "org.dbus.ucleaner"
-    opath = "/org/ucleaner"
-    #get the system bus
-    bus = dbus.SystemBus()
-    bus.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH, BUS_DAEMON_IFACE,'StartServiceByName', 'su', (bus_name, flags), timeout=timeout)
-    #get the object
-    dbus_object = bus.get_object(bus_name, opath)
-    #get the interface
-    self.dbus_interface = dbus.Interface(dbus_object, "org.ucleaner")
-
-  def clene_apt_cach(self):
-    self.dbus_interface.clean_apt_cache()           
-    def clene_logs(self):
-    self.dbus_interface.clean_logs()            
-  def remove_unused_pkgs(self):
-    self.dbus_interface.remove_unused_packages()
-  def remove_thumbnails(self):
-    os.system("rm -rf ~/.cache/thumbnails/*")             
-  def clene_firefox_cach(self):
-    os.system("rm ~/.mozilla/firefox/*.default*/*.sqlite ~/.mozilla/firefox/*default*/sessionstore.js")
-    os.system("rm -r ~/.cache/mozilla/firefox/*.default*/*")
-
-class GUI:
-  def __init__(self):
-    self.__lode_css()
-    self.cleaner=cleaner()
-    self.gladefile = "cleaner.glade"
-    self.builder = Gtk.Builder()
-    self.builder.add_from_file(self.gladefile)
-    self.builder.connect_signals(self)
-    self.window = self.builder.get_object("TopWindow")
-    self.window.show()
-  def __lode_css(self):
-    screen = Gdk.Screen.get_default()
-    provider = Gtk.CssProvider()
-    provider.load_from_path("cleaner.css")
-    Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
-  def maximize(self, button):
-    Gtk.Window.maximize(self.window)
-  def minimize(self, button):
-    Gtk.Window.minimize(self.window)
-  def close(self, *args):
-    Gtk.main_quit()
-  def Clean(self, button):
-    if self.builder.get_object("AptCacheChk").get_active():
-        self.clener.clene_apt_cach()
-#        Gtk.main_quit()
-
-    if self.builder.get_object("LogsChk").get_active():
-        self.clener.clene_logs()
-
-    if self.builder.get_object("UnUsedPkgsChk").get_active():
-        self.clener.remove_unused_pkgs()
-    if self.builder.get_object("ThumbnailsChk").get_active():
-self.clener.remove_thumbnails()
-    if self.builder.get_object("FireFoxChk").get_active():
-        self.clener.clene_firefox_cach()
-
-    status = self.builder.get_object("AptCacheChk").get_active() or self.builder.get_object("LogsChk").get_active() or self.builder.get_object("UnUsedPkgsChk").get_active() or self.builder.get_object("ThumbnailsChk").get_active() or self.builder.get_object("FireFoxChk").get_active() 
-if __name__ == "__main__":
-  main = GUI()
-  Gtk.main()
+
+import gi
+gi.require_version("Gtk", "3.0")
+from gi.repository import Gtk
+gi.require_version('Gdk', '3.0')
+from gi.repository import Gdk
+import dbus
+from _dbus_bindings import BUS_DAEMON_IFACE, BUS_DAEMON_NAME, BUS_DAEMON_PATH
+import os
+class MessageBox:
+  def __init__(self,message_title,message_content):
+    self.__load_css()
+    self.__load_glade("messagebox.glade")
+    self.__extract_widget() 
+    self.set_content(message_content)
+    self.set_title(message_title)
+  def set_title(self,title):
+    self.title_label.set_text(title)
+  def set_content(self,content):
+    self.content_label.set_text(content)
+    pass
+  def __load_glade(self,glade_file):  
+    self.builder = Gtk.Builder()
+    self.builder.add_from_file(glade_file)
+    self.builder.connect_signals(self)    
+  def __extract_widget(self):
+    self.window = self.builder.get_object("TopWindow")
+    self.title_label = self.builder.get_object("TitleLabel")
+    self.content_label = self.builder.get_object("MessageLabel")
+  def show(self):
+    self.window.show()
+  def __load_css(self):
+    screen = Gdk.Screen.get_default()
+    provider = Gtk.CssProvider()
+    provider.load_from_path("messagebox.css")
+    Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+  def ok_btn_click(self, *args):
+     self.window.close()
+class Cleaner:
+  def __init__(self):
+    timeout = 60
+    flags = 0
+    bus_name = "org.dbus.ucleaner"
+    opath = "/org/ucleaner"
+    #get the system bus
+    bus = dbus.SystemBus()
+    bus.call_blocking(BUS_DAEMON_NAME, BUS_DAEMON_PATH, BUS_DAEMON_IFACE,'StartServiceByName', 'su', (bus_name, flags), timeout=timeout)
+    #get the object
+    dbus_object = bus.get_object(bus_name, opath)
+    #get the interface
+    self.dbus_interface = dbus.Interface(dbus_object, "org.ucleaner")
+
+  def clean_apt_cache(self):
+    self.dbus_interface.clean_apt_cache()           
+  def clean_logs(self):
+    self.dbus_interface.clean_logs()            
+  def remove_unused_pkgs(self):
+    self.dbus_interface.auto_remove_pkgs()
+  def remove_thumbnails(self):
+    os.system("rm -rf ~/.cache/thumbnails/*")             
+  def clean_firefox_cache(self):
+    os.system("rm ~/.mozilla/firefox/*.default*/*.sqlite ~/.mozilla/firefox/*default*/sessionstore.js")
+    os.system("rm -r ~/.cache/mozilla/firefox/*.default*/*")
+
+class GUI:
+  IsWindowMaximized=False
+  def __init__(self):
+    self.cleaner=Cleaner()
+    self.__load_glade("cleaner.glade")
+    self.__load_css()    
+    self.__extract_widget()
+  def __load_glade(self,glade_file):
+    self.builder = Gtk.Builder()
+    self.builder.add_from_file(glade_file)
+    self.builder.connect_signals(self)
+  def __extract_widget(self):
+    self.window = self.builder.get_object("TopWindow")
+  def show(self):
+    self.window.show()
+  def __load_css(self):
+    screen = Gdk.Screen.get_default()
+    provider = Gtk.CssProvider()
+    provider.load_from_path("cleaner.css")
+    Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+  def maximize(self, button):
+    if IsWindowMaximized:
+        Gtk.Window.normlize(self.window)
+        IsWindowMaximized=False
+        return
+    Gtk.Window.maximize(self.window)
+  def minimize(self, button):
+    Gtk.Window.minimize(self.window)
+  def close(self, *args):
+    Gtk.main_quit()
+    exit(0)
+  def Clean(self, button):
+    status=False
+    if self.builder.get_object("AptCacheChk").get_active():
+        status=True
+        self.cleaner.clean_apt_cache()
+    if self.builder.get_object("LogsChk").get_active():
+        status=True
+        self.cleaner.clean_logs()
+    if self.builder.get_object("UnUsedPkgsChk").get_active():
+        status=True
+        self.cleaner.remove_unused_pkgs()
+    if self.builder.get_object("ThumbnailsChk").get_active():
+        status=True
+        self.cleaner.remove_thumbnails()
+    if self.builder.get_object("FireFoxChk").get_active():
+        status=True
+        self.cleaner.clean_firefox_cache()
+    if status:
+        MessageBox("Result","Cleaning Completed").show()
+        return
+    MessageBox("Error","Select At Least one Task").show()
+if __name__ == "__main__":
+  main = GUI()
+  main.show()
+  Gtk.main()