🚧 fix toggle for groups
This commit is contained in:
		
							parent
							
								
									5be4a75d7b
								
							
						
					
					
						commit
						e176a74b51
					
				| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
    "style_path": "/usr/share/cachyos-hello/ui/style.css",
 | 
					    "style_path": "/usr/share/cachyos-hello/ui/style.css",
 | 
				
			||||||
    "urls": {
 | 
					    "urls": {
 | 
				
			||||||
        "development": "https://github.com/cachyos",
 | 
					        "development": "https://github.com/cachyos",
 | 
				
			||||||
        "discover": "https://github.com/cachyos/cachyos-pkgbuilds",
 | 
					        "software": "https://github.com/cachyos/cachyos-pkgbuilds",
 | 
				
			||||||
        "donate": "https://cachyos.org/donate",
 | 
					        "donate": "https://cachyos.org/donate",
 | 
				
			||||||
        "forum": "https://forum.cachyos.org",
 | 
					        "forum": "https://forum.cachyos.org",
 | 
				
			||||||
        "telegram": "https://t.me/+oR-kWT47vRdmMDli",
 | 
					        "telegram": "https://t.me/+oR-kWT47vRdmMDli",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,9 +95,9 @@ impl ApplicationBrowser {
 | 
				
			||||||
            String::static_type(),
 | 
					            String::static_type(),
 | 
				
			||||||
            String::static_type(),
 | 
					            String::static_type(),
 | 
				
			||||||
            String::static_type(),
 | 
					            String::static_type(),
 | 
				
			||||||
            bool::static_type(),
 | 
					            i32::static_type(),
 | 
				
			||||||
            String::static_type(),
 | 
					            String::static_type(),
 | 
				
			||||||
            bool::static_type(),
 | 
					            i32::static_type(),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Self {
 | 
					        Self {
 | 
				
			||||||
| 
						 | 
					@ -146,9 +146,9 @@ impl ApplicationBrowser {
 | 
				
			||||||
                    (ICON, &g_icon),
 | 
					                    (ICON, &g_icon),
 | 
				
			||||||
                    (APPLICATION, &g_name),
 | 
					                    (APPLICATION, &g_name),
 | 
				
			||||||
                    (DESCRIPTION, &g_desc),
 | 
					                    (DESCRIPTION, &g_desc),
 | 
				
			||||||
                    (ACTIVE, &false),
 | 
					                    (ACTIVE, &-1),
 | 
				
			||||||
                    (PACKAGE, &None::<String>),
 | 
					                    (PACKAGE, &None::<String>),
 | 
				
			||||||
                    (INSTALLED, &false),
 | 
					                    (INSTALLED, &-1),
 | 
				
			||||||
                ]);
 | 
					                ]);
 | 
				
			||||||
                store_size += 1;
 | 
					                store_size += 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -291,13 +291,11 @@ fn treeview_cell_app_data_function(
 | 
				
			||||||
    model: >k::TreeModel,
 | 
					    model: >k::TreeModel,
 | 
				
			||||||
    iter_a: >k::TreeIter,
 | 
					    iter_a: >k::TreeIter,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
    let value_gobj = model.value(iter_a, INSTALLED as i32);
 | 
					    let value_gobj = model.value(iter_a, INSTALLED as i32).get::<i32>();
 | 
				
			||||||
    let value = value_gobj.get::<bool>().unwrap();
 | 
					    match value_gobj {
 | 
				
			||||||
    if value {
 | 
					        Ok(1) | Ok(0) => renderer_cell.set_width(280),
 | 
				
			||||||
        renderer_cell.set_width(600);
 | 
					        _ => (),
 | 
				
			||||||
    } else {
 | 
					    };
 | 
				
			||||||
        renderer_cell.set_width(400);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn treeview_cell_check_data_function(
 | 
					fn treeview_cell_check_data_function(
 | 
				
			||||||
| 
						 | 
					@ -306,9 +304,9 @@ fn treeview_cell_check_data_function(
 | 
				
			||||||
    model: >k::TreeModel,
 | 
					    model: >k::TreeModel,
 | 
				
			||||||
    iter_a: >k::TreeIter,
 | 
					    iter_a: >k::TreeIter,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
    let value_gobj = model.value(iter_a, GROUP as i32);
 | 
					    // hide checkbox for groups
 | 
				
			||||||
    let value = value_gobj.get::<&str>().is_ok();
 | 
					    let value = model.value(iter_a, INSTALLED as i32).get::<i32>().unwrap();
 | 
				
			||||||
    renderer_cell.set_visible(!value);
 | 
					    renderer_cell.set_visible(value != -1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn on_reload_clicked(_button: >k::Button) {
 | 
					fn on_reload_clicked(_button: >k::Button) {
 | 
				
			||||||
| 
						 | 
					@ -351,13 +349,11 @@ fn on_query_tooltip_tree_view(
 | 
				
			||||||
    let tooltip_context = treeview.tooltip_context(&mut x, &mut y, keyboard_tip);
 | 
					    let tooltip_context = treeview.tooltip_context(&mut x, &mut y, keyboard_tip);
 | 
				
			||||||
    if let Some((model_tmp, path, iter_a)) = tooltip_context {
 | 
					    if let Some((model_tmp, path, iter_a)) = tooltip_context {
 | 
				
			||||||
        let model = model_tmp.unwrap();
 | 
					        let model = model_tmp.unwrap();
 | 
				
			||||||
        let value_gobj = model.value(&iter_a, INSTALLED as i32);
 | 
					        let value = model.value(&iter_a, INSTALLED as i32).get::<i32>().unwrap();
 | 
				
			||||||
        let value = value_gobj.get::<bool>();
 | 
					        if value == 1 {
 | 
				
			||||||
        if value.is_ok() && value.unwrap() {
 | 
					 | 
				
			||||||
            let mut msg = String::from("Installed");
 | 
					            let mut msg = String::from("Installed");
 | 
				
			||||||
            let active_gobj = model.value(&iter_a, ACTIVE as i32);
 | 
					            let active = model.value(&iter_a, ACTIVE as i32).get::<i32>().unwrap();
 | 
				
			||||||
            let active = active_gobj.get::<bool>();
 | 
					            if active == 0 {
 | 
				
			||||||
            if active.is_ok() && !active.unwrap() {
 | 
					 | 
				
			||||||
                msg.push_str(" , to remove");
 | 
					                msg.push_str(" , to remove");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            tooltip.set_markup(Some(msg.as_str()));
 | 
					            tooltip.set_markup(Some(msg.as_str()));
 | 
				
			||||||
| 
						 | 
					@ -376,7 +372,7 @@ fn on_app_toggle(_cell: >k::CellRendererToggle, path: gtk::TreePath) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // a group has no package attached and we don't install groups
 | 
					    // a group has no package attached and we don't install groups
 | 
				
			||||||
    if value_gobj.get::<&str>().is_ok() {
 | 
					    if value_gobj.get::<&str>().is_ok() {
 | 
				
			||||||
        let toggle_a = app_store.value(&iter_a, ACTIVE as i32).get::<bool>().unwrap();
 | 
					        let toggle_a = app_store.value(&iter_a, ACTIVE as i32).get::<i32>().unwrap() == 1;
 | 
				
			||||||
        app_store.set(&iter_a, &[(ACTIVE, &!toggle_a)]);
 | 
					        app_store.set(&iter_a, &[(ACTIVE, &!toggle_a)]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let alpm_handle = app_browser.get_alpm_handle();
 | 
					        let alpm_handle = app_browser.get_alpm_handle();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								src/main.rs
								
								
								
								
							
							
						
						
									
										13
									
								
								src/main.rs
								
								
								
								
							| 
						 | 
					@ -179,12 +179,6 @@ fn build_ui(application: >k::Application) {
 | 
				
			||||||
    if Path::new(&logo_path).exists() {
 | 
					    if Path::new(&logo_path).exists() {
 | 
				
			||||||
        let logo = Pixbuf::from_file(logo_path).unwrap();
 | 
					        let logo = Pixbuf::from_file(logo_path).unwrap();
 | 
				
			||||||
        main_window.set_icon(Some(&logo));
 | 
					        main_window.set_icon(Some(&logo));
 | 
				
			||||||
 | 
					 | 
				
			||||||
        let image: gtk::Image = builder.object("distriblogo").unwrap();
 | 
					 | 
				
			||||||
        image.set_from_pixbuf(Some(&logo));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let dialog: gtk::AboutDialog = builder.object("aboutdialog").unwrap();
 | 
					 | 
				
			||||||
        dialog.set_logo(Some(&logo));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let social_box: gtk::Box = builder.object("social").unwrap();
 | 
					    let social_box: gtk::Box = builder.object("social").unwrap();
 | 
				
			||||||
| 
						 | 
					@ -344,9 +338,8 @@ fn set_locale(use_locale: &str) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Real-time locale changing
 | 
					    // Real-time locale changing
 | 
				
			||||||
    let elts: HashMap<String, serde_json::Value> = serde_json::from_str(&serde_json::to_string(&json!({
 | 
					    let elts: HashMap<String, serde_json::Value> = serde_json::from_str(&serde_json::to_string(&json!({
 | 
				
			||||||
        "comments": ["aboutdialog"],
 | 
					        "label": ["autostartlabel", "development", "software", "donate", "firstcategory", "forum", "install", "installlabel", "involved", "mailling", "readme", "release", "secondcategory", "thirdcategory", "welcomelabel", "welcometitle", "wiki"],
 | 
				
			||||||
        "label": ["autostartlabel", "development", "discover", "donate", "firstcategory", "forum", "install", "installlabel", "involved", "mailling", "readme", "release", "secondcategory", "thirdcategory", "welcomelabel", "welcometitle", "wiki"],
 | 
					        "tooltip_text": ["about", "development", "software", "donate", "forum", "mailling", "wiki"],
 | 
				
			||||||
        "tooltip_text": ["about", "development", "discover", "donate", "forum", "mailling", "wiki"],
 | 
					 | 
				
			||||||
    })).unwrap()).unwrap();
 | 
					    })).unwrap()).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mut default_texts = json!(null);
 | 
					    let mut default_texts = json!(null);
 | 
				
			||||||
| 
						 | 
					@ -364,7 +357,7 @@ fn set_locale(use_locale: &str) {
 | 
				
			||||||
                    let item_buf = item.property::<String>(method.0.as_str());
 | 
					                    let item_buf = item.property::<String>(method.0.as_str());
 | 
				
			||||||
                    default_texts[method.0][elt_value] = json!(item_buf);
 | 
					                    default_texts[method.0][elt_value] = json!(item_buf);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if method.0 == "tooltip_text" || method.0 == "comments" {
 | 
					                if method.0 == "tooltip_text" {
 | 
				
			||||||
                    item.set_property(
 | 
					                    item.set_property(
 | 
				
			||||||
                        method.0,
 | 
					                        method.0,
 | 
				
			||||||
                        &gettextrs::gettext(default_texts[method.0][elt_value].as_str().unwrap()),
 | 
					                        &gettextrs::gettext(default_texts[method.0][elt_value].as_str().unwrap()),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,4 +12,4 @@ window {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.aboutdialog {
 | 
					.aboutdialog {
 | 
				
			||||||
    border-radius: 7px;
 | 
					    border-radius: 7px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,9 +221,9 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
 | 
				
			||||||
              </packing>
 | 
					              </packing>
 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
              <object class="GtkButton" id="discover">
 | 
					              <object class="GtkButton" id="software">
 | 
				
			||||||
                <property name="label" translatable="yes">Discover software</property>
 | 
					                <property name="label" translatable="yes">Software</property>
 | 
				
			||||||
                <property name="name">discover</property>
 | 
					                <property name="name">software</property>
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can-focus">False</property>
 | 
					                <property name="can-focus">False</property>
 | 
				
			||||||
                <property name="receives-default">True</property>
 | 
					                <property name="receives-default">True</property>
 | 
				
			||||||
| 
						 | 
					@ -423,23 +423,6 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can-focus">False</property>
 | 
					                <property name="can-focus">False</property>
 | 
				
			||||||
                <property name="homogeneous">True</property>
 | 
					                <property name="homogeneous">True</property>
 | 
				
			||||||
                <child>
 | 
					 | 
				
			||||||
                  <object class="GtkButton" id="appBrowser">
 | 
					 | 
				
			||||||
                    <property name="label" translatable="yes">Install Apps</property>
 | 
					 | 
				
			||||||
                    <property name="name">appBrowser</property>
 | 
					 | 
				
			||||||
                    <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                    <property name="receives-default">True</property>
 | 
					 | 
				
			||||||
                    <property name="tooltip-text" translatable="yes">Install Apps</property>
 | 
					 | 
				
			||||||
                    <property name="margin-left">15</property>
 | 
					 | 
				
			||||||
                    <property name="margin-right">15</property>
 | 
					 | 
				
			||||||
                    <signal name="clicked" handler="on_btn_clicked" swapped="no"/>
 | 
					 | 
				
			||||||
                  </object>
 | 
					 | 
				
			||||||
                  <packing>
 | 
					 | 
				
			||||||
                    <property name="expand">True</property>
 | 
					 | 
				
			||||||
                    <property name="fill">True</property>
 | 
					 | 
				
			||||||
                    <property name="position">0</property>
 | 
					 | 
				
			||||||
                  </packing>
 | 
					 | 
				
			||||||
                </child>
 | 
					 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <object class="GtkButton" id="tweaksBrowser">
 | 
					                  <object class="GtkButton" id="tweaksBrowser">
 | 
				
			||||||
                    <property name="label" translatable="yes">Apps/Tweaks</property>
 | 
					                    <property name="label" translatable="yes">Apps/Tweaks</property>
 | 
				
			||||||
| 
						 | 
					@ -458,7 +441,21 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
 | 
				
			||||||
                  </packing>
 | 
					                  </packing>
 | 
				
			||||||
                </child>
 | 
					                </child>
 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <placeholder/>
 | 
					                  <object class="GtkButton" id="appBrowser">
 | 
				
			||||||
 | 
					                    <property name="label" translatable="yes">Install Apps</property>
 | 
				
			||||||
 | 
					                    <property name="name">appBrowser</property>
 | 
				
			||||||
 | 
					                    <property name="can-focus">False</property>
 | 
				
			||||||
 | 
					                    <property name="receives-default">True</property>
 | 
				
			||||||
 | 
					                    <property name="tooltip-text" translatable="yes">Common application selection</property>
 | 
				
			||||||
 | 
					                    <property name="margin-left">15</property>
 | 
				
			||||||
 | 
					                    <property name="margin-right">15</property>
 | 
				
			||||||
 | 
					                    <signal name="clicked" handler="on_btn_clicked" swapped="no"/>
 | 
				
			||||||
 | 
					                  </object>
 | 
				
			||||||
 | 
					                  <packing>
 | 
				
			||||||
 | 
					                    <property name="expand">False</property>
 | 
				
			||||||
 | 
					                    <property name="fill">True</property>
 | 
				
			||||||
 | 
					                    <property name="position">1</property>
 | 
				
			||||||
 | 
					                  </packing>
 | 
				
			||||||
                </child>
 | 
					                </child>
 | 
				
			||||||
              </object>
 | 
					              </object>
 | 
				
			||||||
              <packing>
 | 
					              <packing>
 | 
				
			||||||
| 
						 | 
					@ -494,12 +491,6 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
 | 
				
			||||||
                    <property name="position">0</property>
 | 
					                    <property name="position">0</property>
 | 
				
			||||||
                  </packing>
 | 
					                  </packing>
 | 
				
			||||||
                </child>
 | 
					                </child>
 | 
				
			||||||
                <child>
 | 
					 | 
				
			||||||
                  <placeholder/>
 | 
					 | 
				
			||||||
                </child>
 | 
					 | 
				
			||||||
                <child>
 | 
					 | 
				
			||||||
                  <placeholder/>
 | 
					 | 
				
			||||||
                </child>
 | 
					 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <object class="GtkEventBox">
 | 
					                  <object class="GtkEventBox">
 | 
				
			||||||
                    <property name="name">reddit</property>
 | 
					                    <property name="name">reddit</property>
 | 
				
			||||||
| 
						 | 
					@ -584,81 +575,4 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
 | 
				
			||||||
      </object>
 | 
					      </object>
 | 
				
			||||||
    </child>
 | 
					    </child>
 | 
				
			||||||
  </object>
 | 
					  </object>
 | 
				
			||||||
  <object class="GtkAboutDialog" id="aboutdialog">
 | 
					 | 
				
			||||||
    <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
    <property name="title" translatable="yes">About</property>
 | 
					 | 
				
			||||||
    <property name="type-hint">dialog</property>
 | 
					 | 
				
			||||||
    <property name="transient-for">window</property>
 | 
					 | 
				
			||||||
    <property name="program-name">CachyOS Hello</property>
 | 
					 | 
				
			||||||
    <property name="version">0.6.10</property>
 | 
					 | 
				
			||||||
    <property name="comments" translatable="yes">Welcome screen for CachyOS</property>
 | 
					 | 
				
			||||||
    <property name="website">https://github.com/cachyos/cachyos-welcome</property>
 | 
					 | 
				
			||||||
    <property name="website-label">GitHub</property>
 | 
					 | 
				
			||||||
    <property name="authors">Hugo Posnic
 | 
					 | 
				
			||||||
Johnathan Jenkins
 | 
					 | 
				
			||||||
Frede Hundewadt
 | 
					 | 
				
			||||||
Bernhard Landauer
 | 
					 | 
				
			||||||
Philip Müller
 | 
					 | 
				
			||||||
Papa Joker
 | 
					 | 
				
			||||||
Oguz Kagan EREN</property>
 | 
					 | 
				
			||||||
    <property name="translator-credits">abdelhak gasmi
 | 
					 | 
				
			||||||
Al Manja
 | 
					 | 
				
			||||||
Albert Cutrona
 | 
					 | 
				
			||||||
Aleksandar Velimirović
 | 
					 | 
				
			||||||
Alex Beliy
 | 
					 | 
				
			||||||
Bernhard Landauer
 | 
					 | 
				
			||||||
cges30901
 | 
					 | 
				
			||||||
Daniel Napora
 | 
					 | 
				
			||||||
DeMus
 | 
					 | 
				
			||||||
Ersi Ni
 | 
					 | 
				
			||||||
Fabio Forni
 | 
					 | 
				
			||||||
Gabriel Blanca
 | 
					 | 
				
			||||||
Hugo Carvalho
 | 
					 | 
				
			||||||
Hugo Posnic
 | 
					 | 
				
			||||||
Ilya Ostapenko aka Jacobtey
 | 
					 | 
				
			||||||
Jeff Huang
 | 
					 | 
				
			||||||
kouros kouros
 | 
					 | 
				
			||||||
Lajos Pasztor
 | 
					 | 
				
			||||||
László Szalai
 | 
					 | 
				
			||||||
Leandro Cunha
 | 
					 | 
				
			||||||
Lovro Kudelić
 | 
					 | 
				
			||||||
Makaveli B
 | 
					 | 
				
			||||||
mgundogdu
 | 
					 | 
				
			||||||
Michael Kogan
 | 
					 | 
				
			||||||
Midir Hakou
 | 
					 | 
				
			||||||
Moo
 | 
					 | 
				
			||||||
pavelrz
 | 
					 | 
				
			||||||
secgin
 | 
					 | 
				
			||||||
Stefano Capitani
 | 
					 | 
				
			||||||
Stéphane
 | 
					 | 
				
			||||||
Πέτρος Σαμαράς
 | 
					 | 
				
			||||||
Андрей Раугас</property>
 | 
					 | 
				
			||||||
    <property name="logo-icon-name"/>
 | 
					 | 
				
			||||||
    <property name="license-type">gpl-3-0</property>
 | 
					 | 
				
			||||||
    <child internal-child="vbox">
 | 
					 | 
				
			||||||
      <object class="GtkBox">
 | 
					 | 
				
			||||||
        <property name="can-focus">True</property>
 | 
					 | 
				
			||||||
        <property name="has-focus">True</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>
 | 
					 | 
				
			||||||
          </object>
 | 
					 | 
				
			||||||
          <packing>
 | 
					 | 
				
			||||||
            <property name="expand">False</property>
 | 
					 | 
				
			||||||
            <property name="fill">False</property>
 | 
					 | 
				
			||||||
            <property name="position">0</property>
 | 
					 | 
				
			||||||
          </packing>
 | 
					 | 
				
			||||||
        </child>
 | 
					 | 
				
			||||||
        <child>
 | 
					 | 
				
			||||||
          <placeholder/>
 | 
					 | 
				
			||||||
        </child>
 | 
					 | 
				
			||||||
      </object>
 | 
					 | 
				
			||||||
    </child>
 | 
					 | 
				
			||||||
    <style>
 | 
					 | 
				
			||||||
      <class name="aboutdialog"/>
 | 
					 | 
				
			||||||
    </style>
 | 
					 | 
				
			||||||
  </object>
 | 
					 | 
				
			||||||
</interface>
 | 
					</interface>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue