Replace deprecated function usages

This commit is contained in:
fiaxh 2017-11-06 01:02:13 +01:00
parent f6ac5bbd26
commit 1d0745177e
11 changed files with 20 additions and 20 deletions

View file

@ -140,9 +140,7 @@ public class ConnectionManager {
Xmpp.Presence.Stanza presence = new Xmpp.Presence.Stanza(); Xmpp.Presence.Stanza presence = new Xmpp.Presence.Stanza();
presence.type_ = Xmpp.Presence.Stanza.TYPE_UNAVAILABLE; presence.type_ = Xmpp.Presence.Stanza.TYPE_UNAVAILABLE;
change_connection_state(account, ConnectionState.DISCONNECTED); change_connection_state(account, ConnectionState.DISCONNECTED);
try { connections[account].stream.get_module(Presence.Module.IDENTITY).send_presence(connections[account].stream, presence);
connections[account].stream.get_module(Presence.Module.IDENTITY).send_presence(connections[account].stream, presence);
} catch (Error e) { print(@"on_prepare_for_sleep error $(e.message)\n"); }
} }
public void disconnect(Account account) { public void disconnect(Account account) {

View file

@ -34,6 +34,7 @@ public class ConversationManager : StreamInteractionModule, Object {
public Conversation create_conversation(Jid jid, Account account, Conversation.Type? type = null) { public Conversation create_conversation(Jid jid, Account account, Conversation.Type? type = null) {
assert(conversations.has_key(account)); assert(conversations.has_key(account));
if (conversations[account].has_key(jid)) { if (conversations[account].has_key(jid)) {
conversations[account][jid].type_ = type;
return conversations[account][jid]; return conversations[account][jid];
} else { } else {
Conversation conversation = new Conversation(jid, account, type); Conversation conversation = new Conversation(jid, account, type);

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="DinoUiAddContactDialog"> <template class="DinoUiAddContactDialog">
<property name="default_width">300</property> <property name="valign">center</property>
<property name="modal">True</property> <property name="modal">True</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="DinoUiAddGroupchatDialog"> <template class="DinoUiAddGroupchatDialog">
<property name="default_width">400</property> <property name="valign">center</property>
<property name="modal">True</property> <property name="modal">True</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
@ -39,8 +39,8 @@
<object class="GtkGrid"> <object class="GtkGrid">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">20</property> <property name="margin">20</property>
<property name="margin_right">40</property> <property name="margin-start">40</property>
<property name="margin_left">40</property> <property name="margin-end">40</property>
<property name="row-spacing">7</property> <property name="row-spacing">7</property>
<property name="column-spacing">10</property> <property name="column-spacing">10</property>
<property name="visible">True</property> <property name="visible">True</property>

View file

@ -9,8 +9,8 @@
<object class="GtkGrid"> <object class="GtkGrid">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="margin">20</property> <property name="margin">20</property>
<property name="margin_right">40</property> <property name="margin_end">40</property>
<property name="margin_left">40</property> <property name="margin_start">40</property>
<property name="row-spacing">7</property> <property name="row-spacing">7</property>
<property name="column-spacing">10</property> <property name="column-spacing">10</property>
<property name="visible">True</property> <property name="visible">True</property>

View file

@ -18,7 +18,7 @@ protected class AddGroupchatDialog : Gtk.Dialog {
[GtkChild] private Entry nick_entry; [GtkChild] private Entry nick_entry;
private StreamInteractor stream_interactor; private StreamInteractor stream_interactor;
private Xmpp.Xep.Bookmarks.Conference? edit_confrence = null; private Xmpp.Xep.Bookmarks.Conference? edit_conference = null;
private bool alias_entry_changed = false; private bool alias_entry_changed = false;
public AddGroupchatDialog(StreamInteractor stream_interactor) { public AddGroupchatDialog(StreamInteractor stream_interactor) {
@ -37,7 +37,7 @@ protected class AddGroupchatDialog : Gtk.Dialog {
public AddGroupchatDialog.for_conference(StreamInteractor stream_interactor, Account account, Xmpp.Xep.Bookmarks.Conference conference) { public AddGroupchatDialog.for_conference(StreamInteractor stream_interactor, Account account, Xmpp.Xep.Bookmarks.Conference conference) {
this(stream_interactor); this(stream_interactor);
edit_confrence = conference; edit_conference = conference;
ok_button.label = _("Save"); ok_button.label = _("Save");
ok_button.sensitive = true; ok_button.sensitive = true;
accounts_stack.set_visible_child_name("label"); accounts_stack.set_visible_child_name("label");
@ -67,10 +67,10 @@ protected class AddGroupchatDialog : Gtk.Dialog {
Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(jid_entry.text); Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(jid_entry.text);
conference.nick = nick_entry.text != "" ? nick_entry.text : null; conference.nick = nick_entry.text != "" ? nick_entry.text : null;
conference.name = alias_entry.text; conference.name = alias_entry.text;
if (edit_confrence == null) { if (edit_conference == null) {
stream_interactor.get_module(MucManager.IDENTITY).add_bookmark(account_combobox.selected, conference); stream_interactor.get_module(MucManager.IDENTITY).add_bookmark(account_combobox.selected, conference);
} else { } else {
stream_interactor.get_module(MucManager.IDENTITY).replace_bookmark(account_combobox.selected, edit_confrence, conference); stream_interactor.get_module(MucManager.IDENTITY).replace_bookmark(account_combobox.selected, edit_conference, conference);
} }
close(); close();
} }

View file

@ -102,7 +102,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
SimpleAction quit_action = new SimpleAction("quit", null); SimpleAction quit_action = new SimpleAction("quit", null);
quit_action.activate.connect(quit); quit_action.activate.connect(quit);
add_action(quit_action); add_action(quit_action);
add_accelerator("<Ctrl>Q", "app.quit", null); set_accels_for_action("app.quit", new string[]{"<Ctrl>Q"});
Builder builder = new Builder.from_resource("/im/dino/menu_app.ui"); Builder builder = new Builder.from_resource("/im/dino/menu_app.ui");
MenuModel menu = builder.get_object("menu_app") as MenuModel; MenuModel menu = builder.get_object("menu_app") as MenuModel;

View file

@ -57,7 +57,7 @@ public class Dialog : Gtk.Dialog {
private void setup_top() { private void setup_top() {
if (conversation.type_ == Conversation.Type.CHAT) { if (conversation.type_ == Conversation.Type.CHAT) {
name_label.visible = false; name_label.visible = false;
jid_label.set_padding(new Button().get_style_context().get_padding(StateFlags.NORMAL).left + 1, 0); jid_label.margin_start = new Button().get_style_context().get_padding(StateFlags.NORMAL).left + 1;
name_hybrid.text = Util.get_conversation_display_name(stream_interactor, conversation); name_hybrid.text = Util.get_conversation_display_name(stream_interactor, conversation);
destroy.connect(() => { destroy.connect(() => {
if (name_hybrid.text != Util.get_conversation_display_name(stream_interactor, conversation)) { if (name_hybrid.text != Util.get_conversation_display_name(stream_interactor, conversation)) {
@ -79,7 +79,7 @@ public class Dialog : Gtk.Dialog {
add_category(category); add_category(category);
ListBoxRow list_row = new ListBoxRow() { activatable=false, visible=true }; ListBoxRow list_row = new ListBoxRow() { activatable=false, visible=true };
Box row = new Box(Orientation.HORIZONTAL, 20) { margin_left=15, margin_right=15, margin_top=3, margin_bottom=3, visible=true }; Box row = new Box(Orientation.HORIZONTAL, 20) { margin_start=15, margin_end=15, margin_top=3, margin_bottom=3, visible=true };
list_row.add(row); list_row.add(row);
Label label_label = new Label(label) { xalign=0, yalign=0.5f, hexpand=true, visible=true }; Label label_label = new Label(label) { xalign=0, yalign=0.5f, hexpand=true, visible=true };
if (description != null && description != "") { if (description != null && description != "") {

View file

@ -61,7 +61,7 @@ public class Dialog : Gtk.Dialog {
Label label = new Label(e.name) { xalign=1, yalign=0, visible=true }; Label label = new Label(e.name) { xalign=1, yalign=0, visible=true };
label.get_style_context().add_class("dim-label"); label.get_style_context().add_class("dim-label");
label.set_padding(0, e.label_top_padding == -1 ? default_top_padding : e.label_top_padding); label.margin_top = e.label_top_padding == -1 ? default_top_padding : e.label_top_padding;
settings_list.attach(label, 0, row_index); settings_list.attach(label, 0, row_index);
if (widget is Widget) { if (widget is Widget) {

View file

@ -119,10 +119,10 @@ public class List : Box {
if (aff == affiliation) count++; if (aff == affiliation) count++;
} }
Label title_label = new Label("") { margin_left=10, xalign=0, visible=true }; Label title_label = new Label("") { margin_start=10, xalign=0, visible=true };
title_label.set_markup(@"<b>$(Markup.escape_text(aff_str))</b>"); title_label.set_markup(@"<b>$(Markup.escape_text(aff_str))</b>");
Label count_label = new Label(@"$count") { xalign=0, margin_right=7, expand=true, visible=true }; Label count_label = new Label(@"$count") { xalign=0, margin_end=7, expand=true, visible=true };
count_label.get_style_context().add_class("dim-label"); count_label.get_style_context().add_class("dim-label");
Grid grid = new Grid() { margin_top=top?5:15, column_spacing=5, hexpand=true, visible=true }; Grid grid = new Grid() { margin_top=top?5:15, column_spacing=5, hexpand=true, visible=true };

View file

@ -15,7 +15,8 @@ public class AccountSettingWidget : Plugins.AccountSettingsWidget, Box {
fingerprint = new Label("..."); fingerprint = new Label("...");
fingerprint.xalign = 0; fingerprint.xalign = 0;
Border border = new Button().get_style_context().get_padding(StateFlags.NORMAL); Border border = new Button().get_style_context().get_padding(StateFlags.NORMAL);
fingerprint.set_padding(border.left + 1, border.top + 1); fingerprint.margin_top = border.top + 1;
fingerprint.margin_start = border.left + 1;
fingerprint.visible = true; fingerprint.visible = true;
pack_start(fingerprint); pack_start(fingerprint);