[gnome-builder/wip/chergert/perspective] misc suggestions from gregier



commit cc51251ab2c53053d9f989034e899499221a1f29
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 4 21:13:46 2015 -0800

    misc suggestions from gregier

 libide/greeter/ide-greeter-project-row.c |   12 ++++++++----
 libide/ide-application-credits.h         |    6 ------
 libide/ide-application.c                 |    4 +++-
 libide/ide-css-provider.c                |   27 +++++++++++----------------
 libide/ide-project-info.c                |    4 ++--
 libide/ide-project-info.h                |    3 ++-
 6 files changed, 26 insertions(+), 30 deletions(-)
---
diff --git a/libide/greeter/ide-greeter-project-row.c b/libide/greeter/ide-greeter-project-row.c
index 6988216..b90151b 100644
--- a/libide/greeter/ide-greeter-project-row.c
+++ b/libide/greeter/ide-greeter-project-row.c
@@ -119,14 +119,16 @@ static void
 ide_greeter_project_row_add_languages (IdeGreeterProjectRow *self,
                                        IdeProjectInfo       *project_info)
 {
-  gchar **languages;
+  const gchar * const *languages;
 
   g_return_if_fail (IDE_IS_GREETER_PROJECT_ROW (self));
   g_return_if_fail (IDE_IS_PROJECT_INFO (project_info));
 
-  if ((languages = ide_project_info_get_languages (project_info)))
+  languages = ide_project_info_get_languages (project_info);
+
+  if (languages != NULL)
     {
-      guint len = g_strv_length (languages);
+      guint len = g_strv_length ((gchar **)languages);
       gsize i;
 
       for (i = len; i > 0; i--)
@@ -207,9 +209,11 @@ truncate_location (GBinding     *binding,
       if ((relative_path = g_file_get_relative_path (home_dir, file)) ||
           (relative_path = g_file_get_path (file)))
         {
-          g_value_set_string (to_value, relative_path);
+          g_value_take_string (to_value, relative_path);
           return TRUE;
         }
+
+      g_free (relative_path);
     }
 
   uri = g_file_get_uri (file);
diff --git a/libide/ide-application-credits.h b/libide/ide-application-credits.h
index abe7f92..1217bfb 100644
--- a/libide/ide-application-credits.h
+++ b/libide/ide-application-credits.h
@@ -99,7 +99,6 @@ static const gchar *ide_application_credits_authors[] = {
   "Samir Ribic",
   "Sébastien Lafargue",
   "Timm Bäder",
-  "TingPing",
   "Ting-Wei Lan",
   "Tobias Schönberg",
   "Tom Tryfonidis",
@@ -133,7 +132,6 @@ static const gchar *ide_application_credits_funders[] = {
   "Alexander Khatsayuk",
   "Alexander Larsson",
   "Alexander Murray",
-  "Alexander Murray",
   "Alexandre Amoedo",
   "Alexandre Franke",
   "Alexandros Diavatis",
@@ -155,7 +153,6 @@ static const gchar *ide_application_credits_funders[] = {
   "Baldessari Michele",
   "Bastian Ilsø Hougaard",
   "Bastien Nocera",
-  "Bastien Nocera",
   "Benjamin Grimm-Lebsanft",
   "Bernd Homuth",
   "Bill Roth",
@@ -407,7 +404,6 @@ static const gchar *ide_application_credits_funders[] = {
   "Philip Whitfield",
   "Piotr Zurek",
   "R A McQueen",
-  "R A McQueen",
   "RM van Schouwen",
   "Radosław Sierbiński",
   "Ray Strode",
@@ -471,14 +467,12 @@ static const gchar *ide_application_credits_funders[] = {
   "Uwe Hametner",
   "Vadzim Rutkouski",
   "Valter Schütz",
-  "WP MANLEY",
   "WP Manley",
   "Wee Weea",
   "Wesley Wiser",
   "Will Binns-Smith",
   "William Hoffmann",
   "William J Thompson",
-  "William J Thompson",
   "William Jon McCann",
   "William R Lachance",
   "Z Jedrzejewski-Szmek",
diff --git a/libide/ide-application.c b/libide/ide-application.c
index 289cdb0..cbabbb8 100644
--- a/libide/ide-application.c
+++ b/libide/ide-application.c
@@ -63,7 +63,9 @@ ide_application_can_load_plugin (IdeApplication *self,
     return FALSE;
 
   plugin_name = peas_plugin_info_get_module_name (plugin_info);
-  if (ide_str_equal0 (plugin_name, self->type))
+
+  /* If --type was specified, only that plugin may be loaded */
+  if ((self->type != NULL) && !ide_str_equal0 (plugin_name, self->type))
     return FALSE;
 
   return TRUE;
diff --git a/libide/ide-css-provider.c b/libide/ide-css-provider.c
index ccf1857..e0a7474 100644
--- a/libide/ide-css-provider.c
+++ b/libide/ide-css-provider.c
@@ -28,7 +28,6 @@ struct _IdeCssProvider
   GtkCssProvider parent_instance;
 
   GtkSettings *settings;
-  gulong       notify_gtk_theme_name_handler;
 };
 
 G_DEFINE_TYPE (IdeCssProvider, ide_css_provider, GTK_TYPE_CSS_PROVIDER)
@@ -129,20 +128,17 @@ ide_css_provider_constructed (GObject *object)
 
   self->settings = g_object_ref (gtk_settings_get_default ());
 
-  self->notify_gtk_theme_name_handler =
-    g_signal_connect_object (self->settings,
-                             "notify::gtk-theme-name",
-                             G_CALLBACK (ide_css_provider__settings_notify_gtk_theme_name),
-                             self,
-                             G_CONNECT_SWAPPED);
-
-  self->notify_gtk_theme_name_handler =
-    g_signal_connect_object (
-      self->settings,
-      "notify::gtk-application-prefer-dark-theme",
-      G_CALLBACK (ide_css_provider__settings_notify_gtk_application_prefer_dark_theme),
-      self,
-      G_CONNECT_SWAPPED);
+  g_signal_connect_object (self->settings,
+                           "notify::gtk-theme-name",
+                           G_CALLBACK (ide_css_provider__settings_notify_gtk_theme_name),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  g_signal_connect_object (self->settings,
+                           "notify::gtk-application-prefer-dark-theme",
+                           G_CALLBACK (ide_css_provider__settings_notify_gtk_application_prefer_dark_theme),
+                           self,
+                           G_CONNECT_SWAPPED);
 
   ide_css_provider_update (self);
 }
@@ -152,7 +148,6 @@ ide_css_provider_finalize (GObject *object)
 {
   IdeCssProvider *self = (IdeCssProvider *)object;
 
-  ide_clear_signal_handler (self->settings, &self->notify_gtk_theme_name_handler);
   g_clear_object (&self->settings);
 
   G_OBJECT_CLASS (ide_css_provider_parent_class)->finalize (object);
diff --git a/libide/ide-project-info.c b/libide/ide-project-info.c
index 66bd8b1..05b3ef3 100644
--- a/libide/ide-project-info.c
+++ b/libide/ide-project-info.c
@@ -102,12 +102,12 @@ ide_project_info_set_doap (IdeProjectInfo *self,
  *
  * Returns: (transfer none): An array of language names.
  */
-gchar **
+const gchar * const *
 ide_project_info_get_languages (IdeProjectInfo *self)
 {
   g_return_val_if_fail (IDE_IS_PROJECT_INFO (self), NULL);
 
-  return self->languages;
+  return (const gchar * const *)self->languages;
 }
 
 void
diff --git a/libide/ide-project-info.h b/libide/ide-project-info.h
index 631bd85..64031fd 100644
--- a/libide/ide-project-info.h
+++ b/libide/ide-project-info.h
@@ -38,7 +38,8 @@ GFile        *ide_project_info_get_directory        (IdeProjectInfo  *self);
 gboolean      ide_project_info_get_is_recent        (IdeProjectInfo  *self);
 gint          ide_project_info_get_priority         (IdeProjectInfo  *self);
 GDateTime    *ide_project_info_get_last_modified_at (IdeProjectInfo  *self);
-gchar       **ide_project_info_get_languages        (IdeProjectInfo  *self);
+const gchar * const *
+              ide_project_info_get_languages        (IdeProjectInfo  *self);
 const gchar  *ide_project_info_get_name             (IdeProjectInfo  *self);
 void          ide_project_info_set_file             (IdeProjectInfo  *self,
                                                      GFile           *file);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]