meeting-row: Port to GTK4
This commit is contained in:
@@ -27,15 +27,12 @@
|
|||||||
|
|
||||||
struct _GcalMeetingRow
|
struct _GcalMeetingRow
|
||||||
{
|
{
|
||||||
GtkListBoxRow parent_instance;
|
AdwActionRow parent_instance;
|
||||||
|
|
||||||
GtkLabel *service_label;
|
|
||||||
GtkLabel *url_label;
|
|
||||||
|
|
||||||
gchar *url;
|
gchar *url;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GcalMeetingRow, gcal_meeting_row, GTK_TYPE_LIST_BOX_ROW)
|
G_DEFINE_TYPE (GcalMeetingRow, gcal_meeting_row, ADW_TYPE_ACTION_ROW)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -86,10 +83,10 @@ setup_meeting (GcalMeetingRow *self)
|
|||||||
{
|
{
|
||||||
g_autofree gchar *markup_url = NULL;
|
g_autofree gchar *markup_url = NULL;
|
||||||
|
|
||||||
gtk_label_set_label (self->service_label, get_service_name_from_url (self->url));
|
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), get_service_name_from_url (self->url));
|
||||||
|
|
||||||
markup_url = g_strdup_printf ("<a href=\"%s\">%s</a>", self->url, self->url);
|
markup_url = g_strdup_printf ("<a href=\"%s\">%s</a>", self->url, self->url);
|
||||||
gtk_label_set_markup (self->url_label, markup_url);
|
adw_action_row_set_subtitle (ADW_ACTION_ROW (self), markup_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -187,10 +184,9 @@ gcal_meeting_row_class_init (GcalMeetingRowClass *klass)
|
|||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-meeting-row.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-meeting-row.ui");
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalMeetingRow, service_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalMeetingRow, url_label);
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_join_button_clicked_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_join_button_clicked_cb);
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (widget_class, "meetingrow");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <adwaita.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GCAL_TYPE_MEETING_ROW (gcal_meeting_row_get_type())
|
#define GCAL_TYPE_MEETING_ROW (gcal_meeting_row_get_type())
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (GcalMeetingRow, gcal_meeting_row, GCAL, MEETING_ROW, GtkListBoxRow)
|
G_DECLARE_FINAL_TYPE (GcalMeetingRow, gcal_meeting_row, GCAL, MEETING_ROW, AdwActionRow)
|
||||||
|
|
||||||
GtkWidget* gcal_meeting_row_new (const gchar *url);
|
GtkWidget* gcal_meeting_row_new (const gchar *url);
|
||||||
|
|
||||||
|
|||||||
+16
-68
@@ -1,76 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.14"/>
|
<template class="GcalMeetingRow" parent="AdwActionRow">
|
||||||
<template class="GcalMeetingRow" parent="GtkListBoxRow">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="activatable">False</property>
|
<property name="activatable">False</property>
|
||||||
<focus-chain>
|
|
||||||
<widget name="url_label"/>
|
|
||||||
<widget name="join_button"/>
|
|
||||||
</focus-chain>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid">
|
<object class="GtkButton" id="join_button">
|
||||||
<property name="visible">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="halign">center</property>
|
||||||
<property name="margin-start">12</property>
|
<property name="valign">center</property>
|
||||||
<property name="margin-end">12</property>
|
<!-- Translators: "Join" as in "Join meeting" -->
|
||||||
<property name="margin-top">6</property>
|
<property name="label" translatable="yes">Join</property>
|
||||||
<property name="margin-bottom">6</property>
|
<layout>
|
||||||
<property name="column-spacing">18</property>
|
<property name="row">0</property>
|
||||||
|
<property name="column">1</property>
|
||||||
<child>
|
<property name="row-span">2</property>
|
||||||
<object class="GtkLabel" id="service_label">
|
</layout>
|
||||||
<property name="visible">True</property>
|
<style>
|
||||||
<property name="can_focus">False</property>
|
<class name="suggested-action" />
|
||||||
<property name="hexpand">True</property>
|
</style>
|
||||||
<property name="xalign">0.0</property>
|
<signal name="clicked" handler="on_join_button_clicked_cb" object="GcalMeetingRow" swapped="no" />
|
||||||
<style>
|
|
||||||
<class name="title" />
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="url_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="xalign">0.0</property>
|
|
||||||
<style>
|
|
||||||
<class name="subtitle" />
|
|
||||||
<class name="dim-label" />
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="top-attach">1</property>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton" id="join_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<!-- Translators: "Join" as in "Join meeting" -->
|
|
||||||
<property name="label" translatable="yes">Join</property>
|
|
||||||
<style>
|
|
||||||
<class name="suggested-action" />
|
|
||||||
</style>
|
|
||||||
<signal name="clicked" handler="on_join_button_clicked_cb" object="GcalMeetingRow" swapped="no" />
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="height">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user