[gnote] Replace std::string by Glib::ustring in bugzilla



commit 4ad6a623f49cd39205345e14b9c9980c2cd87d45
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Feb 4 19:03:50 2017 +0200

    Replace std::string by Glib::ustring in bugzilla

 src/addins/bugzilla/bugzillanoteaddin.cpp   |   14 +++++-----
 src/addins/bugzilla/bugzillanoteaddin.hpp   |    8 +++---
 src/addins/bugzilla/bugzillapreferences.cpp |   34 +++++++++++++-------------
 src/addins/bugzilla/bugzillapreferences.hpp |   22 ++++++++--------
 src/addins/bugzilla/insertbugaction.cpp     |    3 +-
 src/addins/bugzilla/insertbugaction.hpp     |    7 ++---
 6 files changed, 44 insertions(+), 44 deletions(-)
---
diff --git a/src/addins/bugzilla/bugzillanoteaddin.cpp b/src/addins/bugzilla/bugzillanoteaddin.cpp
index ddb3647..9079612 100644
--- a/src/addins/bugzilla/bugzillanoteaddin.cpp
+++ b/src/addins/bugzilla/bugzillanoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010,2012-2013 Aurimas Cernius
+ * Copyright (C) 2010,2012-2013,2017 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -55,7 +55,7 @@ namespace bugzilla {
   {
     const bool is_first_run
                  = !sharp::directory_exists(images_dir());
-    const std::string old_images_dir
+    const Glib::ustring old_images_dir
       = Glib::build_filename(gnote::IGnote::old_note_dir(),
                              "BugzillaIcons");
     const bool migration_needed
@@ -69,7 +69,7 @@ namespace bugzilla {
       migrate_images(old_images_dir);
   }
 
-  std::string BugzillaNoteAddin::images_dir()
+  Glib::ustring BugzillaNoteAddin::images_dir()
   {
     return Glib::build_filename(gnote::IGnote::conf_dir(),
                                 "BugzillaIcons");
@@ -84,7 +84,7 @@ namespace bugzilla {
   }
 
   void BugzillaNoteAddin::migrate_images(
-                            const std::string & old_images_dir)
+                            const Glib::ustring & old_images_dir)
   {
     const Glib::RefPtr<Gio::File> src
       = Gio::File::create_for_path(old_images_dir);
@@ -127,7 +127,7 @@ namespace bugzilla {
   void BugzillaNoteAddin::drop_uri_list(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, 
                                         const Gtk::SelectionData & selection_data, guint time)
   {
-    std::string uriString = selection_data.get_text();
+    Glib::ustring uriString = selection_data.get_text();
     if(uriString.empty()) {
       return;
     }
@@ -153,7 +153,7 @@ namespace bugzilla {
   }
 
 
-  bool BugzillaNoteAddin::insert_bug(int x, int y, const std::string & uri, int id)
+  bool BugzillaNoteAddin::insert_bug(int x, int y, const Glib::ustring & uri, int id)
   {
     try {
       BugzillaLink::Ptr link_tag = 
@@ -171,7 +171,7 @@ namespace bugzilla {
       get_window()->editor()->get_iter_at_location(cursor, x, y);
       buffer->place_cursor (cursor);
 
-      std::string string_id = TO_STRING(id);
+      Glib::ustring string_id = TO_STRING(id);
       buffer->undoer().add_undo_action (new InsertBugAction (cursor, 
                                                              string_id, 
                                                              link_tag));
diff --git a/src/addins/bugzilla/bugzillanoteaddin.hpp b/src/addins/bugzilla/bugzillanoteaddin.hpp
index ecb5f7b..0b14b46 100644
--- a/src/addins/bugzilla/bugzillanoteaddin.hpp
+++ b/src/addins/bugzilla/bugzillanoteaddin.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010,2013 Aurimas Cernius
+ * Copyright (C) 2010,2013,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -47,13 +47,13 @@ public:
     {
       return new BugzillaNoteAddin;
     }
-  static std::string images_dir();
+  static Glib::ustring images_dir();
   virtual void initialize() override;
   virtual void shutdown() override;
   virtual void on_note_opened() override;
 private:
   BugzillaNoteAddin();
-  void migrate_images(const std::string & old_images_dir);
+  void migrate_images(const Glib::ustring & old_images_dir);
 
   static const char * TAG_NAME;
 
@@ -62,7 +62,7 @@ private:
   void drop_uri_list(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, 
                      const Gtk::SelectionData & selection_data, guint time);
 
-  bool insert_bug (int x, int y, const std::string & uri, int id);
+  bool insert_bug (int x, int y, const Glib::ustring & uri, int id);
 
 };
 
diff --git a/src/addins/bugzilla/bugzillapreferences.cpp b/src/addins/bugzilla/bugzillapreferences.cpp
index 992988d..b2ed008 100644
--- a/src/addins/bugzilla/bugzillapreferences.cpp
+++ b/src/addins/bugzilla/bugzillapreferences.cpp
@@ -44,7 +44,7 @@
 namespace bugzilla {
 
   bool BugzillaPreferences::s_static_inited = false;;
-  std::string BugzillaPreferences::s_image_dir;
+  Glib::ustring BugzillaPreferences::s_image_dir;
 
   void BugzillaPreferences::_init_static()
   {
@@ -157,7 +157,7 @@ namespace bugzilla {
         continue;
       }
 
-      std::string host = parse_host (file_info);
+      Glib::ustring host = parse_host(file_info);
       if (!host.empty()) {
         Gtk::TreeIter treeiter = icon_store->append ();
         
@@ -169,7 +169,7 @@ namespace bugzilla {
   }
 
 
-  std::string BugzillaPreferences::parse_host(const sharp::FileInfo & file_info)
+  Glib::ustring BugzillaPreferences::parse_host(const sharp::FileInfo & file_info)
   {
     Glib::ustring name = file_info.get_name();
     Glib::ustring ext = file_info.get_extension();
@@ -207,11 +207,11 @@ namespace bugzilla {
   namespace {
 
     /** sanitize the hostname. Return false if nothing could be done */
-    bool sanitize_hostname(std::string & hostname)
+    bool sanitize_hostname(Glib::ustring & hostname)
     {
-      if(hostname.find("/") != std::string::npos || hostname.find(":") != std::string::npos) {
+      if(hostname.find("/") != Glib::ustring::npos || hostname.find(":") != Glib::ustring::npos) {
         sharp::Uri uri(hostname);
-        std::string new_host = uri.get_host();
+        Glib::ustring new_host = uri.get_host();
         if(new_host.empty()) {
           return false;
         }
@@ -252,8 +252,8 @@ namespace bugzilla {
     dialog.set_extra_widget(*hbox);
 
     int response;
-    std::string icon_file;
-    std::string host;
+    Glib::ustring icon_file;
+    Glib::ustring host;
 
     while(1) {
       response = dialog.run ();
@@ -289,12 +289,12 @@ namespace bugzilla {
     last_opened_dir = dialog.get_current_folder();
 
     // Copy the file to the BugzillaIcons directory
-    std::string err_msg;
+    Glib::ustring err_msg;
     if (!copy_to_bugzilla_icons_dir (icon_file, host, err_msg)) {
       gnote::utils::HIGMessageDialog err(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
                                          Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
                                          _("Error saving icon"),
-                                         std::string(_("Could not save the icon file.")) +
+                                         Glib::ustring(_("Could not save the icon file.")) +
                                          "  " + err_msg);
       err.run();
     }
@@ -302,15 +302,15 @@ namespace bugzilla {
     update_icon_store();
   }
 
-  bool BugzillaPreferences::copy_to_bugzilla_icons_dir(const std::string & file_path,
-                                                       const std::string & host,
-                                                       std::string & err_msg)
+  bool BugzillaPreferences::copy_to_bugzilla_icons_dir(const Glib::ustring & file_path,
+                                                       const Glib::ustring & host,
+                                                       Glib::ustring & err_msg)
   {
     err_msg = "";
 
     sharp::FileInfo file_info(file_path);
-    std::string ext = file_info.get_extension();
-    std::string saved_path = s_image_dir + "/" + host + ext;
+    Glib::ustring ext = file_info.get_extension();
+    Glib::ustring saved_path = s_image_dir + "/" + host + ext;
     try {
       if (!sharp::directory_exists (s_image_dir)) {
         g_mkdir_with_parents(s_image_dir.c_str(), S_IRWXU);
@@ -327,7 +327,7 @@ namespace bugzilla {
     return true;
   }
 
-  void BugzillaPreferences::resize_if_needed(const std::string & p)
+  void BugzillaPreferences::resize_if_needed(const Glib::ustring & p)
   {
     Glib::RefPtr<Gdk::Pixbuf> pix, newpix;
 
@@ -361,7 +361,7 @@ namespace bugzilla {
       return;
     }
 
-    std::string icon_path = (*iter)[m_columns.file_path];
+    Glib::ustring icon_path = (*iter)[m_columns.file_path];
 
     gnote::utils::HIGMessageDialog dialog(NULL, 
                                           GTK_DIALOG_DESTROY_WITH_PARENT,
diff --git a/src/addins/bugzilla/bugzillapreferences.hpp b/src/addins/bugzilla/bugzillapreferences.hpp
index e5940c2..5700a1c 100644
--- a/src/addins/bugzilla/bugzillapreferences.hpp
+++ b/src/addins/bugzilla/bugzillapreferences.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013 Aurimas Cernius
+ * Copyright (C) 2013,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -52,13 +52,13 @@ protected:
 
 private:
   void update_icon_store();
-  std::string parse_host(const sharp::FileInfo &);
+  Glib::ustring parse_host(const sharp::FileInfo &);
   void selection_changed();
   void add_clicked();
-       bool copy_to_bugzilla_icons_dir(const std::string & file_path,
-                                  const std::string & host,
-                                  std::string & err_msg);
-  void resize_if_needed(const std::string & path);
+  bool copy_to_bugzilla_icons_dir(const Glib::ustring & file_path,
+                                  const Glib::ustring & host,
+                                  Glib::ustring & err_msg);
+  void resize_if_needed(const Glib::ustring & path);
   void remove_clicked();
 
   class Columns
@@ -68,8 +68,8 @@ private:
     Columns()
       { add(icon); add(host); add(file_path); }
     Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
-    Gtk::TreeModelColumn<std::string>                host;
-    Gtk::TreeModelColumn<std::string>                file_path;
+    Gtk::TreeModelColumn<Glib::ustring>              host;
+    Gtk::TreeModelColumn<Glib::ustring>              file_path;
   };
 
   Columns        m_columns;
@@ -79,11 +79,11 @@ private:
   Gtk::Button *add_button;
   Gtk::Button *remove_button;
 
-  std::string last_opened_dir;
+  Glib::ustring last_opened_dir;
 
   void _init_static();
-  static bool        s_static_inited;
-  static std::string s_image_dir;
+  static bool          s_static_inited;
+  static Glib::ustring s_image_dir;
 };
 
 }
diff --git a/src/addins/bugzilla/insertbugaction.cpp b/src/addins/bugzilla/insertbugaction.cpp
index c510ec7..6502a0f 100644
--- a/src/addins/bugzilla/insertbugaction.cpp
+++ b/src/addins/bugzilla/insertbugaction.cpp
@@ -1,6 +1,7 @@
 /*
  * gnote
  *
+ * Copyright (C) 2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -26,7 +27,7 @@ using gnote::InsertAction;
 
 namespace bugzilla {
 
-  InsertBugAction::InsertBugAction(const Gtk::TextIter & start, const std::string & id,
+  InsertBugAction::InsertBugAction(const Gtk::TextIter & start, const Glib::ustring & id,
                                    const BugzillaLink::Ptr & tag)
     : m_tag(tag)
     , m_offset(start.get_offset())
diff --git a/src/addins/bugzilla/insertbugaction.hpp b/src/addins/bugzilla/insertbugaction.hpp
index 60fe0a8..29044a5 100644
--- a/src/addins/bugzilla/insertbugaction.hpp
+++ b/src/addins/bugzilla/insertbugaction.hpp
@@ -1,6 +1,7 @@
 /*
  * gnote
  *
+ * Copyright (C) 2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -20,8 +21,6 @@
 #ifndef __BUGZILLA_INSERT_BUG_ACTION_HPP_
 #define __BUGZILLA_INSERT_BUG_ACTION_HPP_
 
-#include <string>
-
 #include "undo.hpp"
 
 #include "bugzillalink.hpp"
@@ -32,7 +31,7 @@ class InsertBugAction
   : public gnote::SplitterAction
 {
 public:
-  InsertBugAction(const Gtk::TextIter & start, const std::string & id,
+  InsertBugAction(const Gtk::TextIter & start, const Glib::ustring & id,
                   const BugzillaLink::Ptr & tag);
   void undo (Gtk::TextBuffer * buffer);
   void redo (Gtk::TextBuffer * buffer);
@@ -43,7 +42,7 @@ public:
 private:
   BugzillaLink::Ptr m_tag;
   int               m_offset;
-  std::string       m_id;
+  Glib::ustring     m_id;
 };
 
 


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