mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 04:18:39 +00:00
Feature/default focus (#7102)
* Setting default focus in Open URL and Add Tracker dialog box * Additional cleanup to remove duplication of responsibility in setting focus * Removing now un-necessary code in TorrentUrlChooserDialog.ui * Using activates-default property to enable default action in torrent url chooser and tracker adder * removing un-necessary focus * Adding missing property to the accept buttons. * Removing unintended whitespace change in TorrentUrlChooserDialog * Use `True` instead of `1` for booleans (GTK3)
This commit is contained in:
@@ -2341,6 +2341,13 @@ AddTrackerDialog::AddTrackerDialog(
|
|||||||
set_title(fmt::format(_("{torrent_name} - Add Tracker"), fmt::arg("torrent_name", tr_torrentName(torrent))));
|
set_title(fmt::format(_("{torrent_name} - Add Tracker"), fmt::arg("torrent_name", tr_torrentName(torrent))));
|
||||||
set_transient_for(parent);
|
set_transient_for(parent);
|
||||||
|
|
||||||
|
auto* const accept = get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT));
|
||||||
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
||||||
|
set_default_widget(*accept);
|
||||||
|
#else
|
||||||
|
set_default(*accept);
|
||||||
|
#endif
|
||||||
|
|
||||||
gtr_paste_clipboard_url_into_entry(*url_entry_);
|
gtr_paste_clipboard_url_into_entry(*url_entry_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -427,16 +427,14 @@ TorrentUrlChooserDialog::TorrentUrlChooserDialog(
|
|||||||
set_transient_for(parent);
|
set_transient_for(parent);
|
||||||
|
|
||||||
auto* const e = gtr_get_widget<Gtk::Entry>(builder, "url_entry");
|
auto* const e = gtr_get_widget<Gtk::Entry>(builder, "url_entry");
|
||||||
|
auto* const accept = get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT));
|
||||||
gtr_paste_clipboard_url_into_entry(*e);
|
gtr_paste_clipboard_url_into_entry(*e);
|
||||||
|
|
||||||
signal_response().connect([this, e, core](int response) { onOpenURLResponse(response, *e, core); });
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
||||||
|
set_default_widget(*accept);
|
||||||
|
#else
|
||||||
|
set_default(*accept);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (e->get_text_length() == 0)
|
signal_response().connect([this, e, core](int response) { onOpenURLResponse(response, *e, core); });
|
||||||
{
|
|
||||||
e->grab_focus();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT))->grab_focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<property name="label" translatable="yes">_Add</property>
|
<property name="label" translatable="yes">_Add</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
|
<property name="can-default">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="use-underline">True</property>
|
<property name="use-underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
@@ -94,6 +95,7 @@
|
|||||||
<property name="width-request">400</property>
|
<property name="width-request">400</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
|
<property name="activates-default">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<property name="label" translatable="yes">_Open</property>
|
<property name="label" translatable="yes">_Open</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
|
<property name="can-default">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="use-underline">True</property>
|
<property name="use-underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
@@ -94,6 +95,7 @@
|
|||||||
<property name="width-request">400</property>
|
<property name="width-request">400</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
|
<property name="activates-default">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
<object class="GtkEntry" id="url_entry">
|
<object class="GtkEntry" id="url_entry">
|
||||||
<property name="width-request">400</property>
|
<property name="width-request">400</property>
|
||||||
<property name="focusable">1</property>
|
<property name="focusable">1</property>
|
||||||
|
<property name="activates-default">1</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
<object class="GtkEntry" id="url_entry">
|
<object class="GtkEntry" id="url_entry">
|
||||||
<property name="width-request">400</property>
|
<property name="width-request">400</property>
|
||||||
<property name="focusable">1</property>
|
<property name="focusable">1</property>
|
||||||
|
<property name="activates-default">1</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user