Commit cb2e6847 authored by Iain Lane's avatar Iain Lane
Browse files

New upstream version 3.34.0.1

parents e75e6a23 ea7b65a7
================
Version 3.34.0.1
================
Sound
- Fix sliders not behaving properly
================
Version 3.34.0
================
- Updated translations
================
Version 3.33.90
================
......
project(
'gnome-control-center', 'c',
version : '3.33.90',
version : '3.34.0.1',
license : 'GPL2+',
meson_version : '>= 0.50.0'
)
......
......@@ -192,5 +192,11 @@ datetime_panel_lib = static_library(
)
panels_libs += datetime_panel_lib
datetime_panel_lib_dep = declare_dependency(
sources : resources,
include_directories : [top_inc, include_directories('.')],
link_with : datetime_panel_lib
)
subdir('po-timezones')
subdir('icons')
......@@ -1211,13 +1211,18 @@ is_scaled_mode_allowed (CcDisplayConfigDBus *self,
CcDisplayMode *pmode,
double scale)
{
gint width, height;
CcDisplayModeDBus *mode = CC_DISPLAY_MODE_DBUS (pmode);
if (!cc_display_mode_dbus_is_supported_scale (pmode, scale))
return FALSE;
return (round (mode->width / scale) >= self->min_width &&
round (mode->height / scale) >= self->min_height);
/* Do the math as if the monitor is always in landscape mode. */
width = round (mode->width / scale);
height = round (mode->height / scale);
return (MAX (width, height) >= self->min_width &&
MIN (width, height) >= self->min_height);
}
static gboolean
......
......@@ -40,7 +40,10 @@
#include "cc-display-resources.h"
#include "cc-display-settings.h"
/* The minimum supported size for the panel */
/* The minimum supported size for the panel
* Note that WIDTH is assumed to be the larger size and we accept portrait
* mode too effectively (in principle we should probably restrict the rotation
* setting in that case). */
#define MINIMUM_WIDTH 740
#define MINIMUM_HEIGHT 530
......
......@@ -10,7 +10,8 @@
}
.night-light-temperature trough {
min-height: 8px;
padding-top: 2px;
padding-bottom: 2px;
background-image: linear-gradient(to right, mix(@bg_color, @ORANGE_100, 0.5), @ORANGE_500);
}
......
......@@ -48,7 +48,7 @@ typedef struct
{
const char *content_type;
gint label_offset;
/* A pattern used to filter supported mime types
/* Patterns used to filter supported mime types
when changing preferred applications. NULL
means no other types should be changed */
const char *extra_type_filter;
......@@ -96,17 +96,32 @@ default_app_changed (GtkAppChooserButton *button,
if (app_data->extra_type_filter)
{
g_auto(GStrv) entries = NULL;
const char *const *mime_types;
g_autoptr(GPatternSpec) pattern = NULL;
g_autoptr(GPtrArray) patterns = NULL;
pattern = g_pattern_spec_new (app_data->extra_type_filter);
mime_types = g_app_info_get_supported_types (info);
entries = g_strsplit (app_data->extra_type_filter, ";", -1);
patterns = g_ptr_array_new_with_free_func ((GDestroyNotify) g_pattern_spec_free);
for (i = 0; entries[i] != NULL; i++)
{
GPatternSpec *pattern = g_pattern_spec_new (entries[i]);
g_ptr_array_add (patterns, pattern);
}
mime_types = g_app_info_get_supported_types (info);
for (i = 0; mime_types && mime_types[i]; i++)
{
int j;
gboolean matched = FALSE;
g_autoptr(GError) local_error = NULL;
if (!g_pattern_match_string (pattern, mime_types[i]))
for (j = 0; j < patterns->len; j++)
{
GPatternSpec *pattern = g_ptr_array_index (patterns, j);
if (g_pattern_match_string (pattern, mime_types[i]))
matched = TRUE;
}
if (!matched)
continue;
if (g_app_info_set_as_default_for_type (info, mime_types[i], &local_error) == FALSE)
......@@ -158,11 +173,7 @@ info_panel_setup_default_app (CcInfoDefaultAppsPanel *self,
}
static DefaultAppData preferred_app_infos[] = {
/* for web, we need to support text/html,
application/xhtml+xml and x-scheme-handler/https,
hence the "*" pattern
*/
{ "x-scheme-handler/http", OFFSET (web_label), "*" },
{ "x-scheme-handler/http", OFFSET (web_label), "text/html;application/xhtml+xml;x-scheme-handler/https" },
{ "x-scheme-handler/mailto", OFFSET (mail_label), NULL },
{ "text/calendar", OFFSET (calendar_label), NULL },
{ "audio/x-vorbis+ogg", OFFSET (music_label), "audio/*" },
......
......@@ -437,7 +437,7 @@ get_os_name (void)
os_info = get_os_info ();
if (!os_info)
g_strdup (_("Unknown"));
return g_strdup (_("Unknown"));
name = g_hash_table_lookup (os_info, "NAME");
version_id = g_hash_table_lookup (os_info, "VERSION_ID");
......
......@@ -27,8 +27,6 @@
#define TRACKER_KEY_RECURSIVE_DIRECTORIES "index-recursive-directories"
#define TRACKER_KEY_SINGLE_DIRECTORIES "index-single-directories"
static GSettings *tracker_preferences = NULL;
typedef enum {
PLACE_XDG,
PLACE_BOOKMARKS,
......@@ -36,6 +34,7 @@ typedef enum {
} PlaceType;
typedef struct {
CcSearchLocationsDialog *dialog;
GFile *location;
gchar *display_name;
PlaceType place_type;
......@@ -46,6 +45,8 @@ typedef struct {
struct _CcSearchLocationsDialog {
HdyDialog parent;
GSettings *tracker_preferences;
GtkWidget *places_list;
GtkWidget *bookmarks_list;
GtkWidget *others_list;
......@@ -61,7 +62,9 @@ G_DEFINE_TYPE (CcSearchLocationsDialog, cc_search_locations_dialog, HDY_TYPE_DIA
static void
cc_search_locations_dialog_finalize (GObject *object)
{
g_clear_object (&tracker_preferences);
CcSearchLocationsDialog *self = CC_SEARCH_LOCATIONS_DIALOG (object);
g_clear_object (&self->tracker_preferences);
G_OBJECT_CLASS (cc_search_locations_dialog_parent_class)->finalize (object);
}
......@@ -87,7 +90,7 @@ place_free (Place * p)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Place, place_free)
static GList *
get_bookmarks (void)
get_bookmarks (CcSearchLocationsDialog *self)
{
g_autoptr(GFile) file = NULL;
g_autofree gchar *contents = NULL;
......@@ -123,6 +126,7 @@ get_bookmarks (void)
}
bookmark = g_slice_new0 (Place);
bookmark->dialog = self;
bookmark->location = g_file_new_for_uri (lines[idx]);
if (label != NULL)
......@@ -152,7 +156,7 @@ get_user_special_dir_if_not_home (GUserDirectory idx)
}
static GList *
get_xdg_dirs (void)
get_xdg_dirs (CcSearchLocationsDialog *self)
{
GList *xdg_dirs = NULL;
gint idx;
......@@ -171,6 +175,7 @@ get_xdg_dirs (void)
continue;
xdg_dir = g_slice_new0 (Place);
xdg_dir->dialog = self;
xdg_dir->location = g_file_new_for_path (path);
xdg_dir->display_name = g_file_get_basename (xdg_dir->location);
xdg_dir->place_type = PLACE_XDG;
......@@ -240,7 +245,7 @@ path_from_tracker_dir (const gchar *value)
}
static GList *
get_tracker_locations (void)
get_tracker_locations (CcSearchLocationsDialog *self)
{
g_auto(GStrv) locations = NULL;
GList *list;
......@@ -248,7 +253,7 @@ get_tracker_locations (void)
Place *location;
const gchar *path;
locations = g_settings_get_strv (tracker_preferences, TRACKER_KEY_RECURSIVE_DIRECTORIES);
locations = g_settings_get_strv (self->tracker_preferences, TRACKER_KEY_RECURSIVE_DIRECTORIES);
list = NULL;
for (idx = 0; locations[idx] != NULL; idx++)
......@@ -267,7 +272,7 @@ get_tracker_locations (void)
}
static GList *
get_places_list (void)
get_places_list (CcSearchLocationsDialog *self)
{
g_autoptr(GList) xdg_list = NULL;
g_autoptr(GList) tracker_list = NULL;
......@@ -281,13 +286,14 @@ get_places_list (void)
/* add home */
place = g_slice_new0 (Place);
place->dialog = self;
place->location = g_file_new_for_path (g_get_home_dir ());
place->place_type = PLACE_XDG;
place->display_name = g_strdup (_("Home"));
g_hash_table_insert (places, place->location, place);
/* first, load the XDG dirs */
xdg_list = get_xdg_dirs ();
xdg_list = get_xdg_dirs (self);
for (l = xdg_list; l != NULL; l = l->next)
{
place = l->data;
......@@ -295,7 +301,7 @@ get_places_list (void)
}
/* then, insert all the tracker locations that are not XDG dirs */
tracker_list = get_tracker_locations ();
tracker_list = get_tracker_locations (self);
for (l = tracker_list; l != NULL; l = l->next)
{
g_autoptr(Place) p = l->data;
......@@ -308,7 +314,7 @@ get_places_list (void)
}
/* finally, load bookmarks, and possibly update attributes */
bookmark_list = get_bookmarks ();
bookmark_list = get_bookmarks (self);
for (l = bookmark_list; l != NULL; l = l->next)
{
g_autoptr(Place) p = l->data;
......@@ -362,7 +368,8 @@ switch_tracker_get_mapping (GValue *value,
}
static GPtrArray *
place_get_new_settings_values (Place *place,
place_get_new_settings_values (CcSearchLocationsDialog *self,
Place *place,
gboolean remove)
{
g_auto(GStrv) values = NULL;
......@@ -373,7 +380,7 @@ place_get_new_settings_values (Place *place,
gint idx;
new_values = g_ptr_array_new_with_free_func (g_free);
values = g_settings_get_strv (tracker_preferences, place->settings_key);
values = g_settings_get_strv (self->tracker_preferences, place->settings_key);
path = g_file_get_path (place->location);
tracker_dir = path_to_tracker_dir (path);
......@@ -410,7 +417,7 @@ switch_tracker_set_mapping (const GValue *value,
gboolean remove;
remove = !g_value_get_boolean (value);
new_values = place_get_new_settings_values (place, remove);
new_values = place_get_new_settings_values (place->dialog, place, remove);
return g_variant_new_strv ((const gchar **) new_values->pdata, -1);
}
......@@ -449,7 +456,7 @@ place_query_info_ready (GObject *source,
gtk_widget_show (w);
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
g_settings_bind_with_mapping (tracker_preferences, place->settings_key,
g_settings_bind_with_mapping (place->dialog->tracker_preferences, place->settings_key,
w, "active",
G_SETTINGS_BIND_DEFAULT,
switch_tracker_get_mapping,
......@@ -458,16 +465,15 @@ place_query_info_ready (GObject *source,
}
static void
remove_button_clicked (GtkWidget *widget,
gpointer user_data)
remove_button_clicked (CcSearchLocationsDialog *self,
GtkWidget *button)
{
GtkWidget *row = user_data;
g_autoptr(GPtrArray) new_values = NULL;
Place *place;
place = g_object_get_data (G_OBJECT (row), "place");
new_values = place_get_new_settings_values (place, TRUE);
g_settings_set_strv (tracker_preferences, place->settings_key, (const gchar **) new_values->pdata);
place = g_object_get_data (G_OBJECT (button), "place");
new_values = place_get_new_settings_values (self, place, TRUE);
g_settings_set_strv (self->tracker_preferences, place->settings_key, (const gchar **) new_values->pdata);
}
static gint
......@@ -505,7 +511,7 @@ place_compare_func (gconstpointer a,
}
static GtkWidget *
create_row_for_place (Place *place)
create_row_for_place (CcSearchLocationsDialog *self, Place *place)
{
GtkWidget *child, *row, *remove_button;
......@@ -523,11 +529,12 @@ create_row_for_place (Place *place)
{
remove_button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
gtk_widget_show (remove_button);
g_object_set_data (G_OBJECT (remove_button), "place", place);
gtk_style_context_add_class (gtk_widget_get_style_context (remove_button), "flat");
gtk_box_pack_end (GTK_BOX (child), remove_button, FALSE, FALSE, 2);
g_signal_connect (remove_button, "clicked",
G_CALLBACK (remove_button_clicked), row);
g_signal_connect_swapped (remove_button, "clicked",
G_CALLBACK (remove_button_clicked), self);
}
place->cancellable = g_cancellable_new ();
......@@ -546,11 +553,11 @@ populate_list_boxes (CcSearchLocationsDialog *self)
Place *place;
GtkWidget *row;
places = get_places_list ();
places = get_places_list (self);
for (l = places; l != NULL; l = l->next)
{
place = l->data;
row = create_row_for_place (place);
row = create_row_for_place (self, place);
switch (place->place_type)
{
......@@ -570,9 +577,9 @@ populate_list_boxes (CcSearchLocationsDialog *self)
}
static void
add_file_chooser_response (GtkDialog *widget,
add_file_chooser_response (CcSearchLocationsDialog *self,
GtkResponseType response,
gpointer user_data)
GtkWidget *widget)
{
g_autoptr(Place) place = NULL;
g_autoptr(GPtrArray) new_values = NULL;
......@@ -584,32 +591,31 @@ add_file_chooser_response (GtkDialog *widget,
}
place = g_slice_new0 (Place);
place->dialog = self;
place->location = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (widget));
place->settings_key = TRACKER_KEY_RECURSIVE_DIRECTORIES;
place->display_name = g_file_get_basename (place->location);
new_values = place_get_new_settings_values (place, FALSE);
g_settings_set_strv (tracker_preferences, place->settings_key, (const gchar **) new_values->pdata);
new_values = place_get_new_settings_values (self, place, FALSE);
g_settings_set_strv (self->tracker_preferences, place->settings_key, (const gchar **) new_values->pdata);
gtk_widget_destroy (GTK_WIDGET (widget));
}
static void
add_button_clicked (GtkWidget *widget,
gpointer user_data)
add_button_clicked (CcSearchLocationsDialog *self)
{
GtkWidget *list_box = user_data;
GtkWidget *file_chooser;
file_chooser = gtk_file_chooser_dialog_new (_("Select Location"),
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_window_set_modal (GTK_WINDOW (file_chooser), TRUE);
g_signal_connect (file_chooser, "response",
G_CALLBACK (add_file_chooser_response), list_box);
g_signal_connect_swapped (file_chooser, "response",
G_CALLBACK (add_file_chooser_response), self);
gtk_widget_show (file_chooser);
}
......@@ -623,14 +629,14 @@ other_places_refresh (CcSearchLocationsDialog *self)
gtk_container_foreach (GTK_CONTAINER (self->others_list), (GtkCallback) gtk_widget_destroy, NULL);
places = get_places_list ();
places = get_places_list (self);
for (l = places; l != NULL; l = l->next)
{
place = l->data;
if (place->place_type != PLACE_OTHER)
continue;
row = create_row_for_place (place);
row = create_row_for_place (self, place);
gtk_container_add (GTK_CONTAINER (self->others_list), row);
}
}
......@@ -644,7 +650,7 @@ cc_search_locations_dialog_new (CcSearchPanel *panel)
"use-header-bar", TRUE,
NULL);
tracker_preferences = g_settings_new (TRACKER_SCHEMA);
self->tracker_preferences = g_settings_new (TRACKER_SCHEMA);
populate_list_boxes (self);
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->others_list),
......@@ -652,7 +658,7 @@ cc_search_locations_dialog_new (CcSearchPanel *panel)
gtk_list_box_set_header_func (GTK_LIST_BOX (self->others_list), cc_list_box_update_header_func, NULL, NULL);
g_signal_connect_swapped (tracker_preferences, "changed::" TRACKER_KEY_RECURSIVE_DIRECTORIES,
g_signal_connect_swapped (self->tracker_preferences, "changed::" TRACKER_KEY_RECURSIVE_DIRECTORIES,
G_CALLBACK (other_places_refresh), self);
gtk_window_set_transient_for (GTK_WINDOW (self),
......
......@@ -125,7 +125,7 @@
<property name="visible">True</property>
<property name="halign">center</property>
<property name="margin">5</property>
<signal name="clicked" handler="add_button_clicked" swapped="no"/>
<signal name="clicked" handler="add_button_clicked" object="CcSearchLocationsDialog" swapped="yes"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
......
......@@ -260,6 +260,9 @@ cc_sound_panel_init (CcSoundPanel *self)
gvc_mixer_control_open (self->mixer_control);
cc_stream_list_box_set_mixer_control (self->stream_list_box, self->mixer_control);
cc_volume_slider_set_mixer_control (self->input_volume_slider, self->mixer_control);
cc_volume_slider_set_mixer_control (self->output_volume_slider, self->mixer_control);
cc_subwoofer_slider_set_mixer_control (self->subwoofer_slider, self->mixer_control);
cc_device_combo_box_set_mixer_control (self->input_device_combo_box, self->mixer_control, FALSE);
cc_device_combo_box_set_mixer_control (self->output_device_combo_box, self->mixer_control, TRUE);
}
......@@ -99,7 +99,7 @@ stream_added_cb (CcStreamListBox *self,
return;
}
row = cc_stream_row_new (self->label_size_group, stream, id, self->stream_type);
row = cc_stream_row_new (self->label_size_group, stream, id, self->stream_type, self->mixer_control);
gtk_widget_show (GTK_WIDGET (row));
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (row));
......
......@@ -73,10 +73,11 @@ cc_stream_row_init (CcStreamRow *self)
}
CcStreamRow *
cc_stream_row_new (GtkSizeGroup *size_group,
GvcMixerStream *stream,
guint id,
CcStreamType stream_type)
cc_stream_row_new (GtkSizeGroup *size_group,
GvcMixerStream *stream,
guint id,
CcStreamType stream_type,
GvcMixerControl *mixer_control)
{
CcStreamRow *self;
g_autoptr(GtkIconInfo) icon_info = NULL;
......@@ -110,6 +111,7 @@ cc_stream_row_new (GtkSizeGroup *size_group,
gtk_label_set_label (self->name_label, gvc_mixer_stream_get_name (stream));
cc_volume_slider_set_stream (self->volume_slider, stream, stream_type);
cc_volume_slider_set_mixer_control (self->volume_slider, mixer_control);
gtk_size_group_add_widget (size_group, GTK_WIDGET (self->label_box));
......
......@@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include <pulse/pulseaudio.h>
#include <gvc-mixer-control.h>
#include <gvc-mixer-stream.h>
#include "cc-sound-enums.h"
......@@ -29,10 +30,11 @@ G_BEGIN_DECLS
#define CC_TYPE_STREAM_ROW (cc_stream_row_get_type ())
G_DECLARE_FINAL_TYPE (CcStreamRow, cc_stream_row, CC, STREAM_ROW, GtkListBoxRow)
CcStreamRow *cc_stream_row_new (GtkSizeGroup *size_group,
GvcMixerStream *stream,
guint id,
CcStreamType stream_type);
CcStreamRow *cc_stream_row_new (GtkSizeGroup *size_group,
GvcMixerStream *stream,
guint id,
CcStreamType stream_type,
GvcMixerControl *mixer_control);
GvcMixerStream *cc_stream_row_get_stream (CcStreamRow *row);
......
......@@ -91,13 +91,20 @@ cc_subwoofer_slider_class_init (CcSubwooferSliderClass *klass)
void
cc_subwoofer_slider_init (CcSubwooferSlider *self)
{
gdouble vol_max_norm;
g_resources_register (cc_sound_get_resource ());
gtk_widget_init_template (GTK_WIDGET (self));
}
void
cc_subwoofer_slider_set_mixer_control (CcSubwooferSlider *self,
GvcMixerControl *mixer_control)
{
gdouble vol_max_norm;
g_return_if_fail (CC_IS_SUBWOOFER_SLIDER (self));
vol_max_norm = gvc_mixer_control_get_vol_max_norm (NULL);
vol_max_norm = gvc_mixer_control_get_vol_max_norm (mixer_control);
gtk_adjustment_set_upper (self->adjustment, vol_max_norm);
gtk_adjustment_set_page_increment (self->adjustment, vol_max_norm / 100.0);
}
......
......@@ -21,13 +21,17 @@
#include <gtk/gtk.h>
#include <pulse/pulseaudio.h>
#include <gvc-channel-map.h>
#include <gvc-mixer-control.h>
G_BEGIN_DECLS
#define CC_TYPE_SUBWOOFER_SLIDER (cc_subwoofer_slider_get_type ())
G_DECLARE_FINAL_TYPE (CcSubwooferSlider, cc_subwoofer_slider, CC, SUBWOOFER_SLIDER, GtkBox)
void cc_subwoofer_slider_set_channel_map (CcSubwooferSlider *slider,
GvcChannelMap *channel_map);
void cc_subwoofer_slider_set_mixer_control (CcSubwooferSlider *slider,
GvcMixerControl *mixer_control);
void cc_subwoofer_slider_set_channel_map (CcSubwooferSlider *slider,
GvcChannelMap *channel_map);
G_END_DECLS
......@@ -34,6 +34,8 @@ struct _CcVolumeSlider
GtkAdjustment *volume_adjustment;
GtkScale *volume_scale;
gboolean is_amplified;
GvcMixerControl *mixer_control;
GvcMixerStream *stream;
guint notify_volume_handler_id;
guint notify_is_muted_handler_id;
......@@ -53,33 +55,62 @@ volume_changed_cb (CcVolumeSlider *self)
rounded = round (volume);
gtk_toggle_button_set_active (self->mute_button, volume == 0.0);