[gnome-control-center/gbsneto/gtk4: 13/31] default-apps: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/gtk4: 13/31] default-apps: Port to GTK4
- Date: Mon, 1 Nov 2021 20:01:58 +0000 (UTC)
commit 1de4ed45d29c76a74cee061b60492db22d8f2665
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Oct 20 13:36:57 2021 -0300
default-apps: Port to GTK4
An easy one, mostly removing code from the UI file.
panels/default-apps/cc-default-apps-panel.c | 8 --
panels/default-apps/cc-default-apps-panel.ui | 148 +++++++++------------------
panels/meson.build | 2 +-
shell/cc-panel-loader.c | 4 +-
4 files changed, 51 insertions(+), 111 deletions(-)
---
diff --git a/panels/default-apps/cc-default-apps-panel.c b/panels/default-apps/cc-default-apps-panel.c
index 7e80818f2..aa88f2566 100644
--- a/panels/default-apps/cc-default-apps-panel.c
+++ b/panels/default-apps/cc-default-apps-panel.c
@@ -130,23 +130,15 @@ info_panel_setup_default_app (CcDefaultAppsPanel *self,
{
GtkWidget *button;
GtkWidget *label;
- g_autoptr(GList) cells = NULL;
- GList *cell;
button = gtk_app_chooser_button_new (data->content_type);
g_object_set_data (G_OBJECT (button), "cc-default-app-data", data);
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (button));
- for (cell = cells; cell; cell = cell->next)
- if (GTK_IS_CELL_RENDERER_TEXT (cell->data))
- g_object_set (G_OBJECT (cell->data), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-
gtk_app_chooser_button_set_show_default_item (GTK_APP_CHOOSER_BUTTON (button), TRUE);
gtk_grid_attach (GTK_GRID (self->default_apps_grid), button, left_attach, top_attach,
1, 1);
g_signal_connect_object (G_OBJECT (button), "changed",
G_CALLBACK (default_app_changed), self, G_CONNECT_SWAPPED);
- gtk_widget_show (button);
label = WIDGET_FROM_OFFSET (data->label_offset);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
diff --git a/panels/default-apps/cc-default-apps-panel.ui b/panels/default-apps/cc-default-apps-panel.ui
index 06d4063da..8b5b3a2ab 100644
--- a/panels/default-apps/cc-default-apps-panel.ui
+++ b/panels/default-apps/cc-default-apps-panel.ui
@@ -2,31 +2,24 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<template class="CcDefaultAppsPanel" parent="CcPanel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="expand">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="margin_top">32</property>
<property name="margin_bottom">32</property>
- <property name="margin_left">24</property>
- <property name="margin_right">24</property>
+ <property name="margin_start">24</property>
+ <property name="margin_end">24</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="spacing">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="default_apps_grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="column_spacing">12</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkLabel" id="web_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Web</property>
<property name="use_underline">True</property>
@@ -37,174 +30,129 @@
</child>
<child>
<object class="GtkLabel" id="mail_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Mail</property>
<property name="use_underline">True</property>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="top_attach">1</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="calendar_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Calendar</property>
<property name="use_underline">True</property>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="top_attach">2</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="music_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">M_usic</property>
<property name="use_underline">True</property>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="top_attach">3</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="video_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Video</property>
<property name="use_underline">True</property>
+ <layout>
+ <property name="row">4</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="top_attach">4</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label25">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">2</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label28">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">3</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">3</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label29">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">4</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">4</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="photos_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_Photos</property>
<property name="use_underline">True</property>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">0</property>
+ </layout>
<style>
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="top_attach">5</property>
- <property name="left_attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="label33">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label"> </property>
+ <layout>
+ <property name="column">2</property>
+ <property name="row">5</property>
+ </layout>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">5</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
</child>
diff --git a/panels/meson.build b/panels/meson.build
index 0c08fb11e..159fba0bc 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -6,7 +6,7 @@ panels = [
'camera',
# 'color',
# 'datetime',
-# 'default-apps',
+ 'default-apps',
# 'diagnostics',
# 'display',
'info-overview',
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index eac24e5a2..7b68ab8e7 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -38,7 +38,7 @@
#endif /* BUILD_BLUETOOTH */
//extern GType cc_color_panel_get_type (void);
//extern GType cc_date_time_panel_get_type (void);
-//extern GType cc_default_apps_panel_get_type (void);
+extern GType cc_default_apps_panel_get_type (void);
//extern GType cc_display_panel_get_type (void);
extern GType cc_info_overview_panel_get_type (void);
//extern GType cc_keyboard_panel_get_type (void);
@@ -105,7 +105,7 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("camera", cc_camera_panel_get_type, NULL),
//PANEL_TYPE("color", cc_color_panel_get_type, NULL),
//PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
- //PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
+ PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
//PANEL_TYPE("diagnostics", cc_diagnostics_panel_get_type,
cc_diagnostics_panel_static_init_func),
//PANEL_TYPE("display", cc_display_panel_get_type, NULL),
PANEL_TYPE("info-overview", cc_info_overview_panel_get_type, NULL),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]