static void
device_ethernet_constructed (GObject *object)
{
        NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
        NMRemoteSettings *settings;
        GtkWidget *list;
        GtkWidget *swin;
        GtkWidget *widget;

        widget = GTK_WIDGET (gtk_builder_get_object (device->builder,
                                                     "device_off_switch"));
        g_signal_connect (widget, "notify::active",
                          G_CALLBACK (device_off_toggled), device);

        device->scrolled_window = swin = GTK_WIDGET (gtk_builder_get_object (device->builder, "list"));
        device->list = list = GTK_WIDGET (egg_list_box_new ());
        egg_list_box_set_selection_mode (EGG_LIST_BOX (list), GTK_SELECTION_NONE);
        egg_list_box_set_separator_funcs (EGG_LIST_BOX (list), update_separator, NULL, NULL);
        egg_list_box_add_to_scrolled (EGG_LIST_BOX (list), GTK_SCROLLED_WINDOW (swin));
        gtk_widget_show (list);

        device->details = GTK_WIDGET (gtk_builder_get_object (NET_DEVICE_ETHERNET (object)->builder, "details"));

        device->details_button = GTK_WIDGET (gtk_builder_get_object (NET_DEVICE_ETHERNET (object)->builder, "details_button"));
        g_signal_connect (device->details_button, "clicked",
                          G_CALLBACK (show_details_for_wired), device);

        device->add_profile_button = GTK_WIDGET (gtk_builder_get_object (NET_DEVICE_ETHERNET (object)->builder, "add_profile_button"));
        g_signal_connect (device->add_profile_button, "clicked",
                          G_CALLBACK (add_profile), device);

        settings = net_object_get_remote_settings (NET_OBJECT (object));
        g_signal_connect (settings, "connections-read",
                          G_CALLBACK (remote_settings_read_cb), object);
}
GtkWidget *
cc_search_locations_dialog_new (CcSearchPanel *self)
{
  GtkWidget *locations_dialog, *widget, *list_box;
  GtkBuilder *dialog_builder;
  GError *error = NULL;

  dialog_builder = gtk_builder_new ();
  gtk_builder_add_from_resource (dialog_builder,
                                 "/org/gnome/control-center/search/search-locations-dialog.ui",
                                 &error);

  if (error != NULL)
    {
      g_warning ("Could not load interface file: %s", error->message);
      g_error_free (error);
      return NULL;
    }

  tracker_preferences = g_settings_new (TRACKER_SCHEMA);

  locations_dialog = GTK_WIDGET (gtk_builder_get_object (dialog_builder, "locations_dialog"));
  widget = GTK_WIDGET (gtk_builder_get_object (dialog_builder, "locations_scrolledwindow"));
  list_box = GTK_WIDGET (egg_list_box_new ());
  egg_list_box_add_to_scrolled (EGG_LIST_BOX (list_box), GTK_SCROLLED_WINDOW (widget));
  egg_list_box_set_sort_func (EGG_LIST_BOX (list_box),
                              place_compare_func, NULL, NULL);
  egg_list_box_set_separator_funcs (EGG_LIST_BOX (list_box),
                                    place_separator_func, NULL, NULL);
  gtk_widget_show (list_box);

  widget = GTK_WIDGET (gtk_builder_get_object (dialog_builder, "locations_remove"));
  gtk_widget_set_sensitive (widget, FALSE);
  g_signal_connect (list_box, "child-selected",
                    G_CALLBACK (list_box_child_selected), widget);
  g_signal_connect (widget, "clicked",
                    G_CALLBACK (remove_button_clicked), list_box);
  g_signal_connect_swapped (tracker_preferences, "changed::" TRACKER_KEY_RECURSIVE_DIRECTORIES,
                            G_CALLBACK (locations_dialog_refresh), list_box);

  widget = GTK_WIDGET (gtk_builder_get_object (dialog_builder, "locations_add"));
  g_signal_connect (widget, "clicked",
                    G_CALLBACK (add_button_clicked), list_box);

  gtk_window_set_transient_for (GTK_WINDOW (locations_dialog),
                                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
  g_signal_connect (locations_dialog, "response",
                    G_CALLBACK (gtk_widget_destroy), NULL);
  g_signal_connect (locations_dialog, "destroy",
                    G_CALLBACK (locations_dialog_destroy), NULL);

  populate_list_box (list_box);

  g_object_unref (dialog_builder);

  return locations_dialog;
}
예제 #3
0
static gboolean
egg_list_box_accessible_clear_selection (AtkSelection *selection)
{
  GtkWidget *box;

  box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (box == NULL)
    return FALSE;

  egg_list_box_select_child (EGG_LIST_BOX (box), NULL);
  return TRUE;
}
static void
remove_button_clicked (GtkWidget *widget,
                       gpointer user_data)
{
  GtkWidget *list_box = user_data;
  GtkWidget *child;
  Place *place;
  GPtrArray *new_values;

  child = egg_list_box_get_selected_child (EGG_LIST_BOX (list_box));
  place = g_object_get_data (G_OBJECT (child), "place");
  new_values = place_get_new_settings_values (place, TRUE);
  g_settings_set_strv (tracker_preferences, place->settings_key, (const gchar **) new_values->pdata);

  g_ptr_array_unref (new_values);
}
예제 #5
0
static gint
egg_list_box_accessible_get_selection_count (AtkSelection *selection)
{
  GtkWidget *box;
  GtkWidget *widget;

  box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (box == NULL)
    return 0;

  widget = egg_list_box_get_selected_child (EGG_LIST_BOX (box));
  if (widget == NULL)
    return 0;

  return 1;
}
예제 #6
0
static gboolean
egg_list_box_accessible_add_selection (AtkSelection *selection,
                                       gint          idx)
{
  GtkWidget *box;
  GList *children;
  GtkWidget *child;

  box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (box == NULL)
    return FALSE;

  children = gtk_container_get_children (GTK_CONTAINER (box));
  child = g_list_nth_data (children, idx);
  g_list_free (children);
  if (child)
    {
      egg_list_box_select_child (EGG_LIST_BOX (box), child);
      return TRUE;
    }
  return FALSE;
}
예제 #7
0
static AtkObject *
egg_list_box_accessible_ref_selection (AtkSelection *selection,
                                       gint          idx)
{
  GtkWidget *box;
  GtkWidget *widget;
  AtkObject *accessible;

  if (idx != 0)
    return NULL;

  box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
  if (box == NULL)
    return NULL;

  widget = egg_list_box_get_selected_child (EGG_LIST_BOX (box));
  if (widget == NULL)
    return NULL;

  accessible = gtk_widget_get_accessible (widget);
  g_object_ref (accessible);
  return accessible;
}