meeting-row: Port to GTK4
This commit is contained in:
@@ -27,15 +27,12 @@
|
||||
|
||||
struct _GcalMeetingRow
|
||||
{
|
||||
GtkListBoxRow parent_instance;
|
||||
|
||||
GtkLabel *service_label;
|
||||
GtkLabel *url_label;
|
||||
AdwActionRow parent_instance;
|
||||
|
||||
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
|
||||
{
|
||||
@@ -86,10 +83,10 @@ setup_meeting (GcalMeetingRow *self)
|
||||
{
|
||||
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);
|
||||
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_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_set_css_name (widget_class, "meetingrow");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#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);
|
||||
|
||||
|
||||
+16
-68
@@ -1,76 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<template class="GcalMeetingRow" parent="GtkListBoxRow">
|
||||
<property name="visible">True</property>
|
||||
<template class="GcalMeetingRow" parent="AdwActionRow">
|
||||
<property name="activatable">False</property>
|
||||
<focus-chain>
|
||||
<widget name="url_label"/>
|
||||
<widget name="join_button"/>
|
||||
</focus-chain>
|
||||
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="column-spacing">18</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="service_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="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 class="GtkButton" id="join_button">
|
||||
<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>
|
||||
<layout>
|
||||
<property name="row">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="suggested-action" />
|
||||
</style>
|
||||
<signal name="clicked" handler="on_join_button_clicked_cb" object="GcalMeetingRow" swapped="no" />
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user