Commit 55fe239e authored by Bastien Nocera's avatar Bastien Nocera
Browse files

network: Use new listbox helpers

https://bugzilla.gnome.org/show_bug.cgi?id=732106
parent d632e598
......@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip4.h"
#include <nm-utils.h>
......@@ -90,25 +91,6 @@ switch_toggled (GObject *object,
ce_page_changed (page);
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
GtkWidget *current;
if (before == NULL)
return;
current = gtk_list_box_row_get_header (row);
if (current == NULL)
{
current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (current);
gtk_list_box_row_set_header (row, current);
}
}
static void
update_row_sensitivity (CEPageIP4 *page, GtkWidget *list)
{
......@@ -309,7 +291,7 @@ add_address_section (CEPageIP4 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
......@@ -412,7 +394,7 @@ add_dns_section (CEPageIP4 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->dns_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
......@@ -555,7 +537,7 @@ add_routes_section (CEPageIP4 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_routes_switch"));
......
......@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include "shell/list-box-helper.h"
#include "ce-page-ip6.h"
#include <nm-utils.h>
......@@ -92,25 +93,6 @@ switch_toggled (GObject *object,
ce_page_changed (page);
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
GtkWidget *current;
if (before == NULL)
return;
current = gtk_list_box_row_get_header (row);
if (current == NULL)
{
current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (current);
gtk_list_box_row_set_header (row, current);
}
}
static void
update_row_sensitivity (CEPageIP6 *page, GtkWidget *list)
{
......@@ -310,7 +292,7 @@ add_address_section (CEPageIP6 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
......@@ -416,7 +398,7 @@ add_dns_section (CEPageIP6 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->dns_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
......@@ -563,7 +545,7 @@ add_routes_section (CEPageIP6 *page)
gtk_container_add (GTK_CONTAINER (widget), frame);
page->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), list);
page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_routes_switch"));
......
......@@ -27,6 +27,7 @@
#include <nm-utils.h>
#include <nm-device-wifi.h>
#include "shell/list-box-helper.h"
#include "net-connection-editor.h"
#include "net-connection-editor-resources.h"
#include "ce-page-details.h"
......@@ -567,25 +568,6 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
gtk_tree_path_free (path);
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
GtkWidget *current;
if (before == NULL)
return;
current = gtk_list_box_row_get_header (row);
if (current == NULL)
{
current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (current);
gtk_list_box_row_set_header (row, current);
}
}
typedef struct {
const char *name;
GType (*type_func) (void);
......@@ -861,7 +843,7 @@ net_connection_editor_add_connection (NetConnectionEditor *editor)
list = GTK_LIST_BOX (gtk_list_box_new ());
gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
gtk_list_box_set_header_func (list, update_header, NULL, NULL);
gtk_list_box_set_header_func (list, cc_list_box_update_header_func, NULL, NULL);
g_signal_connect (list, "row-activated",
G_CALLBACK (connection_type_activated), editor);
......
......@@ -32,6 +32,7 @@
#include "panel-common.h"
#include "shell/list-box-helper.h"
#include "connection-editor/net-connection-editor.h"
#include "connection-editor/ce-page.h"
......@@ -449,25 +450,6 @@ remote_settings_read_cb (NMRemoteSettings *settings,
device_ethernet_refresh_ui (device);
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
GtkWidget *current;
if (before == NULL)
return;
current = gtk_list_box_row_get_header (row);
if (current == NULL)
{
current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (current);
gtk_list_box_row_set_header (row, current);
}
}
static void
add_profile (GtkButton *button, NetDeviceEthernet *device)
{
......@@ -580,7 +562,7 @@ device_ethernet_constructed (GObject *object)
device->scrolled_window = swin = GTK_WIDGET (gtk_builder_get_object (device->builder, "list"));
device->list = list = GTK_WIDGET (gtk_list_box_new ());
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_container_add (GTK_CONTAINER (swin), list);
g_signal_connect (list, "row-activated",
G_CALLBACK (connection_activated), device);
......
......@@ -35,6 +35,7 @@
#include <nm-remote-connection.h>
#include <nm-setting-wireless.h>
#include "shell/list-box-helper.h"
#include "network-dialogs.h"
#include "panel-common.h"
......@@ -1621,25 +1622,6 @@ make_row (GtkSizeGroup *rows,
*row_out = row;
}
static void
update_header (GtkListBoxRow *row,
GtkListBoxRow *before,
gpointer user_data)
{
GtkWidget *current;
if (before == NULL)
return;
current = gtk_list_box_row_get_header (row);
if (current == NULL)
{
current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (current);
gtk_list_box_row_set_header (row, current);
}
}
static gint
history_sort (gconstpointer a, gconstpointer b, gpointer data)
{
......@@ -1760,7 +1742,7 @@ open_history (NetDeviceWifi *device_wifi)
list = GTK_WIDGET (gtk_list_box_new ());
gtk_widget_show (list);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)history_sort, NULL, NULL);
gtk_container_add (GTK_CONTAINER (swin), list);
......@@ -1967,7 +1949,7 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
list = GTK_WIDGET (gtk_list_box_new ());
gtk_widget_show (list);
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), update_header, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)ap_sort, NULL, NULL);
gtk_container_add (GTK_CONTAINER (swin), list);
g_signal_connect (list, "row-activated",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment